Class: ActiveMerchant::Billing::FirstPayJsonGateway
- Includes:
- FirstPayCommon
- Defined in:
- lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb
Constant Summary collapse
- ACTIONS =
{ purchase: 'Sale', authorize: 'Auth', capture: 'Settle', refund: 'Refund', void: 'Void' }.freeze
- WALLET_TYPES =
{ apple_pay: 'ApplePay', google_pay: 'GooglePay' }.freeze
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #authorize(money, payment, options = {}) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ FirstPayJsonGateway
constructor
Creates a new FirstPayJsonGateway.
- #purchase(money, payment, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #scrub(transcript) ⇒ Object
- #void(authorization, options = {}) ⇒ Object
Methods included from FirstPayCommon
included, #supports_scrubbing?
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
#expdate, #format, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ FirstPayJsonGateway
Creates a new FirstPayJsonGateway
The gateway requires two values for connection to be passed in the options
hash.
Options
-
:merchant_key
– FirstPay’s merchant_key (REQUIRED) -
:processor_id
– FirstPay’s processor_id or processorId (REQUIRED)
33 34 35 36 |
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb', line 33 def initialize( = {}) requires!(, :merchant_key, :processor_id) super end |
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb', line 47 def (money, payment, = {}) post = {} add_invoice(post, money, ) add_payment(post, payment, ) add_address(post, payment, ) commit(:authorize, post) end |
#capture(money, authorization, options = {}) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb', line 56 def capture(money, , = {}) post = {} add_invoice(post, money, ) add_reference(post, ) commit(:capture, post) end |
#purchase(money, payment, options = {}) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb', line 38 def purchase(money, payment, = {}) post = {} add_invoice(post, money, ) add_payment(post, payment, ) add_address(post, payment, ) commit(:purchase, post) end |
#refund(money, authorization, options = {}) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb', line 64 def refund(money, , = {}) post = {} add_invoice(post, money, ) add_reference(post, ) commit(:refund, post) end |
#scrub(transcript) ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb', line 79 def scrub(transcript) transcript. gsub(%r(("processorId\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]'). gsub(%r(("merchantKey\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]'). gsub(%r(("cardNumber\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]'). gsub(%r(("paymentCryptogram\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]'). gsub(%r(("cvv\\?"\s*:\s*\\?)[^,]*)i, '\1[FILTERED]') end |
#void(authorization, options = {}) ⇒ Object
72 73 74 75 76 77 |
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb', line 72 def void(, = {}) post = {} add_reference(post, ) commit(:void, post) end |