Class: CoinsPaid::API::CallbackData

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/coins_paid/api/callback_data.rb

Constant Summary collapse

NOT_CONFIRMED =
'not_confirmed'
CANCELLED =
'cancelled'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_json(attributes) ⇒ Object



36
37
38
39
# File 'lib/coins_paid/api/callback_data.rb', line 36

def self.from_json(attributes)
  attributes[:foreign_id] ||= attributes.dig(:crypto_address, :foreign_id) || ''
  new(attributes)
end

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/coins_paid/api/callback_data.rb', line 45

def cancelled?
  status == CANCELLED
end

#pending?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/coins_paid/api/callback_data.rb', line 41

def pending?
  status == NOT_CONFIRMED
end