Class: OnlinePayments::SDK::Domain::PaymentOutput

Inherits:
DataObject
  • Object
show all
Defined in:
lib/onlinepayments/sdk/domain/payment_output.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#acquired_amountOnlinePayments::SDK::Domain::AmountOfMoney

Returns the current value of acquired_amount.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def acquired_amount
  @acquired_amount
end

#amount_of_moneyOnlinePayments::SDK::Domain::AmountOfMoney

Returns the current value of amount_of_money.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def amount_of_money
  @amount_of_money
end

#amount_paidObject

Deprecated.

Amount that has been paid. This is deprecated. Use acquiredAmount instead.



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def amount_paid
  @amount_paid
end

#card_payment_method_specific_outputOnlinePayments::SDK::Domain::CardPaymentMethodSpecificOutput

Returns the current value of card_payment_method_specific_output.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def card_payment_method_specific_output
  @card_payment_method_specific_output
end

#customerOnlinePayments::SDK::Domain::CustomerOutput

Returns the current value of customer.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def customer
  @customer
end

#discountOnlinePayments::SDK::Domain::Discount

Returns the current value of discount.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def discount
  @discount
end

#merchant_parametersString

Returns the current value of merchant_parameters.

Returns:

  • (String)

    the current value of merchant_parameters



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def merchant_parameters
  @merchant_parameters
end

#mobile_payment_method_specific_outputOnlinePayments::SDK::Domain::MobilePaymentMethodSpecificOutput

Returns the current value of mobile_payment_method_specific_output.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def mobile_payment_method_specific_output
  @mobile_payment_method_specific_output
end

#payment_methodString

Returns the current value of payment_method.

Returns:

  • (String)

    the current value of payment_method



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def payment_method
  @payment_method
end

#redirect_payment_method_specific_outputOnlinePayments::SDK::Domain::RedirectPaymentMethodSpecificOutput

Returns the current value of redirect_payment_method_specific_output.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def redirect_payment_method_specific_output
  @redirect_payment_method_specific_output
end

#referencesOnlinePayments::SDK::Domain::PaymentReferences

Returns the current value of references.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def references
  @references
end

#sepa_direct_debit_payment_method_specific_outputOnlinePayments::SDK::Domain::SepaDirectDebitPaymentMethodSpecificOutput

Returns the current value of sepa_direct_debit_payment_method_specific_output.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def sepa_direct_debit_payment_method_specific_output
  @sepa_direct_debit_payment_method_specific_output
end

#shopping_cart_outputOnlinePayments::SDK::Domain::ShoppingCartOutput

Returns the current value of shopping_cart_output.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def shopping_cart_output
  @shopping_cart_output
end

#surcharge_specific_outputOnlinePayments::SDK::Domain::SurchargeSpecificOutput

Returns the current value of surcharge_specific_output.

Returns:



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def surcharge_specific_output
  @surcharge_specific_output
end

#transaction_dateDateTime

Returns the current value of transaction_date.

Returns:

  • (DateTime)

    the current value of transaction_date



36
37
38
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 36

def transaction_date
  @transaction_date
end

Instance Method Details

#from_hash(hash) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 90

