Class: ActiveMerchant::Billing::PayArcGateway
- Defined in:
- lib/active_merchant/billing/gateways/pay_arc.rb
Constant Summary collapse
- STANDARD_ERROR_CODE_MAPPING =
{}
- STANDARD_ACTIONS =
{ token: { end_point: 'tokens', allowed_fields: %i[card_source card_number exp_month exp_year cvv card_holder_name address_line1 address_line2 city state zip country] }, capture: { end_point: 'charges', allowed_fields: %i[amount statement_description card_id currency customer_id token_id card_source tip_amount card_level sales_tax purchase_order supplier_reference_number customer_ref_id ship_to_zip amex_descriptor customer_vat_number summary_commodity_code shipping_charges duty_charges ship_from_zip destination_country_code vat_invoice order_date tax_category tax_type tax_amount tax_rate address_line1 zip terminal_id surcharge description email receipt_phone statement_descriptor ] }, void: { end_point: 'charges/{{chargeID}}/void', allowed_fields: %i[reason void_description] }, refund: { end_point: 'charges/{{charge_id}}/refunds', allowed_fields: %i[amount reason description] }, credit: { end_point: 'refunds/wo_reference', allowed_fields: %i[amount charge_description statement_description terminal_id card_source card_number exp_month exp_year cvv card_holder_name address_line1 address_line2 city state zip country currency reason receipt_phone receipt_email ] } }
- SUCCESS_STATUS =
%w[ submitted_for_settlement authorized partially_submitted_for_settlement credit partial_refund void refunded settled ]
- FAILURE_STATUS =
%w[not_processed failed_by_gateway invalid_track_data authorization_expired]
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, creditcard, options = {}) ⇒ Object
Authorize the payment API through PAYARC.
-
#capture(money, tx_reference, options = {}) ⇒ Object
Capture the payment of an existing, uncaptured, charge.
- #credit(money, creditcard, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ PayArcGateway
constructor
The gateway must be configured with Bearer token.
-
#purchase(money, creditcard, options = {}) ⇒ Object
Purchase API through PAYARC.
-
#refund(money, tx_reference, options = {}) ⇒ Object
Refund full / partial payment of an successful charge / capture / purchase.
- #scrub(transcript) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
:nodoc:.
-
#token(creditcard, options = {}) ⇒ Object
:nodoc:.
-
#verify(creditcard, options = {}) ⇒ Object
Verify the creditcard API through PAYARC.
-
#void(tx_reference, options = {}) ⇒ Object
Voids the transaction / charge.
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?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ PayArcGateway
The gateway must be configured with Bearer token.
:api_key
PAYARC’s Bearer token must be passsed to initialise the gateway.
51 52 53 54 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 51 def initialize( = {}) requires!(, :api_key) super end |
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
Authorize the payment API through PAYARC.
:money
A positive integer in cents representing how much to charge. The minimum amount is 50c USD.
:creditcard
CreditCard
object with card details.
:options
Other information like address, card source etc can be passed in options
Options
-
:card_source
– Source of payment (REQUIRED) ( INTERNET, SWIPE, PHONE, MAIL, MANUAL ) -
:currency
– Three-letter ISO currency code, in lowercase (REQUIRED) -
:card_holder_name
–Name of the Card Holder (OPTIONAL) -
:address_line1
– Set in payment method’s billing address (OPTIONAL) -
:address_line2
– Set in payment method’s billing address (OPTIONAL) -
:state
– State (OPTIONAL) -
:country
– Country (OPTIONAL) -
:statement_description
– An arbitrary string to be displayed on your costomer’s credit card statement. This may be up to 22 characters. (OPTIONAL) -
:card_level
– Commercial card level - “LEVEL2” OR “LEVEL3” (OPTIONAL) -
:sales_tax
– A positive integer in cents representing sales tax. (OPTIONAL) -
:terminal_id
– Optional terminal id. (OPTIONAL) -
:tip_amount
– A positive integer in cents representing tip amount. (OPTIONAL) -
:sales_tax
– Applicable for LEVEL2 or LEVEL3 Charge. A positive integer in cents representing sales tax. (REQUIRED for LEVEL2 0r LEVEL3) -
:purchase_order
– Applicable for Level2 or Level3 Charge. The value used by the customer to identify an order. Issued by the buyer to the seller. (REQUIRED for LEVEL2 0r LEVEL3) -
:order_date
– Applicable for Level2 Charge for AMEX card only or Level3 Charge. The date the order was processed. Format: Alphanumeric and Special Character |Min Length=0 Max Length=10|Allowed format: MM/DD/YYYY For example: 12/01/2016 -
:customer_ref_id
– Applicable for Level2 Charge for AMEX card only or Level3 Charge. The reference identifier supplied by the Commercial Card cardholder. Format: Alphanumeric and Special Character |Min Length=0 Max Length=17| a-z A-Z 0-9 Space <> -
:ship_to_zip
– Applicable for Level2 Charge for AMEX card only or Level3 Charge. The postal code for the address to which the goods are being shipped. Format: Alphanumeric |Min Length=2 Max Length=10 -
:amex_descriptor
– Applicable for Level2 Charge for AMEX card only. The value of the Transaction Advice Addendum field, displays descriptive information about a transactions on a customer’s AMEX card statement. Format: Alphanumeric and Special Character |Min Length=0 Max Length=40|a-z A-Z 0-9 Space <> -
:supplier_reference_number
– Applicable for Level2 Charge for AMEX card only or Level3 charge. The value used by the customer to identify an order. Issued by the buyer to the seller. -
:tax_amount
– Applicable for Level3 Charge. The tax amount. Format: Numeric|Max Length=12|Allowed characters: 0-9 .(dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value. -
:tax_category
– Applicable for Level3 Charge. The type of tax. Formerly established through TaxCategory messages. Allowed values: SERVICE, DUTY, VAT, ALTERNATE, NATIONAL, TAX_EXEMPT -
:customer_vat_number
– Applicable for Level3 Charge. Indicates the customer’s government assigned tax identification number or the identification number assigned to their purchasing company by the tax authorities. Format: Alphanumeric and Special Character|Min Length=0 Max Length=13| a-z A-Z 0-9 Space <> -
:summary_commodity_code
– Applicable for Level3 Charge. The international description code of the overall goods or services being supplied. Format: Alphanumeric and Special Character |Min Length=0 Max Length=4|Allowed character: a-z A-Z 0-9 Space <> -
:shipping_charges
– Applicable for Level3 Charge. The dollar amount for shipping or freight charges applied to a product or transaction. Format: Numeric |Max Length=12|Allowed characters: 0-9 .(dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value. -
:duty_charges
– Applicable for Level3 Charge. Indicates the total charges for any import or export duties included in the order. Format: Numeric |Max Length=12|Allowed characters: 0-9 . (dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value. -
:ship_from_zip
– Applicable for Level3 Charge. The postal code for the address to which the goods are being shipped. Format: Alphanumeric |Min Length=2 Max Length=10 -
:destination_country_code
– Applicable for Level3 Charge. The destination country code indicator. Format: Alphanumeric. -
:tax_type
– Applicable for Level3 Charge. The type of tax. For example, VAT, NATIONAL, Service Tax. Format: Alphanumeric and Special Character -
:vat_invoice
– Applicable for Level3 Charge. The Value Added Tax (VAT) invoice number associated with the transaction. Format: Alphanumeric and Special Character |Min Length=0 Max Length=15|Allowed character: a-z A-Z 0-9 Space <> -
:tax_rate
– Applicable for Level3 Charge. The type of tax rate. This field is used if taxCategory is not used. Default sale tax rate in percentage Must be between 0.1% - 22% ,Applicable only Level 2 AutoFill. Format: Decimal Number |Max Length=4|Allowed characters: 0-9 .(dot) Allowed range: 0.01 - 100 -
:email
– Customer’s email address.
150 151 152 153 154 155 156 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 150 def (money, creditcard, = {}) [:capture] = '0' MultiResponse.run do |r| r.process { token(creditcard, ) } r.process { charge(money, r., ) } end end |
#capture(money, tx_reference, options = {}) ⇒ Object
Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created / authorized a charge with the capture option set to false.
:money
A positive integer in cents representing how much to charge. The minimum amount is 50c USD.
:tx_reference
charge_id from previously created / authorized a charge
:options
Other information like address, card source etc can be passed in options
169 170 171 172 173 174 175 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 169 def capture(money, tx_reference, = {}) post = {} add_money(post, money, ) action = "#{STANDARD_ACTIONS[:capture][:end_point]}/#{tx_reference}/capture" post = filter_gateway_fields(post, , STANDARD_ACTIONS[:capture][:allowed_fields]) commit(action, post) end |
#credit(money, creditcard, options = {}) ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 213 def credit(money, creditcard, = {}) post = {} add_money(post, money, ) add_creditcard(post, creditcard, ) add_address(post, ) add_phone(post, ) post['receipt_email'] = [:email] if [:email] action = STANDARD_ACTIONS[:credit][:end_point] post = filter_gateway_fields(post, , STANDARD_ACTIONS[:credit][:allowed_fields]) commit(action, post) end |
#purchase(money, creditcard, options = {}) ⇒ Object
Purchase API through PAYARC.
:money
A positive integer in cents representing how much to charge. The minimum amount is 50c USD.
:creditcard
CreditCard
object with card details.
:options
Other information like address, card source etc can be passed in options
Options
-
:card_source
– Source of payment (REQUIRED) ( INTERNET, SWIPE, PHONE, MAIL, MANUAL ) -
:currency
– Three-letter ISO currency code, in lowercase (REQUIRED) -
:card_holder_name
–Name of the Card Holder (OPTIONAL) -
:address_line1
– Set in payment method’s billing address (OPTIONAL) -
:address_line2
– Set in payment method’s billing address (OPTIONAL) -
:state
– State (OPTIONAL) -
:country
– Country (OPTIONAL) -
:statement_description
– An arbitrary string to be displayed on your costomer’s credit card statement. This may be up to 22 characters. (OPTIONAL) -
:card_level
– Commercial card level - “LEVEL2” OR “LEVEL3” (OPTIONAL) -
:sales_tax
– A positive integer in cents representing sales tax. (OPTIONAL) -
:terminal_id
– Optional terminal id. (OPTIONAL) -
:tip_amount
– A positive integer in cents representing tip amount. (OPTIONAL) -
:sales_tax
– Applicable for LEVEL2 or LEVEL3 Charge. A positive integer in cents representing sales tax. (REQUIRED for LEVEL2 0r LEVEL3) -
:purchase_order
– Applicable for Level2 or Level3 Charge. The value used by the customer to identify an order. Issued by the buyer to the seller. (REQUIRED for LEVEL2 0r LEVEL3) -
:order_date
– Applicable for Level2 Charge for AMEX card only or Level3 Charge. The date the order was processed. Format: Alphanumeric and Special Character |Min Length=0 Max Length=10|Allowed format: MM/DD/YYYY For example: 12/01/2016 -
:customer_ref_id
– Applicable for Level2 Charge for AMEX card only or Level3 Charge. The reference identifier supplied by the Commercial Card cardholder. Format: Alphanumeric and Special Character |Min Length=0 Max Length=17| a-z A-Z 0-9 Space <> -
:ship_to_zip
– Applicable for Level2 Charge for AMEX card only or Level3 Charge. The postal code for the address to which the goods are being shipped. Format: Alphanumeric |Min Length=2 Max Length=10 -
:amex_descriptor
– Applicable for Level2 Charge for AMEX card only. The value of the Transaction Advice Addendum field, displays descriptive information about a transactions on a customer’s AMEX card statement. Format: Alphanumeric and Special Character |Min Length=0 Max Length=40|a-z A-Z 0-9 Space <> -
:supplier_reference_number
– Applicable for Level2 Charge for AMEX card only or Level3 charge. The value used by the customer to identify an order. Issued by the buyer to the seller. -
:tax_amount
– Applicable for Level3 Charge. The tax amount. Format: Numeric|Max Length=12|Allowed characters: 0-9 .(dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value. -
:tax_category
– Applicable for Level3 Charge. The type of tax. Formerly established through TaxCategory messages. Allowed values: SERVICE, DUTY, VAT, ALTERNATE, NATIONAL, TAX_EXEMPT -
:customer_vat_number
– Applicable for Level3 Charge. Indicates the customer’s government assigned tax identification number or the identification number assigned to their purchasing company by the tax authorities. Format: Alphanumeric and Special Character|Min Length=0 Max Length=13| a-z A-Z 0-9 Space <> -
:summary_commodity_code
– Applicable for Level3 Charge. The international description code of the overall goods or services being supplied. Format: Alphanumeric and Special Character |Min Length=0 Max Length=4|Allowed character: a-z A-Z 0-9 Space <> -
:shipping_charges
– Applicable for Level3 Charge. The dollar amount for shipping or freight charges applied to a product or transaction. Format: Numeric |Max Length=12|Allowed characters: 0-9 .(dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value. -
:duty_charges
– Applicable for Level3 Charge. Indicates the total charges for any import or export duties included in the order. Format: Numeric |Max Length=12|Allowed characters: 0-9 . (dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value. -
:ship_from_zip
– Applicable for Level3 Charge. The postal code for the address to which the goods are being shipped. Format: Alphanumeric |Min Length=2 Max Length=10 -
:destination_country_code
– Applicable for Level3 Charge. The destination country code indicator. Format: Alphanumeric. -
:tax_type
– Applicable for Level3 Charge. The type of tax. For example, VAT, NATIONAL, Service Tax. Format: Alphanumeric and Special Character -
:vat_invoice
– Applicable for Level3 Charge. The Value Added Tax (VAT) invoice number associated with the transaction. Format: Alphanumeric and Special Character |Min Length=0 Max Length=15|Allowed character: a-z A-Z 0-9 Space <> -
:tax_rate
– Applicable for Level3 Charge. The type of tax rate. This field is used if taxCategory is not used. Default sale tax rate in percentage Must be between 0.1% - 22% ,Applicable only Level 2 AutoFill. Format: Decimal Number |Max Length=4|Allowed characters: 0-9 .(dot) Allowed range: 0.01 - 100 -
:email
– Customer’s email address sent with payment method.
99 100 101 102 103 104 105 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 99 def purchase(money, creditcard, = {}) [:capture] = 1 MultiResponse.run do |r| r.process { token(creditcard, ) } r.process { charge(money, r., ) } end end |
#refund(money, tx_reference, options = {}) ⇒ Object
Refund full / partial payment of an successful charge / capture / purchase.
:money
A positive integer in cents representing how much to charge. The minimum amount is 50c USD.
:tx_reference
charge_id from previously created / authorized a charge
:options
Other information like address, card source etc can be passed in options
205 206 207 208 209 210 211 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 205 def refund(money, tx_reference, = {}) post = {} add_money(post, money, ) action = STANDARD_ACTIONS[:refund][:end_point].gsub(/{{charge_id}}/, tx_reference) post = filter_gateway_fields(post, , STANDARD_ACTIONS[:refund][:allowed_fields]) commit(action, post) end |
#scrub(transcript) ⇒ Object
260 261 262 263 264 265 266 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 260 def scrub(transcript) #:nodoc: transcript. gsub(%r((Authorization: Bearer )[^\s]+\s)i, '\1[FILTERED]\2'). gsub(%r((&?card_number=)[^&]*)i, '\1[FILTERED]'). gsub(%r((&?cvv=)[^&]*)i, '\1[BLANK]') end |
#supports_scrubbing? ⇒ Boolean
:nodoc:
256 257 258 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 256 def supports_scrubbing? #:nodoc: true end |
#token(creditcard, options = {}) ⇒ Object
:nodoc:
246 247 248 249 250 251 252 253 254 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 246 def token(creditcard, = {}) post = {} post['authorize_card'] = 1 post['card_source'] = [:card_source] add_creditcard(post, creditcard, ) add_address(post, ) post = filter_gateway_fields(post, , STANDARD_ACTIONS[:token][:allowed_fields]) commit(STANDARD_ACTIONS[:token][:end_point], post) end |
#verify(creditcard, options = {}) ⇒ Object
Verify the creditcard API through PAYARC.
:creditcard
CreditCard
object with card details.
:options
Other information like address, card source etc can be passed in options
Options
-
:card_source
– Source of payment (REQUIRED) ( INTERNET, SWIPE, PHONE, MAIL, MANUAL ) -
:card_holder_name
–Name of the Card Holder (OPTIONAL) -
:address_line1
– Set in payment method’s billing address (OPTIONAL) -
:address_line2
– Set in payment method’s billing address (OPTIONAL) -
:state
– State (OPTIONAL) -
:country
– Country (OPTIONAL)
241 242 243 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 241 def verify(creditcard, = {}) token(creditcard, ) end |
#void(tx_reference, options = {}) ⇒ Object
Voids the transaction / charge.
:tx_reference
charge_id from previously created charge
:options
Other information like address, card source etc can be passed in options
Options
-
:reason
– Reason for voiding transaction (REQUIRED) ( requested_by_customer, duplicate, fraudulent, other )
188 189 190 191 192 193 194 |
# File 'lib/active_merchant/billing/gateways/pay_arc.rb', line 188 def void(tx_reference, = {}) post = {} post['reason'] = [:reason] action = STANDARD_ACTIONS[:void][:end_point].gsub(/{{chargeID}}/, tx_reference) post = filter_gateway_fields(post, , STANDARD_ACTIONS[:void][:allowed_fields]) commit(action, post) end |