Class: ActiveMerchant::Billing::TransFirstGateway
- Defined in:
- lib/active_merchant/billing/gateways/trans_first.rb
Constant Summary collapse
- UNUSED_CREDIT_CARD_FIELDS =
%w(UserId TrackData MerchZIP MerchCustPNum MCC InstallmentNum InstallmentOf POSInd POSEntryMode POSConditionCode EComInd AuthCharInd CardCertData CAVVData)
- DECLINED =
'The transaction was declined'- ACTIONS =
{ purchase: 'CCSale', purchase_echeck: 'ACHDebit', refund: 'CreditCardCredit', refund_echeck: 'ACHVoidTransaction', void: 'CreditCardAutoRefundorVoid' }
- ENDPOINTS =
{ purchase: 'creditcard.asmx', purchase_echeck: 'checkverifyws/checkverifyws.asmx', refund: 'creditcard.asmx', refund_echeck: 'checkverifyws/checkverifyws.asmx', void: 'creditcard.asmx' }
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
-
#initialize(options = {}) ⇒ TransFirstGateway
constructor
A new instance of TransFirstGateway.
- #purchase(money, payment, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #scrub(transcript) ⇒ Object
- #supports_scrubbing? ⇒ Boolean
- #void(authorization, options = {}) ⇒ Object
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 Versionable
Methods included from CreditCardFormatting
#format, #strftime_yyyymm, #strftime_yyyymmdd_last_day
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ TransFirstGateway
Returns a new instance of TransFirstGateway.
32 33 34 35 |
# File 'lib/active_merchant/billing/gateways/trans_first.rb', line 32 def initialize( = {}) requires!(, :login, :password) super end |
Instance Method Details
#purchase(money, payment, options = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/active_merchant/billing/gateways/trans_first.rb', line 37 def purchase(money, payment, = {}) post = {} add_amount(post, money) add_payment(post, payment) add_address(post, ) add_invoice(post, ) if payment.credit_card? add_pair(post, :RefID, [:order_id], required: true) commit((payment.is_a?(Check) ? :purchase_echeck : :purchase), post) end |
#refund(money, authorization, options = {}) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/active_merchant/billing/gateways/trans_first.rb', line 49 def refund(money, , = {}) post = {} transaction_id, payment_type = () add_amount(post, money) add_pair(post, :TransID, transaction_id) add_pair(post, :RefID, [:order_id], required: true) commit((payment_type == 'check' ? :refund_echeck : :refund), post) end |
#scrub(transcript) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/active_merchant/billing/gateways/trans_first.rb', line 73 def scrub(transcript) transcript. gsub(%r((&?RegKey=)\w*(&?)), '\1[FILTERED]\2'). gsub(%r((&?CardNumber=)\d*(&?)), '\1[FILTERED]\2'). gsub(%r((&?CVV2=)\d*(&?)), '\1[FILTERED]\2'). gsub(%r((&?TransRoute=)\d*(&?)), '\1[FILTERED]\2'). gsub(%r((&?BankAccountNo=)\d*(&?)), '\1[FILTERED]\2') end |
#supports_scrubbing? ⇒ Boolean
69 70 71 |
# File 'lib/active_merchant/billing/gateways/trans_first.rb', line 69 def supports_scrubbing? true end |
#void(authorization, options = {}) ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/active_merchant/billing/gateways/trans_first.rb', line 60 def void(, = {}) post = {} transaction_id, = () add_pair(post, :TransID, transaction_id) commit(:void, post) end |