def from_hash(hash)
  super
  if hash.has_key? 'acquiredAmount'
    raise TypeError, "value '%s' is not a Hash" % [hash['acquiredAmount']] unless hash['acquiredAmount'].is_a? Hash
    @acquired_amount = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['acquiredAmount'])
  end
  if hash.has_key? 'amountOfMoney'
    raise TypeError, "value '%s' is not a Hash" % [hash['amountOfMoney']] unless hash['amountOfMoney'].is_a? Hash
    @amount_of_money = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['amountOfMoney'])
  end
  if hash.has_key? 'amountPaid'
    @amount_paid = hash['amountPaid']
  end
  if hash.has_key? 'cardPaymentMethodSpecificOutput'
    raise TypeError, "value '%s' is not a Hash" % [hash['cardPaymentMethodSpecificOutput']] unless hash['cardPaymentMethodSpecificOutput'].is_a? Hash
    @card_payment_method_specific_output = OnlinePayments::SDK::Domain::CardPaymentMethodSpecificOutput.new_from_hash(hash['cardPaymentMethodSpecificOutput'])
  end
  if hash.has_key? 'customer'
    raise TypeError, "value '%s' is not a Hash" % [hash['customer']] unless hash['customer'].is_a? Hash
    @customer = OnlinePayments::SDK::Domain::CustomerOutput.new_from_hash(hash['customer'])
  end
  if hash.has_key? 'discount'
    raise TypeError, "value '%s' is not a Hash" % [hash['discount']] unless hash['discount'].is_a? Hash
    @discount = OnlinePayments::SDK::Domain::Discount.new_from_hash(hash['discount'])
  end
  if hash.has_key? 'merchantParameters'
    @merchant_parameters = hash['merchantParameters']
  end
  if hash.has_key? 'mobilePaymentMethodSpecificOutput'
    raise TypeError, "value '%s' is not a Hash" % [hash['mobilePaymentMethodSpecificOutput']] unless hash['mobilePaymentMethodSpecificOutput'].is_a? Hash
    @mobile_payment_method_specific_output = OnlinePayments::SDK::Domain::MobilePaymentMethodSpecificOutput.new_from_hash(hash['mobilePaymentMethodSpecificOutput'])
  end
  if hash.has_key? 'paymentMethod'
    @payment_method = hash['paymentMethod']
  end
  if hash.has_key? 'redirectPaymentMethodSpecificOutput'
    raise TypeError, "value '%s' is not a Hash" % [hash['redirectPaymentMethodSpecificOutput']] unless hash['redirectPaymentMethodSpecificOutput'].is_a? Hash
    @redirect_payment_method_specific_output = OnlinePayments::SDK::Domain::RedirectPaymentMethodSpecificOutput.new_from_hash(hash['redirectPaymentMethodSpecificOutput'])
  end
  if hash.has_key? 'references'
    raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
    @references = OnlinePayments::SDK::Domain::PaymentReferences.new_from_hash(hash['references'])
  end
  if hash.has_key? 'sepaDirectDebitPaymentMethodSpecificOutput'
    raise TypeError, "value '%s' is not a Hash" % [hash['sepaDirectDebitPaymentMethodSpecificOutput']] unless hash['sepaDirectDebitPaymentMethodSpecificOutput'].is_a? Hash
    @sepa_direct_debit_payment_method_specific_output = OnlinePayments::SDK::Domain::SepaDirectDebitPaymentMethodSpecificOutput.new_from_hash(hash['sepaDirectDebitPaymentMethodSpecificOutput'])
  end
  if hash.has_key? 'shoppingCartOutput'
    raise TypeError, "value '%s' is not a Hash" % [hash['shoppingCartOutput']] unless hash['shoppingCartOutput'].is_a? Hash
    @shopping_cart_output = OnlinePayments::SDK::Domain::ShoppingCartOutput.new_from_hash(hash['shoppingCartOutput'])
  end
  if hash.has_key? 'surchargeSpecificOutput'
    raise TypeError, "value '%s' is not a Hash" % [hash['surchargeSpecificOutput']] unless hash['surchargeSpecificOutput'].is_a? Hash
    @surcharge_specific_output = OnlinePayments::SDK::Domain::SurchargeSpecificOutput.new_from_hash(hash['surchargeSpecificOutput'])
  end
  if hash.has_key? 'transactionDate'
    @transaction_date = DateTime.parse(hash['transactionDate'])
  end
end

#to_hHash

Returns:

  • (Hash)


70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/onlinepayments/sdk/domain/payment_output.rb', line 70

def to_h
  hash = super
  hash['acquiredAmount'] = @acquired_amount.to_h unless @acquired_amount.nil?
  hash['amountOfMoney'] = @amount_of_money.to_h unless @amount_of_money.nil?
  hash['amountPaid'] = @amount_paid unless @amount_paid.nil?
  hash['cardPaymentMethodSpecificOutput'] = @card_payment_method_specific_output.to_h unless @card_payment_method_specific_output.nil?
  hash['customer'] = @customer.to_h unless @customer.nil?
  hash['discount'] = @discount.to_h unless @discount.nil?
  hash['merchantParameters'] = @merchant_parameters unless @merchant_parameters.nil?
  hash['mobilePaymentMethodSpecificOutput'] = @mobile_payment_method_specific_output.to_h unless @mobile_payment_method_specific_output.nil?
  hash['paymentMethod'] = @payment_method unless @payment_method.nil?
  hash['redirectPaymentMethodSpecificOutput'] = @redirect_payment_method_specific_output.to_h unless @redirect_payment_method_specific_output.nil?
  hash['references'] = @references.to_h unless @references.nil?
  hash['sepaDirectDebitPaymentMethodSpecificOutput'] = @sepa_direct_debit_payment_method_specific_output.to_h unless @sepa_direct_debit_payment_method_specific_output.nil?
  hash['shoppingCartOutput'] = @shopping_cart_output.to_h unless @shopping_cart_output.nil?
  hash['surchargeSpecificOutput'] = @surcharge_specific_output.to_h unless @surcharge_specific_output.nil?
  hash['transactionDate'] = @transaction_date.iso8601(3) unless @transaction_date.nil?
  hash
end