Class: AbacatePay::Enums::Billings::Statuses

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

Overview

Enumeration defining billing statuses.

This enumeration is used to represent the various statuses that a billing process can have.

Constant Summary collapse

PENDING =

Indicates that the billing is pending and has not yet been processed.

Returns:

  • (String)
"PENDING"
EXPIRED =

Indicates that the billing has expired and is no longer valid.

Returns:

  • (String)
"EXPIRED"
CANCELLED =

Indicates that the billing has been cancelled and will not be processed.

Returns:

  • (String)
"CANCELLED"
"PAID"
REFUNDED =

Indicates that the billing has been refunded to the payer.

Returns:

  • (String)
"REFUNDED"

Class Method Summary collapse

Class Method Details

.valid?(value) ⇒ Boolean

Validates if a given value is a valid status

Parameters:

  • value (String)

    The value to validate

Returns:

  • (Boolean)

    true if valid, false otherwise



39
40
41
# File 'lib/abacate_pay/enums/billings/statuses.rb', line 39

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



47
48
49
50
51
# File 'lib/abacate_pay/enums/billings/statuses.rb', line 47

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

  value
end

.valuesArray<String>

Gets all valid status values

Returns:

  • (Array<String>)

    List of all valid statuses



32
33
34
# File 'lib/abacate_pay/enums/billings/statuses.rb', line 32

def self.values
  [PENDING, EXPIRED, CANCELLED, PAID, REFUNDED]
end