Class: ActiveMerchant::Billing::FortisGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/fortis.rb

Constant Summary collapse

STATUS_MAPPING =
{
  101 => 'Sale cc Approved',
  102 => 'Sale cc AuthOnly',
  111 => 'Refund cc Refunded',
  121 => 'Credit/Debit/Refund cc AvsOnly',
  131 => 'Credit/Debit/Refund ach Pending Origination',
  132 => 'Credit/Debit/Refund ach Originating',
  133 => 'Credit/Debit/Refund ach Originated',
  134 => 'Credit/Debit/Refund ach Settled',
  191 => 'Settled (deprecated - batches are now settled on the /v2/transactionbatches endpoint)',
  201 => 'All cc/ach Voided',
  301 => 'All cc/ach Declined',
  331 => 'Credit/Debit/Refund ach Charged Back'
}
REASON_MAPPING =
{
  0 => 'N/A',
  1000 => 'CC - Approved / ACH - Accepted',
  1001 => 'AuthCompleted',
  1002 => 'Forced',
  1003 => 'AuthOnly Declined',
  1004 => 'Validation Failure (System Run Trx)',
  1005 => 'Processor Response Invalid',
  1200 => 'Voided',
  1201 => 'Partial Approval',
  1240 => 'Approved, optional fields are missing (Paya ACH only)',
  1301 => 'Account Deactivated for Fraud',
  1500 => 'Generic Decline',
  1510 => 'Call',
  1518 => 'Transaction Not Permitted - Terminal',
  1520 => 'Pickup Card',
  1530 => 'Retry Trx',
  1531 => 'Communication Error',
  1540 => 'Setup Issue, contact Support',
  1541 => 'Device is not signature capable',
  1588 => 'Data could not be de-tokenized',
  1599 => 'Other Reason',
  1601 => 'Generic Decline',
  1602 => 'Call',
  1603 => 'No Reply',
  1604 => 'Pickup Card - No Fraud',
  1605 => 'Pickup Card - Fraud',
  1606 => 'Pickup Card - Lost',
  1607 => 'Pickup Card - Stolen',
  1608 => 'Account Error',
  1609 => 'Already Reversed',
  1610 => 'Bad PIN',
  1611 => 'Cashback Exceeded',
  1612 => 'Cashback Not Available',
  1613 => 'CID Error',
  1614 => 'Date Error',
  1615 => 'Do Not Honor',
  1616 => 'NSF',
  1618 => 'Invalid Service Code',
  1619 => 'Exceeded activity limit',
  1620 => 'Violation',
  1621 => 'Encryption Error',
  1622 => 'Card Expired',
  1623 => 'Renter',
  1624 => 'Security Violation',
  1625 => 'Card Not Permitted',
  1626 => 'Trans Not Permitted',
  1627 => 'System Error',
  1628 => 'Bad Merchant ID',
  1629 => 'Duplicate Batch (Already Closed)',
  1630 => 'Batch Rejected',
  1631 => 'Account Closed',
  1632 => 'PIN tries exceeded',
  1640 => 'Required fields are missing (ACH only)',
  1641 => 'Previously declined transaction (1640)',
  1650 => 'Contact Support',
  1651 => 'Max Sending - Throttle Limit Hit (ACH only)',
  1652 => 'Max Attempts Exceeded',
  1653 => 'Contact Support',
  1654 => 'Voided - Online Reversal Failed',
  1655 => 'Decline (AVS Auto Reversal)',
  1656 => 'Decline (CVV Auto Reversal)',
  1657 => 'Decline (Partial Auth Auto Reversal)',
  1658 => 'Expired Authorization',
  1659 => 'Declined - Partial Approval not Supported',
  1660 => 'Bank Account Error, please delete and re-add Token',
  1661 => 'Declined AuthIncrement',
  1662 => 'Auto Reversal - Processor cant settle',
  1663 => 'Manager Needed (Needs override transaction)',
  1664 => 'Token Not Found: Sharing Group Unavailable',
  1665 => 'Contact Not Found: Sharing Group Unavailable',
  1666 => 'Amount Error',
  1667 => 'Action Not Allowed in Current State',
  1668 => 'Original Authorization Not Valid',
  1701 => 'Chip Reject',
  1800 => 'Incorrect CVV',
  1801 => 'Duplicate Transaction',
  1802 => 'MID/TID Not Registered',
  1803 => 'Stop Recurring',
  1804 => 'No Transactions in Batch',
  1805 => 'Batch Does Not Exist'
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

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

#expdate, #format, #strftime_yyyymm

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ FortisGateway

Returns a new instance of FortisGateway.



112
113
114
115
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 112

def initialize(options = {})
  requires!(options, :user_id, :user_api_key, :developer_id)
  super
end

Instance Method Details

#authorize(money, payment, options = {}) ⇒ Object



117
118
119
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 117

def authorize(money, payment, options = {})
  commit path(:authorize, payment_type(payment)), auth_purchase_request(money, payment, options)
end

#capture(money, authorization, options = {}) ⇒ Object



125
126
127
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 125

def capture(money, authorization, options = {})
  commit path(:capture, authorization), { transaction_amount: money }, :patch
end

#credit(money, payment, options = {}) ⇒ Object



137
138
139
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 137

def credit(money, payment, options = {})
  commit path(:credit), auth_purchase_request(money, payment, options)
end

#purchase(money, payment, options = {}) ⇒ Object



121
122
123
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 121

def purchase(money, payment, options = {})
  commit path(:purchase, payment_type(payment)), auth_purchase_request(money, payment, options)
end

#refund(money, authorization, options = {}) ⇒ Object



133
134
135
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 133

def refund(money, authorization, options = {})
  commit path(:refund, authorization), { transaction_amount: money }, :patch
end

#scrub(transcript) ⇒ Object



164
165
166
167
168
169
170
171
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 164

def scrub(transcript)
  transcript.
    gsub(/(\\?"account_number\\?":\\?")\d+/, '\1[FILTERED]').
    gsub(/(\\?"cvv\\?":\\?")\d+/, '\1[FILTERED]').
    gsub(%r((user-id: )[\w =]+), '\1[FILTERED]').
    gsub(%r((user-api-key: )[\w =]+), '\1[FILTERED]').
    gsub(%r((developer-id: )[\w =]+), '\1[FILTERED]')
end

#store(payment, options = {}) ⇒ Object



141
142
143
144
145
146
147
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 141

def store(payment, options = {})
  post = {}
  add_payment(post, payment, include_cvv: false)
  add_address(post, payment, options)

  commit path(:store), post, :post, options
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


160
161
162
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 160

def supports_scrubbing?
  true
end

#unstore(authorization, options = {}) ⇒ Object



149
150
151
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 149

def unstore(authorization, options = {})
  commit path(:unstore, authorization), nil, :delete
end

#verify(credit_card, options = {}) ⇒ Object



153
154
155
156
157
158
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 153

def verify(credit_card, options = {})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, credit_card, options) }
    r.process(:ignore_result) { void(r.authorization, options) }
  end
end

#void(authorization, options = {}) ⇒ Object



129
130
131
# File 'lib/active_merchant/billing/gateways/fortis.rb', line 129

def void(authorization, options = {})
  commit path(:void, authorization), {}, :put
end