Class: TresDelta::Vault
Class Method Summary
collapse
-
.add_stored_credit_card(customer, credit_card) ⇒ Object
-
.add_stored_credit_card_params(customer, credit_card) ⇒ Object
-
.create_customer(customer) ⇒ Object
-
.create_customer_params(customer) ⇒ Object
-
.customer_identifier(customer) ⇒ Object
-
.get_stored_credit_card(customer, token, include_card_number = false) ⇒ Object
-
.get_stored_credit_card_params(customer, token, include_card_number) ⇒ Object
-
.get_token_for_card_number(card_number, customer) ⇒ Object
-
.get_token_for_card_number_params(card_number, customer) ⇒ Object
-
.update_stored_credit_card(customer, credit_card) ⇒ Object
-
.update_stored_credit_card_params(customer, credit_card) ⇒ Object
-
.wsdl ⇒ Object
Methods inherited from Client
client, client_credentials, config, default_savon_options, location_identifier, request, savon_options, savon_overrides
Class Method Details
.add_stored_credit_card(customer, credit_card) ⇒ Object
26
27
28
|
# File 'lib/tres_delta/vault.rb', line 26
def add_stored_credit_card(customer, credit_card)
request(:add_stored_credit_card, add_stored_credit_card_params(customer, credit_card))
end
|
.add_stored_credit_card_params(customer, credit_card) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/tres_delta/vault.rb', line 30
def add_stored_credit_card_params(customer, credit_card)
{
'clientCredentials' => client_credentials,
'addStoredCardParams' => {
'CreditCard' => {
'CardAccountNumber' => credit_card.number,
'CardType' => credit_card.type,
'Cardholder' => {
'FirstName' => credit_card.name,
'LastName' => nil
},
'ExpirationMonth' => credit_card.expiration_month,
'ExpirationYear' => credit_card.expiration_year,
'NameOnCard' => credit_card.name,
'FriendlyName' => credit_card.nickname
},
'CustomerIdentifier' => customer_identifier(customer)
}
}
end
|
.create_customer(customer) ⇒ Object
9
10
11
|
# File 'lib/tres_delta/vault.rb', line 9
def create_customer(customer)
request(:create_customer, create_customer_params(customer))
end
|
.create_customer_params(customer) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/tres_delta/vault.rb', line 13
def create_customer_params(customer)
{
'clientCredentials' => client_credentials,
'createCustomerParams' => {
'Customer' => {
'Code' => customer.vault_key,
'Name' => customer.name
},
'LocationIdentifier' => location_identifier
}
}
end
|
.customer_identifier(customer) ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/tres_delta/vault.rb', line 51
def customer_identifier(customer)
{
'CustomerCode' => customer.vault_key,
'LocationCode' => config["location_code"],
'MerchantCode' => config["merchant_code"]
}
end
|
.get_stored_credit_card(customer, token, include_card_number = false) ⇒ Object
59
60
61
|
# File 'lib/tres_delta/vault.rb', line 59
def get_stored_credit_card(customer, token, include_card_number = false)
request(:get_stored_credit_card, get_stored_credit_card_params(customer, token, include_card_number))
end
|
.get_stored_credit_card_params(customer, token, include_card_number) ⇒ Object
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/tres_delta/vault.rb', line 63
def get_stored_credit_card_params(customer, token, include_card_number)
{
'clientCredentials' => client_credentials,
'getStoredCreditCardParams' => {
'CustomerIdentifier' => customer_identifier(customer),
'RetrieveCardNumber' => include_card_number ? 'true' : 'false',
'Token' => token
}
}
end
|
.get_token_for_card_number(card_number, customer) ⇒ Object
74
75
76
|
# File 'lib/tres_delta/vault.rb', line 74
def get_token_for_card_number(card_number, customer)
request(:get_token_for_card_number, get_token_for_card_number_params(card_number, customer))
end
|
.get_token_for_card_number_params(card_number, customer) ⇒ Object
78
79
80
81
82
83
84
85
86
|
# File 'lib/tres_delta/vault.rb', line 78
def get_token_for_card_number_params(card_number, customer)
{
'clientCredentials' => client_credentials,
'getTokenForCardNumberParams' => {
'AccountNumber' => card_number,
'CustomerIdentifier' => customer_identifier(customer)
}
}
end
|
.update_stored_credit_card(customer, credit_card) ⇒ Object
88
89
90
|
# File 'lib/tres_delta/vault.rb', line 88
def update_stored_credit_card(customer, credit_card)
request(:update_stored_credit_card, update_stored_credit_card_params(customer, credit_card))
end
|
.update_stored_credit_card_params(customer, credit_card) ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/tres_delta/vault.rb', line 92
def update_stored_credit_card_params(customer, credit_card)
{
'clientCredentials' => client_credentials,
'updateStoredCardParams' => {
'CreditCard' => {
'CardType' => credit_card.type,
'CardHolder' => {
'FirstName' => credit_card.name,
'Lastname' => nil
},
'ExpirationMonth' => credit_card.expiration_month,
'ExpirationYear' => credit_card.expiration_year,
'NameOnCard' => credit_card.name,
'FriendlyName' => credit_card.nickname,
'Token' => credit_card.token
},
'CustomerIdentifier' => customer_identifier(customer)
}
}
end
|
.wsdl ⇒ Object
5
6
7
|
# File 'lib/tres_delta/vault.rb', line 5
def wsdl
Config.config['management_wsdl']
end
|