Class: CheckoutSdk::Accounts::AccountsClient
- Defined in:
- lib/checkout_sdk/accounts/accounts_client.rb
Constant Summary collapse
- DEFAULT_SCHEMA_VERSION =
'3.0'
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, schema_version = DEFAULT_SCHEMA_VERSION) ⇒ Object
-
#create_payment_instrument(entity_id, payment_instrument) ⇒ Object
deprecated
Deprecated.
Please use #add_payment_instrument instead
- #get_entity(entity_id, schema_version = DEFAULT_SCHEMA_VERSION) ⇒ 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, schema_version = DEFAULT_SCHEMA_VERSION) ⇒ 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, schema_version = DEFAULT_SCHEMA_VERSION) ⇒ 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.
24 25 26 27 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 24 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
61 62 63 64 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 61 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.
145 146 147 148 149 150 151 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 145 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, schema_version = DEFAULT_SCHEMA_VERSION) ⇒ Object
31 32 33 34 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 31 def create_entity(entity_request, schema_version = DEFAULT_SCHEMA_VERSION) api_client.invoke_post(build_path(ACCOUNTS, ENTITIES), , entity_request, nil, build_schema_version_headers(schema_version)) end |
#create_payment_instrument(entity_id, payment_instrument) ⇒ Object
Please use #add_payment_instrument instead
54 55 56 57 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 54 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, schema_version = DEFAULT_SCHEMA_VERSION) ⇒ Object
38 39 40 41 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 38 def get_entity(entity_id, schema_version = DEFAULT_SCHEMA_VERSION) api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id), , nil, build_schema_version_headers(schema_version)) end |
#get_entity_file(entity_id, file_id) ⇒ Object
Retrieve a file scoped to a sub-entity. Hits GET /entities/entityId/files/fileId.
233 234 235 236 237 238 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 233 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.
123 124 125 126 127 128 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 123 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, schema_version = DEFAULT_SCHEMA_VERSION) ⇒ Object
Retrieve the list of pending requirements that a sub-entity must resolve.
111 112 113 114 115 116 117 118 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 111 def get_entity_requirements(entity_id, schema_version = DEFAULT_SCHEMA_VERSION) api_client.invoke_get( build_path(ACCOUNTS, ENTITIES, entity_id, REQUIREMENTS), , nil, build_schema_version_headers(schema_version) ) end |
#get_reserve_rule(entity_id, reserve_rule_id) ⇒ Object
Retrieve a reserve rule by id.
165 166 167 168 169 170 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 165 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.
197 198 199 200 201 202 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 197 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
68 69 70 71 72 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 68 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.
155 156 157 158 159 160 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 155 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.
211 212 213 214 215 216 217 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 211 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.
134 135 136 137 138 139 140 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 134 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
76 77 78 79 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 76 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
99 100 101 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 99 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, schema_version = DEFAULT_SCHEMA_VERSION) ⇒ Object
46 47 48 49 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 46 def update_entity(entity_id, entity_request, schema_version = DEFAULT_SCHEMA_VERSION) api_client.invoke_put(build_path(ACCOUNTS, ENTITIES, entity_id), , entity_request, build_schema_version_headers(schema_version)) end |
#update_payment_instrument(entity_id, instrument_id, update_payment_instrument) ⇒ Object
84 85 86 87 88 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 84 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
93 94 95 96 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 93 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.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 180 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.
222 223 224 225 226 227 228 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 222 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
104 105 106 |
# File 'lib/checkout_sdk/accounts/accounts_client.rb', line 104 def upload_file(file_request) files_client.submit_file(FILES, , file_request) end |