Class: CheckoutSdk::Accounts::AccountsClient
- Defined in:
- lib/checkout_sdk/accounts/accounts_client.rb
Instance Attribute Summary collapse
-
#files_client ⇒ Object
readonly
Returns the value of attribute files_client.
Attributes inherited from Client
#api_client, #authorization_type, #configuration
Instance Method Summary collapse
- #add_payment_instrument(entity_id, payment_instrument) ⇒ Object
-
#add_reserve_rule(entity_id, reserve_rule_request) ⇒ Object
Add a reserve rule for a sub-entity.
- #create_entity(entity_request) ⇒ Object
-
#create_payment_instrument(entity_id, payment_instrument) ⇒ Object
deprecated
Deprecated.
Please use #add_payment_instrument instead
- #get_entity(entity_id) ⇒ Object
-
#get_entity_file(entity_id, file_id) ⇒ Object
Retrieve a file scoped to a sub-entity.
-
#get_entity_requirement_details(entity_id, requirement_id) ⇒ Object
Retrieve detailed information for a single requirement.
-
#get_entity_requirements(entity_id) ⇒ Object
Retrieve the list of pending requirements that a sub-entity must resolve.
-
#get_reserve_rule(entity_id, reserve_rule_id) ⇒ Object
Retrieve a reserve rule by id.
-
#get_sub_entity_members(entity_id) ⇒ Object
List sub-entity members.
-
#initialize(api_client, files_client, configuration) ⇒ AccountsClient
constructor
A new instance of AccountsClient.
- #query_payment_instruments(entity_id, payment_instruments_query = nil) ⇒ Object
-
#query_reserve_rules(entity_id) ⇒ Object
Query reserve rules for a sub-entity.
-
#reinvite_sub_entity_member(entity_id, user_id, reinvite_request) ⇒ Object
Reinvite a sub-entity member.
-
#resolve_entity_requirement(entity_id, requirement_id, update_request) ⇒ Object
Submit a response to resolve a requirement.
- #retrieve_payment_instrument_details(entity_id, payment_instrument_id) ⇒ Object
- #retrieve_payout_schedule(entity_id) ⇒ Object
- #update_entity(entity_id, entity_request) ⇒ Object
- #update_payment_instrument(entity_id, instrument_id, update_payment_instrument) ⇒ Object
- #update_payout_schedule(entity_id, currency, update_schedule) ⇒ Object
-
#update_reserve_rule(entity_id, reserve_rule_id, etag, reserve_rule_request) ⇒ Object
Update a reserve rule.
-
#upload_entity_file(entity_id, file_request) ⇒ Object
Upload a file scoped to a sub-entity.
- #upload_file(file_request) ⇒ Object
Constructor Details
#initialize(api_client, files_client, configuration) ⇒ AccountsClient
Returns a new instance of AccountsClient.
23 24 25 26 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 23 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_client ⇒ Object (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
54 55 56 57 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 54 def add_payment_instrument(entity_id, payment_instrument) api_client.invoke_post(build_path(ACCOUNTS, ENTITIES, entity_id, PAYMENT_INSTRUMENTS), , payment_instrument) end |
#add_reserve_rule(entity_id, reserve_rule_request) ⇒ Object
Add a reserve rule for a sub-entity.
135 136 137 138 139 140 141 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 135 def add_reserve_rule(entity_id, reserve_rule_request) api_client.invoke_post( build_path(ACCOUNTS, ENTITIES, entity_id, RESERVE_RULES), , reserve_rule_request ) end |
#create_entity(entity_request) ⇒ Object
29 30 31 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 29 def create_entity(entity_request) api_client.invoke_post(build_path(ACCOUNTS, ENTITIES), , entity_request) end |
#create_payment_instrument(entity_id, payment_instrument) ⇒ Object
Please use #add_payment_instrument instead
47 48 49 50 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 47 def create_payment_instrument(entity_id, payment_instrument) api_client.invoke_post(build_path(ACCOUNTS, ENTITIES, entity_id, INSTRUMENT), , payment_instrument) end |
#get_entity(entity_id) ⇒ Object
34 35 36 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 34 def get_entity(entity_id) api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id), ) end |
#get_entity_file(entity_id, file_id) ⇒ Object
Retrieve a file scoped to a sub-entity. Hits GET /entities/entityId/files/fileId.
223 224 225 226 227 228 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 223 def get_entity_file(entity_id, file_id) files_client.invoke_get( build_path(ENTITIES, entity_id, FILES, file_id), ) end |
#get_entity_requirement_details(entity_id, requirement_id) ⇒ Object
Retrieve detailed information for a single requirement.
113 114 115 116 117 118 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 113 def get_entity_requirement_details(entity_id, requirement_id) api_client.invoke_get( build_path(ACCOUNTS, ENTITIES, entity_id, REQUIREMENTS, requirement_id), ) end |
#get_entity_requirements(entity_id) ⇒ Object
Retrieve the list of pending requirements that a sub-entity must resolve.
103 104 105 106 107 108 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 103 def get_entity_requirements(entity_id) api_client.invoke_get( build_path(ACCOUNTS, ENTITIES, entity_id, REQUIREMENTS), ) end |
#get_reserve_rule(entity_id, reserve_rule_id) ⇒ Object
Retrieve a reserve rule by id.
155 156 157 158 159 160 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 155 def get_reserve_rule(entity_id, reserve_rule_id) api_client.invoke_get( build_path(ACCOUNTS, ENTITIES, entity_id, RESERVE_RULES, reserve_rule_id), ) end |
#get_sub_entity_members(entity_id) ⇒ Object
List sub-entity members.
187 188 189 190 191 192 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 187 def get_sub_entity_members(entity_id) api_client.invoke_get( build_path(ACCOUNTS, ENTITIES, entity_id, MEMBERS), ) end |
#query_payment_instruments(entity_id, payment_instruments_query = nil) ⇒ Object
61 62 63 64 65 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 61 def query_payment_instruments(entity_id, payment_instruments_query = nil) api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id, PAYMENT_INSTRUMENTS), , payment_instruments_query) end |
#query_reserve_rules(entity_id) ⇒ Object
Query reserve rules for a sub-entity.
145 146 147 148 149 150 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 145 def query_reserve_rules(entity_id) api_client.invoke_get( build_path(ACCOUNTS, ENTITIES, entity_id, RESERVE_RULES), ) end |
#reinvite_sub_entity_member(entity_id, user_id, reinvite_request) ⇒ Object
Reinvite a sub-entity member. The API marks the request body as required; callers must provide a Hash (or ‘PlatformsHostedOnboardReinviteRequest`-shaped object), even if it is empty `{}` per the current swagger contract.
201 202 203 204 205 206 207 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 201 def reinvite_sub_entity_member(entity_id, user_id, reinvite_request) api_client.invoke_put( build_path(ACCOUNTS, ENTITIES, entity_id, MEMBERS, user_id), , reinvite_request ) end |
#resolve_entity_requirement(entity_id, requirement_id, update_request) ⇒ Object
Submit a response to resolve a requirement.
124 125 126 127 128 129 130 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 124 def resolve_entity_requirement(entity_id, requirement_id, update_request) api_client.invoke_put( build_path(ACCOUNTS, ENTITIES, entity_id, REQUIREMENTS, requirement_id), , update_request ) end |
#retrieve_payment_instrument_details(entity_id, payment_instrument_id) ⇒ Object
69 70 71 72 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 69 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), ) end |
#retrieve_payout_schedule(entity_id) ⇒ Object
92 93 94 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 92 def retrieve_payout_schedule(entity_id) api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id, PAYOUT_SCHEDULE), ) end |
#update_entity(entity_id, entity_request) ⇒ Object
40 41 42 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 40 def update_entity(entity_id, entity_request) api_client.invoke_put(build_path(ACCOUNTS, ENTITIES, entity_id), , entity_request) end |
#update_payment_instrument(entity_id, instrument_id, update_payment_instrument) ⇒ Object
77 78 79 80 81 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 77 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), , update_payment_instrument) end |
#update_payout_schedule(entity_id, currency, update_schedule) ⇒ Object
86 87 88 89 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 86 def update_payout_schedule(entity_id, currency, update_schedule) api_client.invoke_put(build_path(ACCOUNTS, ENTITIES, entity_id, PAYOUT_SCHEDULE), , { currency => update_schedule }) end |
#update_reserve_rule(entity_id, reserve_rule_id, etag, reserve_rule_request) ⇒ Object
Update a reserve rule. The API enforces optimistic concurrency: the ETag returned by GET must be echoed back via Common::Headers#if_match, otherwise the API responds 428 Precondition Required.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 170 def update_reserve_rule(entity_id, reserve_rule_id, etag, reserve_rule_request) headers = nil if !etag.nil? && !etag.empty? headers = CheckoutSdk::Common::Headers.new headers.if_match = etag end api_client.invoke_put( build_path(ACCOUNTS, ENTITIES, entity_id, RESERVE_RULES, reserve_rule_id), , reserve_rule_request, headers ) end |
#upload_entity_file(entity_id, file_request) ⇒ Object
Upload a file scoped to a sub-entity. Hits POST /entities/entityId/files.
212 213 214 215 216 217 218 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 212 def upload_entity_file(entity_id, file_request) files_client.submit_file( build_path(ENTITIES, entity_id, FILES), , file_request ) end |
#upload_file(file_request) ⇒ Object
97 98 99 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 97 def upload_file(file_request) files_client.submit_file(FILES, , file_request) end |