Class: TresDelta::Gateway
Class Method Summary
collapse
-
.authorize(transaction_key, credit_card, amount, order_number, customer) ⇒ Object
-
.authorize_params(transaction_key, credit_card, amount, order_number, customer) ⇒ Object
-
.billing_address_params(billing_address) ⇒ Object
-
.capture(transaction_key, customer_code, card_token, amount) ⇒ Object
-
.capture_params(transaction_key, customer_code, card_token, amount) ⇒ Object
-
.card_verification(transaction_key, credit_card) ⇒ Object
-
.card_verification_params(transaction_key, credit_card) ⇒ Object
-
.credit_card_params(credit_card) ⇒ Object
-
.savon_overrides ⇒ Object
-
.terminal_identifier ⇒ Object
-
.wsdl ⇒ Object
Methods inherited from Client
client, client_credentials, config, default_savon_options, location_identifier, request, savon_options
Class Method Details
.authorize(transaction_key, credit_card, amount, order_number, customer) ⇒ Object
9
10
11
|
# File 'lib/tres_delta/gateway.rb', line 9
def authorize(transaction_key, credit_card, amount, order_number, customer)
request :authorize, authorize_params(transaction_key, credit_card, amount, order_number, customer)
end
|
.authorize_params(transaction_key, credit_card, amount, order_number, customer) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/tres_delta/gateway.rb', line 13
def authorize_params(transaction_key, credit_card, amount, order_number, customer)
{
'clientCredentials' => client_credentials,
'authorizeParams' => {
'AddOrUpdateCard' => 'true',
'CreditCardTransaction' => {
'CreditCard' => credit_card_params(credit_card),
'CurrencyCode' => 'USDollars',
'StoredCardIdentifier' => {
'CustomerCode' => customer.vault_key
},
'TotalAmount' => amount,
'TransactionKey' => transaction_key
},
'TerminalIdentifier' => terminal_identifier
}
}
end
|
.billing_address_params(billing_address) ⇒ Object
82
83
84
85
86
87
|
# File 'lib/tres_delta/gateway.rb', line 82
def billing_address_params(billing_address)
{
'cc:AddressLine1' => billing_address.address,
'cc:PostalCode' => billing_address.zip_code
}
end
|
.capture(transaction_key, customer_code, card_token, amount) ⇒ Object
32
33
34
|
# File 'lib/tres_delta/gateway.rb', line 32
def capture(transaction_key, customer_code, card_token, amount)
request :capture, capture_params(transaction_key, customer_code, card_token, amount)
end
|
.capture_params(transaction_key, customer_code, card_token, amount) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/tres_delta/gateway.rb', line 36
def capture_params(transaction_key, customer_code, card_token, amount)
{
'clientCredentials' => client_credentials,
'captureParams' => {
'CreditCardTransaction' => {
'CurrencyCode' => 'USDollars',
'StoredCardIdentifier' => {
'CustomerCode' => customer_code,
'Token' => card_token
},
'TotalAmount' => amount,
'TransactionKey' => transaction_key
},
'TerminalIdentifier' => terminal_identifier
}
}
end
|
.card_verification(transaction_key, credit_card) ⇒ Object
54
55
56
|
# File 'lib/tres_delta/gateway.rb', line 54
def card_verification(transaction_key, credit_card)
request(:card_verification, card_verification_params(transaction_key, credit_card))
end
|
.card_verification_params(transaction_key, credit_card) ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/tres_delta/gateway.rb', line 58
def card_verification_params(transaction_key, credit_card)
{
'clientCredentials' => client_credentials,
'cardVerificationParams' => {
'AddOrUpdateCard' => 'false',
'CreditCard' => credit_card_params(credit_card),
'TerminalIdentifier' => terminal_identifier,
'TransactionKey' => transaction_key
}
}
end
|
.credit_card_params(credit_card) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/tres_delta/gateway.rb', line 70
def credit_card_params(credit_card)
{
'cc:BillingAddress' => billing_address_params(credit_card.billing_address),
'cc:CardAccountNumber' => credit_card.number,
'cc:ExpirationMonth' => credit_card.expiration_month,
'cc:ExpirationYear' => credit_card.expiration_year,
'cc:NameOnCard' => credit_card.name,
'CardSecurityCode' => credit_card.security_code,
'CardSecurityCodeIndicator' => credit_card.has_security_code? ? 'Provided' : 'None'
}
end
|
.savon_overrides ⇒ Object
97
98
99
100
101
102
103
|
# File 'lib/tres_delta/gateway.rb', line 97
def savon_overrides
{
namespaces: {
'xmlns:cc' => 'http://schemas.datacontract.org/2004/07/ThreeDelta.Web.Services.ECLinx.Definitions'
}
}
end
|
.terminal_identifier ⇒ Object
89
90
91
92
93
94
95
|
# File 'lib/tres_delta/gateway.rb', line 89
def terminal_identifier
{
'LocationCode' => config['location_code'],
'MerchantCode' => config['merchant_code'],
'TerminalCode' => config['terminal_code']
}
end
|
.wsdl ⇒ Object
5
6
7
|
# File 'lib/tres_delta/gateway.rb', line 5
def wsdl
Config.config['transaction_wsdl']
end
|