Class: ActiveMerchant::Billing::VindiciaGateway
- Defined in:
- lib/active_merchant/billing/gateways/vindicia.rb
Overview
For more information on the Vindicia Gateway please visit their website
The login and password are not the username and password you use to login to the Vindicia Merchant Portal.
Recurring Billing
AutoBills are an feature of Vindicia’s API that allows for creating and managing subscriptions.
For more information about Vindicia’s API and various other services visit their Resource Center
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(money, creditcard, options = {}) ⇒ Object
Performs an authorization, which reserves the funds on the customer’s credit card, but does not charge the card.
-
#capture(money, identification, options = {}) ⇒ Object
Captures the funds from an authorized transaction.
-
#initialize(options = {}) ⇒ VindiciaGateway
constructor
Creates a new VindiciaGateway.
-
#purchase(money, creditcard, options = {}) ⇒ Object
Perform a purchase, which is essentially an authorization and capture in a single operation.
-
#recurring(money, creditcard, options = {}) ⇒ Object
Perform a recurring billing, which is essentially a purchase and autobill setup in a single operation.
-
#void(identification, options = {}) ⇒ Object
Void a previous transaction.
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 = {}) ⇒ VindiciaGateway
Creates a new VindiciaGateway
The gateway requires that a valid login and password be passed in the options
hash.
Options
-
:login
– Vindicia SOAP login (REQUIRED) -
:password
– Vindicia SOAP password (REQUIRED) -
:api_version
– Vindicia API Version - defaults to 3.6 (OPTIONAL) -
:account_id
– Account Id which all transactions will be run against. (REQUIRED) -
:transaction_prefix
– Prefix to order id for one-time transactions - defaults to ‘X’ (OPTIONAL -
:min_chargeback_probability
– Minimum score for chargebacks - defaults to 65 (OPTIONAL) -
:cvn_success
– Array of valid CVN Check return values - defaults to [M, P] (OPTIONAL) -
:avs_success
– Array of valid AVS Check return values - defaults to [X, Y, A, W, Z] (OPTIONAL)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/active_merchant/billing/gateways/vindicia.rb', line 42 def initialize( = {}) requires!(, :login, :password, :account_id) super @account_id = [:account_id] @transaction_prefix = [:transaction_prefix] || "X" @min_chargeback_probability = [:min_chargeback_probability] || 65 @cvn_success = [:cvn_success] || %w{M P} @avs_success = [:avs_success] || %w{X Y A W Z} @allowed_authorization_statuses = %w{Authorized} end |
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
Performs an authorization, which reserves the funds on the customer’s credit card, but does not charge the card.
Parameters
-
money
– The amount to be authorized as an Integer value in cents. -
creditcard
– The CreditCard details for the transaction. -
options
– A hash of optional parameters.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/active_merchant/billing/gateways/vindicia.rb', line 79 def (money, creditcard, = {}) vindicia_transaction = (money, creditcard, ) response = check_transaction(vindicia_transaction) # if this response is under fraud review because of our AVS/CVV checks void the transaction if !response.success? && response.fraud_review? && !response..blank? void_response = void([vindicia_transaction[:transaction][:merchantTransactionId]], ) if void_response.success? return response else return void_response end end response end |
#capture(money, identification, options = {}) ⇒ Object
Captures the funds from an authorized transaction.
Parameters
-
money
– The amount to be captured as an Integer value in cents. -
identification
– The authorization returned from the previous authorize request.
102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/active_merchant/billing/gateways/vindicia.rb', line 102 def capture(money, identification, = {}) response = post(:capture) do |xml| add_hash(xml, transactions: [{ merchantTransactionId: identification }]) end if response[:return][:returnCode] != '200' || response[:qtyFail].to_i > 0 return fail(response) end success(response, identification) end |
#purchase(money, creditcard, options = {}) ⇒ Object
Perform a purchase, which is essentially an authorization and capture in a single operation.
Parameters
-
money
– The amount to be purchased as an Integer value in cents. -
creditcard
– The CreditCard details for the transaction. -
options
– A hash of optional parameters.
64 65 66 67 68 69 |
# File 'lib/active_merchant/billing/gateways/vindicia.rb', line 64 def purchase(money, creditcard, = {}) response = (money, creditcard, ) return response if !response.success? || response.fraud_review? capture(money, response., ) end |
#recurring(money, creditcard, options = {}) ⇒ Object
Perform a recurring billing, which is essentially a purchase and autobill setup in a single operation.
Parameters
-
money
– The amount to be purchased as an Integer value in cents. -
creditcard
– The CreditCard details for the transaction. -
options
– A hash of parameters.
Options
-
:product_sku
– The subscription product’s sku -
:autobill_prefix
– Prefix to order id for subscriptions - defaults to ‘A’ (OPTIONAL)
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/active_merchant/billing/gateways/vindicia.rb', line 148 def recurring(money, creditcard, ={}) ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE [:recurring] = true @autobill_prefix = [:autobill_prefix] || "A" response = (money, creditcard, ) return response if !response.success? || response.fraud_review? capture_resp = capture(money, response., ) return capture_resp if !response.success? # Setting up a recurring AutoBill requires an associated product requires!(, :product_sku) autobill_response = check_subscription((.merge(:product_sku => [:product_sku]))) if autobill_response.success? autobill_response else # If the AutoBill fails to set-up, void the transaction and return it as the response void_response = void(capture_resp., ) if void_response.success? return autobill_response else return void_response end end end |
#void(identification, options = {}) ⇒ Object
Void a previous transaction
Parameters
-
identification
- The authorization returned from the previous authorize request. -
options
- Extra options (currently only :ip used)
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/active_merchant/billing/gateways/vindicia.rb', line 120 def void(identification, = {}) response = post(:cancel) do |xml| add_hash(xml, transactions: [{ account: {merchantAccountId: @account_id}, merchantTransactionId: identification, sourceIp: [:ip] }]) end if response[:return][:returnCode] == '200' && response[:qtyFail].to_i == 0 success(response, identification) else fail(response) end end |