Class: CheckoutSdk::Accounts::AccountsClient

Inherits:
Client
  • Object
show all
Defined in:
lib/checkout_sdk/accounts/accounts_client.rb

Instance Attribute Summary collapse

Attributes inherited from Client

#api_client, #authorization_type, #configuration

Instance Method Summary collapse

Constructor Details

#initialize(api_client, files_client, configuration) ⇒ AccountsClient

Returns a new instance of AccountsClient.

Parameters:



19
20
21
22
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 19

def initialize(api_client, files_client, configuration)
  super(api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY_OR_OAUTH)
  @files_client = files_client
end

Instance Attribute Details

#files_clientObject (readonly)

Returns the value of attribute files_client.



6
7
8
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 6

def files_client
  @files_client
end

Instance Method Details

#add_payment_instrument(entity_id, payment_instrument) ⇒ Object

Parameters:



50
51
52
53
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 50

def add_payment_instrument(entity_id, payment_instrument)
  api_client.invoke_post(build_path(ACCOUNTS, ENTITIES, entity_id, PAYMENT_INSTRUMENTS), sdk_authorization,
                         payment_instrument)
end

#create_entity(entity_request) ⇒ Object

Parameters:



25
26
27
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 25

def create_entity(entity_request)
  api_client.invoke_post(build_path(ACCOUNTS, ENTITIES), sdk_authorization, entity_request)
end

#create_payment_instrument(entity_id, payment_instrument) ⇒ Object

Deprecated.

Please use #add_payment_instrument instead

Parameters:



43
44
45
46
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 43

def create_payment_instrument(entity_id, payment_instrument)
  api_client.invoke_post(build_path(ACCOUNTS, ENTITIES, entity_id, INSTRUMENT), sdk_authorization,
                         payment_instrument)
end

#get_entity(entity_id) ⇒ Object

Parameters:

  • entity_id (String)


30
31
32
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 30

def get_entity(entity_id)
  api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id), sdk_authorization)
end

#query_payment_instruments(entity_id, payment_instruments_query = nil) ⇒ Object

Parameters:



57
58
59
60
61
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 57

def query_payment_instruments(entity_id, payment_instruments_query = nil)
  api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id, PAYMENT_INSTRUMENTS),
                        sdk_authorization,
                        payment_instruments_query)
end

#retrieve_payment_instrument_details(entity_id, payment_instrument_id) ⇒ Object

Parameters:

  • entity_id (String)
  • payment_instrument_id (String)


65
66
67
68
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 65

def retrieve_payment_instrument_details(entity_id, payment_instrument_id)
  api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id, PAYMENT_INSTRUMENTS, payment_instrument_id),
                        sdk_authorization)
end

#retrieve_payout_schedule(entity_id) ⇒ Object

Parameters:

  • entity_id (String)


88
89
90
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 88

def retrieve_payout_schedule(entity_id)
  api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id, PAYOUT_SCHEDULE), sdk_authorization)
end

#update_entity(entity_id, entity_request) ⇒ Object

Parameters:



36
37
38
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 36

def update_entity(entity_id, entity_request)
  api_client.invoke_put(build_path(ACCOUNTS, ENTITIES, entity_id), sdk_authorization, entity_request)
end

#update_payment_instrument(entity_id, instrument_id, update_payment_instrument) ⇒ Object

Parameters:



73
74
75
76
77
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 73

def update_payment_instrument(entity_id, instrument_id, update_payment_instrument)
  api_client.invoke_patch(build_path(ACCOUNTS, ENTITIES, entity_id, PAYMENT_INSTRUMENTS, instrument_id),
                          sdk_authorization,
                          update_payment_instrument)
end

#update_payout_schedule(entity_id, currency, update_schedule) ⇒ Object

Parameters:



82
83
84
85
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 82

def update_payout_schedule(entity_id, currency, update_schedule)
  api_client.invoke_put(build_path(ACCOUNTS, ENTITIES, entity_id, PAYOUT_SCHEDULE), sdk_authorization,
                        { currency => update_schedule })
end

#upload_file(file_request) ⇒ Object

Parameters:



93
94
95
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 93

def upload_file(file_request)
  files_client.submit_file(FILES, sdk_authorization, file_request)
end