Class: Lightrail::Account
Class Method Summary
collapse
#initialize
Class Method Details
.charge(charge_params) ⇒ Object
40
41
42
43
|
# File 'lib/lightrail_client/account.rb', line 40
def self.charge(charge_params)
params_with_account_card_id = self.replace_contact_id_or_shopper_id_with_card_id(charge_params)
Lightrail::Card.charge(params_with_account_card_id)
end
|
.create(account_params) ⇒ Object
.fund(fund_params) ⇒ Object
50
51
52
53
|
# File 'lib/lightrail_client/account.rb', line 50
def self.fund(fund_params)
params_with_account_card_id = self.replace_contact_id_or_shopper_id_with_card_id(fund_params)
Lightrail::Card.fund(params_with_account_card_id)
end
|
.get_account_details(account_details_params) ⇒ Object
55
56
57
58
|
# File 'lib/lightrail_client/account.rb', line 55
def self.get_account_details(account_details_params)
params_with_account_card_id = self.replace_contact_id_or_shopper_id_with_card_id(account_details_params)
Lightrail::Card.get_details(params_with_account_card_id[:card_id])
end
|
.get_maximum_account_value(max_account_value_params) ⇒ Object
60
61
62
63
|
# File 'lib/lightrail_client/account.rb', line 60
def self.get_maximum_account_value(max_account_value_params)
params_with_account_card_id = self.replace_contact_id_or_shopper_id_with_card_id(max_account_value_params)
Lightrail::Card.get_maximum_value(params_with_account_card_id[:card_id])
end
|
.retrieve(account_retrieval_params) ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'lib/lightrail_client/account.rb', line 30
def self.retrieve(account_retrieval_params)
new_params = account_retrieval_params.clone
currency = new_params[:currency] || new_params['currency']
Lightrail::Validator.validate_currency!(currency)
Lightrail::Validator.set_contactId_from_contact_or_shopper_id!(new_params, new_params)
contact_id = new_params[:contactId]
response = Lightrail::Connection.send :make_get_request_and_parse_response, "cards?cardType=ACCOUNT_CARD&contactId=#{CGI::escape(contact_id)}¤cy=#{CGI::escape(currency)}"
response['cards'][0]
end
|
.simulate_charge(charge_params) ⇒ Object
45
46
47
48
|
# File 'lib/lightrail_client/account.rb', line 45
def self.simulate_charge(charge_params)
params_with_account_card_id = self.replace_contact_id_or_shopper_id_with_card_id(charge_params)
Lightrail::Card.simulate_charge(params_with_account_card_id)
end
|