Class: WirecardSepa::Gateway
- Inherits:
-
Object
- Object
- WirecardSepa::Gateway
- Defined in:
- lib/wirecard_sepa/gateway.rb
Overview
Usage: config = WirecardSepa::Config.new(…) gateway = WirecardSepa::Gateway.new(config)
gateway.debit({ requested_amount: 12.12, .. })
> response
gateway.recurring_init
> response
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #debit(params) ⇒ Object
-
#initialize(config) ⇒ Gateway
constructor
A new instance of Gateway.
- #recurring_init(params) ⇒ Object
- #recurring_process(params) ⇒ Object
Constructor Details
#initialize(config) ⇒ Gateway
Returns a new instance of Gateway.
14 15 16 |
# File 'lib/wirecard_sepa/gateway.rb', line 14 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
12 13 14 |
# File 'lib/wirecard_sepa/gateway.rb', line 12 def config @config end |
Instance Method Details
#debit(params) ⇒ Object
18 19 20 21 22 |
# File 'lib/wirecard_sepa/gateway.rb', line 18 def debit(params) request_params = add_auth_params_and_custom_fields(params) request_xml = DirectDebit::Request.new(request_params).to_xml DirectDebit::Response.for_request post(request_xml) end |
#recurring_init(params) ⇒ Object
24 25 26 27 28 |
# File 'lib/wirecard_sepa/gateway.rb', line 24 def recurring_init(params) request_params = add_auth_params_and_custom_fields(params) request_xml = Recurring::FirstRequest.new(request_params).to_xml Recurring::FirstResponse.for_request post(request_xml) end |
#recurring_process(params) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/wirecard_sepa/gateway.rb', line 30 def recurring_process(params) request_params = params.merge({ merchant_account_id: config.merchant_account_id, request_id: request_id, }) request_xml = Recurring::RecurringRequest.new(request_params).to_xml Recurring::RecurringResponse.for_request post(request_xml) end |