Class: SolidusSixSaferpay::TransactionGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/solidus_six_saferpay/transaction_gateway.rb

Instance Method Summary collapse

Methods inherited from Gateway

#capture, #credit, #initialize, #initialize_payment, #purchase, #refund, #try_void, #void

Constructor Details

This class inherits a constructor from SolidusSixSaferpay::Gateway

Instance Method Details

#authorize(_amount, saferpay_payment, options = {}) ⇒ Object

NOTE: Saferpay does not allow authorization for partial amounts. Therefore, the given amount is ignored



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/solidus_six_saferpay/transaction_gateway.rb', line 19

def authorize(_amount, saferpay_payment, options = {})
  transaction_authorize = SixSaferpay::SixTransaction::Authorize.new(token: saferpay_payment.token)
  authorize_response = SixSaferpay::Client.post(transaction_authorize)

  response(
    true,
    "Saferpay Transaction authorize response: #{authorize_response.to_h}",
    authorize_response
  )
rescue SixSaferpay::Error => e
  handle_error(e, authorize_response)
end

#inquire(saferpay_payment, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/solidus_six_saferpay/transaction_gateway.rb', line 4

def inquire(saferpay_payment, options = {})
  transaction_inquire = SixSaferpay::SixTransaction::Inquire.new(transaction_reference: saferpay_payment.transaction_id)
  inquire_response = SixSaferpay::Client.post(transaction_inquire)

  response(
    true,
    "Saferpay Transaction inquire response: #{inquire_response.to_h}",
    inquire_response
  )
rescue SixSaferpay::Error => e
  handle_error(e, inquire_response)
end