Class: Worldline::Acquiring::SDK::V1::Domain::ApiPaymentResource
- Inherits:
-
Domain::DataObject
- Object
- Domain::DataObject
- Worldline::Acquiring::SDK::V1::Domain::ApiPaymentResource
- Defined in:
- lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb
Instance Attribute Summary collapse
-
#card_payment_data ⇒ Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResource
The current value of card_payment_data.
-
#initial_authorization_code ⇒ String
The current value of initial_authorization_code.
-
#operations ⇒ Array<Worldline::Acquiring::SDK::V1::Domain::SubOperation>
The current value of operations.
-
#payment_id ⇒ String
The current value of payment_id.
-
#references ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses
The current value of references.
-
#status ⇒ String
The current value of status.
-
#status_timestamp ⇒ DateTime
The current value of status_timestamp.
-
#total_authorized_amount ⇒ Worldline::Acquiring::SDK::V1::Domain::AmountData
The current value of total_authorized_amount.
Instance Method Summary collapse
Methods inherited from Domain::DataObject
Instance Attribute Details
#card_payment_data ⇒ Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResource
Returns the current value of card_payment_data.
25 26 27 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 25 def card_payment_data @card_payment_data end |
#initial_authorization_code ⇒ String
Returns the current value of initial_authorization_code.
25 26 27 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 25 def @initial_authorization_code end |
#operations ⇒ Array<Worldline::Acquiring::SDK::V1::Domain::SubOperation>
Returns the current value of operations.
25 26 27 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 25 def operations @operations end |
#payment_id ⇒ String
Returns the current value of payment_id.
25 26 27 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 25 def payment_id @payment_id end |
#references ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses
Returns the current value of references.
25 26 27 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 25 def references @references end |
#status ⇒ String
Returns the current value of status.
25 26 27 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 25 def status @status end |
#status_timestamp ⇒ DateTime
Returns the current value of status_timestamp.
25 26 27 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 25 def @status_timestamp end |
#total_authorized_amount ⇒ Worldline::Acquiring::SDK::V1::Domain::AmountData
Returns the current value of total_authorized_amount.
25 26 27 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 25 def @total_authorized_amount end |
Instance Method Details
#from_hash(hash) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 57 def from_hash(hash) super if hash.has_key? 'cardPaymentData' raise TypeError, "value '%s' is not a Hash" % [hash['cardPaymentData']] unless hash['cardPaymentData'].is_a? Hash @card_payment_data = Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForResource.new_from_hash(hash['cardPaymentData']) end if hash.has_key? 'initialAuthorizationCode' @initial_authorization_code = hash['initialAuthorizationCode'] end if hash.has_key? 'operations' raise TypeError, "value '%s' is not an Array" % [hash['operations']] unless hash['operations'].is_a? Array @operations = [] hash['operations'].each do |e| @operations << Worldline::Acquiring::SDK::V1::Domain::SubOperation.new_from_hash(e) end end if hash.has_key? 'paymentId' @payment_id = hash['paymentId'] end if hash.has_key? 'references' raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash @references = Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses.new_from_hash(hash['references']) end if hash.has_key? 'status' @status = hash['status'] end if hash.has_key? 'statusTimestamp' @status_timestamp = DateTime.parse(hash['statusTimestamp']) end if hash.has_key? 'totalAuthorizedAmount' raise TypeError, "value '%s' is not a Hash" % [hash['totalAuthorizedAmount']] unless hash['totalAuthorizedAmount'].is_a? Hash @total_authorized_amount = Worldline::Acquiring::SDK::V1::Domain::AmountData.new_from_hash(hash['totalAuthorizedAmount']) end end |
#to_h ⇒ Hash
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/worldline/acquiring/sdk/v1/domain/api_payment_resource.rb', line 44 def to_h hash = super hash['cardPaymentData'] = @card_payment_data.to_h unless @card_payment_data.nil? hash['initialAuthorizationCode'] = @initial_authorization_code unless @initial_authorization_code.nil? hash['operations'] = @operations.collect{|val| val.to_h} unless @operations.nil? hash['paymentId'] = @payment_id unless @payment_id.nil? hash['references'] = @references.to_h unless @references.nil? hash['status'] = @status unless @status.nil? hash['statusTimestamp'] = @status_timestamp.iso8601(3) unless @status_timestamp.nil? hash['totalAuthorizedAmount'] = @total_authorized_amount.to_h unless @total_authorized_amount.nil? hash end |