Class: ActiveMerchant::Billing::PinGateway
- Defined in:
- lib/active_merchant/billing/gateways/pin.rb
Constant Summary
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PinGateway
constructor
A new instance of PinGateway.
-
#purchase(money, creditcard, options = {}) ⇒ Object
Create a charge using a credit card, card token or customer token.
-
#refund(money, token, options = {}) ⇒ Object
Refund a transaction, note that the money attribute is ignored at the moment as the API does not support partial refunds.
-
#store(creditcard, options = {}) ⇒ Object
Create a customer and associated credit card.
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from CreditCardFormatting
Constructor Details
#initialize(options = {}) ⇒ PinGateway
Returns a new instance of PinGateway.
14 15 16 17 |
# File 'lib/active_merchant/billing/gateways/pin.rb', line 14 def initialize( = {}) requires!(, :api_key) super end |
Instance Method Details
#purchase(money, creditcard, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/active_merchant/billing/gateways/pin.rb', line 23 def purchase(money, creditcard, = {}) post = {} add_amount(post, money, ) add_customer_data(post, ) add_invoice(post, ) add_creditcard(post, creditcard) add_address(post, creditcard, ) commit('charges', post, ) end |
#refund(money, token, options = {}) ⇒ Object
Refund a transaction, note that the money attribute is ignored at the moment as the API does not support partial refunds. The parameter is kept for compatibility reasons
49 50 51 |
# File 'lib/active_merchant/billing/gateways/pin.rb', line 49 def refund(money, token, = {}) commit("charges/#{CGI.escape(token)}/refunds", { :amount => amount(money) }, ) end |
#store(creditcard, options = {}) ⇒ Object
Create a customer and associated credit card. The token that is returned can be used instead of a credit card parameter in the purchase method
37 38 39 40 41 42 43 44 |
# File 'lib/active_merchant/billing/gateways/pin.rb', line 37 def store(creditcard, = {}) post = {} add_creditcard(post, creditcard) add_customer_data(post, ) add_address(post, creditcard, ) commit('customers', post, ) end |