Class: BuckarooClient::Transaction
- Inherits:
-
Object
- Object
- BuckarooClient::Transaction
- Defined in:
- lib/buckaroo_client/transaction.rb
Instance Attribute Summary collapse
-
#additional_services ⇒ Object
Returns the value of attribute additional_services.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#culture ⇒ Object
Returns the value of attribute culture.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#description ⇒ Object
Returns the value of attribute description.
-
#invoicenumber ⇒ Object
Returns the value of attribute invoicenumber.
-
#service ⇒ Object
Returns the value of attribute service.
-
#websitekey ⇒ Object
Returns the value of attribute websitekey.
Instance Method Summary collapse
- #gateway_attributes ⇒ Object
-
#initialize(args = {}) ⇒ Transaction
constructor
A new instance of Transaction.
Constructor Details
#initialize(args = {}) ⇒ Transaction
Returns a new instance of Transaction.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/buckaroo_client/transaction.rb', line 6 def initialize(args = {}) @websitekey = args[:websitekey] @amount = args[:amount] @culture = args.fetch(:culture, 'nl-NL') @currency = args.fetch(:currency, 'EUR') @description = args[:description] @invoicenumber = args[:invoicenumber] @service = args[:service] @additional_services = args.fetch(:additional_services, []) end |
Instance Attribute Details
#additional_services ⇒ Object
Returns the value of attribute additional_services.
4 5 6 |
# File 'lib/buckaroo_client/transaction.rb', line 4 def additional_services @additional_services end |
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/buckaroo_client/transaction.rb', line 3 def amount @amount end |
#culture ⇒ Object
Returns the value of attribute culture.
3 4 5 |
# File 'lib/buckaroo_client/transaction.rb', line 3 def culture @culture end |
#currency ⇒ Object
Returns the value of attribute currency.
3 4 5 |
# File 'lib/buckaroo_client/transaction.rb', line 3 def currency @currency end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/buckaroo_client/transaction.rb', line 3 def description @description end |
#invoicenumber ⇒ Object
Returns the value of attribute invoicenumber.
3 4 5 |
# File 'lib/buckaroo_client/transaction.rb', line 3 def invoicenumber @invoicenumber end |
#service ⇒ Object
Returns the value of attribute service.
4 5 6 |
# File 'lib/buckaroo_client/transaction.rb', line 4 def service @service end |
#websitekey ⇒ Object
Returns the value of attribute websitekey.
3 4 5 |
# File 'lib/buckaroo_client/transaction.rb', line 3 def websitekey @websitekey end |
Instance Method Details
#gateway_attributes ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/buckaroo_client/transaction.rb', line 17 def gateway_attributes output = { 'websitekey' => websitekey, 'amount' => amount, 'culture' => culture, 'currency' => currency, 'description' => description, 'invoicenumber' => invoicenumber, } if service output['service'] = service.servicecode output.merge!(service.gateway_attributes) end if additional_services.count > 0 output['additional_service'] = additional_services.map(&:servicecode).join(',') additional_services.each do |a| output.merge!(a.gateway_attributes) end end output end |