Class: AbacatePay::Enums::Billings::Methods

Inherits:
Object
  • Object
show all
Defined in:
lib/abacate_pay/enums/billings/methods.rb

Overview

Enumeration defining billing methods.

This enumeration is used to represent different payment methods available for billing.

Constant Summary collapse

PIX =

PIX payment method.

Returns:

  • (String)

    Represents the PIX payment method, a popular instant payment system in Brazil

"PIX"
CARD =

Returns Credit card payment.

Returns:

  • (String)

    Credit card payment

"CARD"
BOLETO =

Boleto bancário. Supports a due date and late-payment interest/fine - see Resources::Checkouts#due_date, #interest and #fine.

Returns:

  • (String)

    Boleto payment method

"BOLETO"

Class Method Summary collapse

Class Method Details

.valid?(value) ⇒ Boolean

Validates if a given value is a valid method

Parameters:

  • value (String)

    The value to validate

Returns:

  • (Boolean)

    true if valid, false otherwise



31
32
33
# File 'lib/abacate_pay/enums/billings/methods.rb', line 31

def self.valid?(value)
  values.include?(value)
end

.validate!(value) ⇒ String

Validates and returns the value if valid

Parameters:

  • value (String)

    The value to validate

Returns:

  • (String)

    The validated value

Raises:

  • (ArgumentError)

    if value is invalid



39
40
41
42
43
# File 'lib/abacate_pay/enums/billings/methods.rb', line 39

def self.validate!(value)
  raise ArgumentError, "Invalid payment method: #{value}" unless valid?(value)

  value
end

.valuesArray<String>

Gets all valid method values

Returns:

  • (Array<String>)

    List of all valid payment methods



24
25
26
# File 'lib/abacate_pay/enums/billings/methods.rb', line 24

def self.values
  [PIX, CARD, BOLETO]
end