Class: ActiveMerchant::Billing::EwayRapidGateway
- Defined in:
- lib/active_merchant/billing/gateways/eway_rapid.rb
Constant Summary
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #authorize(amount, payment_method, options = {}) ⇒ Object
- #capture(amount, identification, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ EwayRapidGateway
constructor
A new instance of EwayRapidGateway.
-
#purchase(amount, payment_method, options = {}) ⇒ Object
Public: Run a purchase transaction.
-
#refund(amount, identification, options = {}) ⇒ Object
Public: Refund a transaction.
-
#store(payment_method, options = {}) ⇒ Object
Public: Store card details and return a valid token.
-
#update(customer_token, payment_method, options = {}) ⇒ Object
Public: Update a customer’s data.
- #void(identification, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #test?
Methods included from CreditCardFormatting
Constructor Details
#initialize(options = {}) ⇒ EwayRapidGateway
Returns a new instance of EwayRapidGateway.
16 17 18 19 |
# File 'lib/active_merchant/billing/gateways/eway_rapid.rb', line 16 def initialize( = {}) requires!(, :login, :password) super end |
Instance Method Details
#authorize(amount, payment_method, options = {}) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/active_merchant/billing/gateways/eway_rapid.rb', line 55 def (amount, payment_method, ={}) params = {} (params, ) add_invoice(params, amount, ) add_customer_data(params, ) add_credit_card(params, payment_method, ) commit(url_for('Authorisation'), params) end |
#capture(amount, identification, options = {}) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/active_merchant/billing/gateways/eway_rapid.rb', line 64 def capture(amount, identification, = {}) params = {} (params, ) add_invoice(params, amount, ) add_reference(params, identification) commit(url_for("CapturePayment"), params) end |
#purchase(amount, payment_method, options = {}) ⇒ Object
Public: Run a purchase transaction.
amount - The monetary amount of the transaction in cents. payment_method - The payment method or authorization token returned from store. options - A standard ActiveMerchant options hash:
:transaction_type - One of: Purchase (default), MOTO
or Recurring. For stored card payments (aka - TokenPayments),
this must be either MOTO or Recurring.
:order_id - A merchant-supplied identifier for the
transaction (optional).
:description - A merchant-supplied description of the
transaction (optional).
:currency - Three letter currency code for the
transaction (default: "AUD")
:billing_address - Standard ActiveMerchant address hash
(optional).
:shipping_address - Standard ActiveMerchant address hash
(optional).
:ip - The ip of the consumer initiating the
transaction (optional).
:application_id - A string identifying the application
submitting the transaction
(default: "https://github.com/Shopify/active_merchant")
Returns an ActiveMerchant::Billing::Response object where authorization is the Transaction ID on success
46 47 48 49 50 51 52 53 |
# File 'lib/active_merchant/billing/gateways/eway_rapid.rb', line 46 def purchase(amount, payment_method, ={}) params = {} (params, ) add_invoice(params, amount, ) add_customer_data(params, ) add_credit_card(params, payment_method, ) commit(url_for('Transaction'), params) end |
#refund(amount, identification, options = {}) ⇒ Object
Public: Refund a transaction.
amount - The monetary amount of the transaction in cents identification - The transaction id which is returned in the
of the successful purchase transaction
options - A standard ActiveMerchant options hash:
:order_id - A merchant-supplied identifier for the
transaction (optional).
:description - A merchant-supplied description of the
transaction (optional).
:currency - Three letter currency code for the
transaction (default: "AUD")
:billing_address - Standard ActiveMerchant address hash
(optional).
:shipping_address - Standard ActiveMerchant address hash
(optional).
:ip - The ip of the consumer initiating the
transaction (optional).
:application_id - A string identifying the application
submitting the transaction
(default: "https://github.com/Shopify/active_merchant")
Returns an ActiveMerchant::Billing::Response object
101 102 103 104 105 106 107 108 |
# File 'lib/active_merchant/billing/gateways/eway_rapid.rb', line 101 def refund(amount, identification, = {}) params = {} (params, ) add_invoice(params, amount, , "Refund") add_reference(params["Refund"], identification) add_customer_data(params, ) commit(url_for("Transaction/#{identification}/Refund"), params) end |
#store(payment_method, options = {}) ⇒ Object
Public: Store card details and return a valid token
payment_method - The payment method or nil if :customer_token is provided options - A supplemented ActiveMerchant options hash:
:order_id - A merchant-supplied identifier for the
transaction (optional).
:description - A merchant-supplied description of the
transaction (optional).
:billing_address - Standard ActiveMerchant address hash
(required).
:ip - The ip of the consumer initiating the
transaction (optional).
:application_id - A string identifying the application
submitting the transaction
(default: "https://github.com/Shopify/active_merchant")
Returns an ActiveMerchant::Billing::Response object where the authorization is the customer_token on success
127 128 129 130 131 132 133 134 135 136 |
# File 'lib/active_merchant/billing/gateways/eway_rapid.rb', line 127 def store(payment_method, = {}) requires!(, :billing_address) params = {} (params, ) add_invoice(params, 0, ) add_customer_data(params, ) add_credit_card(params, payment_method, ) params['Method'] = 'CreateTokenCustomer' commit(url_for("Transaction"), params) end |
#update(customer_token, payment_method, options = {}) ⇒ Object
Public: Update a customer’s data
customer_token - The customer token returned in the authorization of
a successful store transaction.
payment_method - The payment method or nil if :customer_token is provided options - A supplemented ActiveMerchant options hash:
:order_id - A merchant-supplied identifier for the
transaction (optional).
:description - A merchant-supplied description of the
transaction (optional).
:billing_address - Standard ActiveMerchant address hash
(optional).
:ip - The ip of the consumer initiating the
transaction (optional).
:application_id - A string identifying the application
submitting the transaction
(default: "https://github.com/Shopify/active_merchant")
Returns an ActiveMerchant::Billing::Response object where the authorization is the customer_token on success
157 158 159 160 161 162 163 164 165 166 |
# File 'lib/active_merchant/billing/gateways/eway_rapid.rb', line 157 def update(customer_token, payment_method, = {}) params = {} (params, ) add_invoice(params, 0, ) add_customer_data(params, ) add_credit_card(params, payment_method, ) add_customer_token(params, customer_token) params['Method'] = 'UpdateTokenCustomer' commit(url_for("Transaction"), params) end |
#void(identification, options = {}) ⇒ Object
72 73 74 75 76 |
# File 'lib/active_merchant/billing/gateways/eway_rapid.rb', line 72 def void(identification, = {}) params = {} add_reference(params, identification) commit(url_for("CancelAuthorisation"), params) end |