Class: ActiveMerchant::Billing::TransFirstGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::TransFirstGateway
show all
- 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
#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?
#format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of TransFirstGateway.
32
33
34
35
|
# File 'lib/active_merchant/billing/gateways/trans_first.rb', line 32
def initialize(options = {})
requires!(options, :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, options = {})
post = {}
add_amount(post, money)
add_payment(post, payment)
add_address(post, options)
add_invoice(post, options) if payment.credit_card?
add_pair(post, :RefID, options[: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, authorization, options={})
post = {}
transaction_id, payment_type = split_authorization(authorization)
add_amount(post, money)
add_pair(post, :TransID, transaction_id)
add_pair(post, :RefID, options[: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(authorization, options={})
post = {}
transaction_id, _ = split_authorization(authorization)
add_pair(post, :TransID, transaction_id)
commit(:void, post)
end
|