Class: ActiveMerchant::Billing::CardConnectGateway
- Defined in:
- lib/active_merchant/billing/gateways/card_connect.rb
Constant Summary collapse
- STANDARD_ERROR_CODE_MAPPING =
{ '11' => STANDARD_ERROR_CODE[:card_declined], '12' => STANDARD_ERROR_CODE[:incorrect_number], '13' => STANDARD_ERROR_CODE[:incorrect_cvc], '14' => STANDARD_ERROR_CODE[:incorrect_cvc], '15' => STANDARD_ERROR_CODE[:invalid_expiry_date], '16' => STANDARD_ERROR_CODE[:expired_card], '17' => STANDARD_ERROR_CODE[:incorrect_zip], '21' => STANDARD_ERROR_CODE[:config_error], '22' => STANDARD_ERROR_CODE[:config_error], '23' => STANDARD_ERROR_CODE[:config_error], '24' => STANDARD_ERROR_CODE[:processing_error], '25' => STANDARD_ERROR_CODE[:processing_error], '27' => STANDARD_ERROR_CODE[:processing_error], '28' => STANDARD_ERROR_CODE[:processing_error], '29' => STANDARD_ERROR_CODE[:processing_error], '31' => STANDARD_ERROR_CODE[:processing_error], '32' => STANDARD_ERROR_CODE[:processing_error], '33' => STANDARD_ERROR_CODE[:card_declined], '34' => STANDARD_ERROR_CODE[:card_declined], '35' => STANDARD_ERROR_CODE[:incorrect_zip], '36' => STANDARD_ERROR_CODE[:processing_error], '37' => STANDARD_ERROR_CODE[:incorrect_cvc], '41' => STANDARD_ERROR_CODE[:processing_error], '42' => STANDARD_ERROR_CODE[:processing_error], '43' => STANDARD_ERROR_CODE[:processing_error], '44' => STANDARD_ERROR_CODE[:config_error], '61' => STANDARD_ERROR_CODE[:processing_error], '62' => STANDARD_ERROR_CODE[:processing_error], '63' => STANDARD_ERROR_CODE[:processing_error], '64' => STANDARD_ERROR_CODE[:config_error], '65' => STANDARD_ERROR_CODE[:processing_error], '66' => STANDARD_ERROR_CODE[:processing_error], '91' => STANDARD_ERROR_CODE[:processing_error], '92' => STANDARD_ERROR_CODE[:processing_error], '93' => STANDARD_ERROR_CODE[:processing_error], '94' => STANDARD_ERROR_CODE[:processing_error], '95' => STANDARD_ERROR_CODE[:config_error], '96' => STANDARD_ERROR_CODE[:processing_error], 'NU' => STANDARD_ERROR_CODE[:card_declined], 'N3' => STANDARD_ERROR_CODE[:card_declined], 'NJ' => STANDARD_ERROR_CODE[:card_declined], '51' => STANDARD_ERROR_CODE[:card_declined], 'C2' => STANDARD_ERROR_CODE[:incorrect_cvc], '54' => STANDARD_ERROR_CODE[:expired_card], '05' => STANDARD_ERROR_CODE[:card_declined], '03' => STANDARD_ERROR_CODE[:config_error], '60' => STANDARD_ERROR_CODE[:pickup_card] }
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 = {}) ⇒ CardConnectGateway
constructor
A new instance of CardConnectGateway.
- #purchase(money, payment, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #require_valid_domain!(options, param) ⇒ Object
- #scrub(transcript) ⇒ Object
- #store(payment, options = {}) ⇒ Object
- #supports_scrubbing? ⇒ Boolean
- #unstore(authorization, options = {}) ⇒ Object
- #verify(credit_card, options = {}) ⇒ Object
- #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#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 = {}) ⇒ CardConnectGateway
Returns a new instance of CardConnectGateway.
64 65 66 67 68 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 64 def initialize( = {}) requires!(, :merchant_id, :username, :password) require_valid_domain!(, :domain) super end |
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 96 def (money, payment, = {}) post = {} add_money(post, money) add_currency(post, money, ) add_invoice(post, ) add_payment(post, payment) add_address(post, ) add_customer_data(post, ) add_3DS(post, ) commit('auth', post) end |
#capture(money, authorization, options = {}) ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 108 def capture(money, , = {}) post = {} add_money(post, money) add_reference(post, ) add_additional_data(post, ) commit('capture', post) end |
#purchase(money, payment, options = {}) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 76 def purchase(money, payment, = {}) if [:po_number] MultiResponse.run do |r| r.process { (money, payment, ) } r.process { capture(money, r., ) } end else post = {} add_invoice(post, ) add_money(post, money) add_payment(post, payment) add_currency(post, money, ) add_address(post, ) add_customer_data(post, ) add_3DS(post, ) post[:capture] = 'Y' commit('auth', post) end end |
#refund(money, authorization, options = {}) ⇒ Object
116 117 118 119 120 121 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 116 def refund(money, , = {}) post = {} add_money(post, money) add_reference(post, ) commit('refund', post) end |
#require_valid_domain!(options, param) ⇒ Object
70 71 72 73 74 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 70 def require_valid_domain!(, param) if .key?(param) raise ArgumentError.new('not a valid cardconnect domain') unless /\Dcardconnect.com:\d{1,}\D/ =~ [param] end end |
#scrub(transcript) ⇒ Object
152 153 154 155 156 157 158 159 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 152 def scrub(transcript) transcript. gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]'). gsub(%r(("cvv2\\":\\")\d*), '\1[FILTERED]'). gsub(%r(("merchid\\":\\")\d*), '\1[FILTERED]'). gsub(%r((&?"account\\":\\")\d*), '\1[FILTERED]'). gsub(%r((&?"token\\":\\")\d*), '\1[FILTERED]') end |
#store(payment, options = {}) ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 133 def store(payment, = {}) post = {} add_payment(post, payment) add_address(post, ) add_customer_data(post, ) commit('profile', post) end |
#supports_scrubbing? ⇒ Boolean
148 149 150 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 148 def supports_scrubbing? true end |
#unstore(authorization, options = {}) ⇒ Object
141 142 143 144 145 146 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 141 def unstore(, = {}) account_id, profile_id = .split('|') commit('profile', {}, verb: :delete, path: "/#{profile_id}/#{account_id}/#{@options[:merchant_id]}") end |
#verify(credit_card, options = {}) ⇒ Object
129 130 131 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 129 def verify(credit_card, = {}) (0, credit_card, ) end |
#void(authorization, options = {}) ⇒ Object
123 124 125 126 127 |
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 123 def void(, = {}) post = {} add_reference(post, ) commit('void', post) end |