Skip to content

Commit 2a3b0a4

Browse files
Update Accounts (#439)
1 parent c798604 commit 2a3b0a4

File tree

77 files changed

+986
-477
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+986
-477
lines changed

src/CheckoutSdk/Accounts/AccountPhone.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/CheckoutSdk/Accounts/AccountsAccountHolder.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using Checkout.Common;
1+
using Checkout.Accounts.Entities.Common;
2+
using Checkout.Accounts.Entities.Common.Company;
3+
using Checkout.Common;
24

35
namespace Checkout.Accounts
46
{
@@ -16,7 +18,7 @@ public abstract class AccountsAccountHolder
1618

1719
public Address BillingAddress { get; set; }
1820

19-
public AccountPhone Phone { get; set; }
21+
public Phone Phone { get; set; }
2022

2123
public AccountHolderIdentification Identification { get; set; }
2224

Lines changed: 96 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using Checkout.Accounts.Payout.Request;
1+
using Checkout.Accounts.Entities.Request;
2+
using Checkout.Accounts.Entities.Response;
3+
using Checkout.Accounts.Payout.Request;
24
using Checkout.Accounts.Payout.Response;
35
using Checkout.Common;
46
using Checkout.Files;
@@ -12,6 +14,8 @@ public class AccountsClient : FilesClient, IAccountsClient
1214
{
1315
private const string AccountsPath = "accounts";
1416
private const string EntitiesPath = "entities";
17+
private const string MembersPath = "members";
18+
private const string FilesPath = "files";
1519
private const string InstrumentPath = "instruments";
1620
private const string PayoutSchedulePath = "payout-schedules";
1721
private const string PaymentInstrumentsPath = "payment-instruments";
@@ -24,37 +28,46 @@ public AccountsClient(
2428
{
2529
}
2630

27-
public async Task<IdResponse> SubmitFile(AccountsFileRequest accountsFileRequest,
31+
public async Task<OnboardEntityResponse> CreateEntity(
32+
OnboardEntityRequest entityRequest,
2833
CancellationToken cancellationToken = default)
2934
{
30-
CheckoutUtils.ValidateParams("accountsFileRequest", accountsFileRequest,
31-
"accountsFileRequest.purpose", accountsFileRequest.Purpose);
32-
return await SubmitFileToFilesApi(accountsFileRequest.File, accountsFileRequest.Purpose.Value,
35+
CheckoutUtils.ValidateParams("entityRequest", entityRequest);
36+
return await ApiClient.Post<OnboardEntityResponse>(
37+
BuildPath(AccountsPath, EntitiesPath),
38+
SdkAuthorization(),
39+
entityRequest,
3340
cancellationToken);
3441
}
3542

36-
public async Task<OnboardEntityResponse> CreateEntity(OnboardEntityRequest entityRequest,
43+
public async Task<OnboardSubEntityDetailsResponse> GetSubEntityMembers(
44+
string entityId,
3745
CancellationToken cancellationToken = default)
3846
{
39-
CheckoutUtils.ValidateParams("entityRequest", entityRequest);
40-
return await ApiClient.Post<OnboardEntityResponse>(
41-
BuildPath(AccountsPath, EntitiesPath),
47+
CheckoutUtils.ValidateParams("entityId", entityId);
48+
return await ApiClient.Get<OnboardSubEntityDetailsResponse>(
49+
BuildPath(AccountsPath, EntitiesPath, entityId, MembersPath),
4250
SdkAuthorization(),
43-
entityRequest,
4451
cancellationToken);
4552
}
4653

47-
public async Task<PaymentInstrumentDetailsResponse> RetrievePaymentInstrumentDetails(string entityId,
48-
string paymentInstrumentId, CancellationToken cancellationToken = default)
54+
public async Task<OnboardSubEntityResponse> ReinviteSubEntityMember(
55+
string entityId,
56+
string userId,
57+
OnboardSubEntityRequest subEntityRequest,
58+
CancellationToken cancellationToken = default)
4959
{
50-
CheckoutUtils.ValidateParams("entityId", entityId, "paymentInstrumentId", paymentInstrumentId);
51-
return await ApiClient.Get<PaymentInstrumentDetailsResponse>(
52-
BuildPath(AccountsPath, EntitiesPath, entityId, PaymentInstrumentsPath, paymentInstrumentId),
60+
CheckoutUtils.ValidateParams("entityId", entityId, "userId", userId,
61+
"subEntityRequest", subEntityRequest);
62+
return await ApiClient.Put<OnboardSubEntityResponse>(
63+
BuildPath(AccountsPath, EntitiesPath, entityId, MembersPath, userId),
5364
SdkAuthorization(),
65+
subEntityRequest,
5466
cancellationToken);
5567
}
5668

57-
public async Task<OnboardEntityDetailsResponse> GetEntity(string entityId,
69+
public async Task<OnboardEntityDetailsResponse> GetEntity(
70+
string entityId,
5871
CancellationToken cancellationToken = default)
5972
{
6073
CheckoutUtils.ValidateParams("entityId", entityId);
@@ -64,31 +77,34 @@ public async Task<OnboardEntityDetailsResponse> GetEntity(string entityId,
6477
cancellationToken);
6578
}
6679

67-
public async Task<OnboardEntityResponse> UpdateEntity(string entityId, OnboardEntityRequest entityRequest,
80+
public async Task<OnboardEntityResponse> UpdateEntity(
81+
string entityId,
82+
OnboardEntityRequest entityRequest,
6883
CancellationToken cancellationToken = default)
6984
{
70-
CheckoutUtils.ValidateParams("entityRequest", entityRequest, "entityId", entityId);
85+
CheckoutUtils.ValidateParams("entityId", entityId, "entityRequest", entityRequest);
7186
return await ApiClient.Put<OnboardEntityResponse>(
7287
BuildPath(AccountsPath, EntitiesPath, entityId),
7388
SdkAuthorization(),
7489
entityRequest,
7590
cancellationToken);
7691
}
7792

78-
public async Task<EmptyResponse> CreatePaymentInstrument(string entityId,
93+
public async Task<EmptyResponse> CreatePaymentInstrument(
94+
string entityId,
7995
AccountsPaymentInstrument accountsPaymentInstrument,
8096
CancellationToken cancellationToken = default)
8197
{
82-
CheckoutUtils.ValidateParams("accountsPaymentInstrument", accountsPaymentInstrument, "entityId",
83-
entityId);
98+
CheckoutUtils.ValidateParams("entityId", entityId, "accountsPaymentInstrument", accountsPaymentInstrument);
8499
return await ApiClient.Post<EmptyResponse>(
85100
BuildPath(AccountsPath, EntitiesPath, entityId, InstrumentPath),
86101
SdkAuthorization(),
87102
accountsPaymentInstrument,
88103
cancellationToken);
89104
}
90105

91-
public async Task<IdResponse> CreatePaymentInstrument(string entityId,
106+
public async Task<IdResponse> CreatePaymentInstrument(
107+
string entityId,
92108
PaymentInstrumentRequest paymentInstrumentRequest,
93109
CancellationToken cancellationToken = default)
94110
{
@@ -100,21 +116,35 @@ public async Task<IdResponse> CreatePaymentInstrument(string entityId,
100116
cancellationToken);
101117
}
102118

103-
public async Task<IdResponse> UpdatePaymentInstrument(string entityId,
119+
public async Task<PaymentInstrumentDetailsResponse> RetrievePaymentInstrumentDetails(
120+
string entityId,
121+
string paymentInstrumentId,
122+
CancellationToken cancellationToken = default)
123+
{
124+
CheckoutUtils.ValidateParams("entityId", entityId, "paymentInstrumentId", paymentInstrumentId);
125+
return await ApiClient.Get<PaymentInstrumentDetailsResponse>(
126+
BuildPath(AccountsPath, EntitiesPath, entityId, PaymentInstrumentsPath, paymentInstrumentId),
127+
SdkAuthorization(),
128+
cancellationToken);
129+
}
130+
131+
public async Task<IdResponse> UpdatePaymentInstrument(
132+
string entityId,
104133
string instrumentId,
105134
UpdatePaymentInstrumentRequest updatePaymentInstrumentRequest,
106135
CancellationToken cancellationToken = default)
107136
{
108-
CheckoutUtils.ValidateParams("entityId", entityId, "updatePaymentInstrumentRequest",
109-
updatePaymentInstrumentRequest);
137+
CheckoutUtils.ValidateParams("entityId", entityId, "instrumentId", instrumentId,
138+
"updatePaymentInstrumentRequest", updatePaymentInstrumentRequest);
110139
return await ApiClient.Patch<IdResponse>(
111140
BuildPath(AccountsPath, EntitiesPath, entityId, PaymentInstrumentsPath, instrumentId),
112141
SdkAuthorization(),
113142
updatePaymentInstrumentRequest,
114143
cancellationToken);
115144
}
116145

117-
public async Task<PaymentInstrumentQueryResponse> QueryPaymentInstruments(string entityId,
146+
public async Task<PaymentInstrumentQueryResponse> QueryPaymentInstruments(
147+
string entityId,
118148
PaymentInstrumentsQuery query = null,
119149
CancellationToken cancellationToken = default)
120150
{
@@ -126,7 +156,8 @@ public async Task<PaymentInstrumentQueryResponse> QueryPaymentInstruments(string
126156
cancellationToken);
127157
}
128158

129-
public async Task<GetScheduleResponse> RetrievePayoutSchedule(string entityId,
159+
public async Task<GetScheduleResponse> RetrievePayoutSchedule(
160+
string entityId,
130161
CancellationToken cancellationToken = default)
131162
{
132163
CheckoutUtils.ValidateParams("entityId", entityId);
@@ -136,7 +167,9 @@ public async Task<GetScheduleResponse> RetrievePayoutSchedule(string entityId,
136167
cancellationToken);
137168
}
138169

139-
public async Task<EmptyResponse> UpdatePayoutSchedule(string entityId, Currency currency,
170+
public async Task<EmptyResponse> UpdatePayoutSchedule(
171+
string entityId,
172+
Currency currency,
140173
UpdateScheduleRequest updateScheduleRequest,
141174
CancellationToken cancellationToken = default)
142175
{
@@ -148,5 +181,40 @@ public async Task<EmptyResponse> UpdatePayoutSchedule(string entityId, Currency
148181
new Dictionary<Currency, UpdateScheduleRequest>() { { currency, updateScheduleRequest } },
149182
cancellationToken);
150183
}
184+
185+
public async Task<IdResponse> SubmitFile(
186+
AccountsFileRequest accountsFileRequest,
187+
CancellationToken cancellationToken = default)
188+
{
189+
CheckoutUtils.ValidateParams("accountsFileRequest", accountsFileRequest,
190+
"accountsFileRequest.purpose", accountsFileRequest.Purpose);
191+
return await SubmitFileToFilesApi(accountsFileRequest.File, accountsFileRequest.Purpose.Value,
192+
cancellationToken);
193+
}
194+
195+
public async Task<UploadFileResponse> UploadFile(
196+
string entityId,
197+
AccountsFileRequest accountsFileRequest,
198+
CancellationToken cancellationToken = default)
199+
{
200+
CheckoutUtils.ValidateParams("accountsFileRequest", accountsFileRequest);
201+
return await ApiClient.Post<UploadFileResponse>(
202+
BuildPath(AccountsPath, entityId, FilesPath),
203+
SdkAuthorization(),
204+
accountsFileRequest,
205+
cancellationToken);
206+
}
207+
208+
public async Task<FileDetailsResponse> RetrieveFile(
209+
string entityId,
210+
string fileId,
211+
CancellationToken cancellationToken = default)
212+
{
213+
CheckoutUtils.ValidateParams("entityId", entityId, "fileId", fileId);
214+
return await ApiClient.Get<FileDetailsResponse>(
215+
BuildPath(AccountsPath, entityId, FilesPath, fileId),
216+
SdkAuthorization(),
217+
cancellationToken);
218+
}
151219
}
152220
}

src/CheckoutSdk/Accounts/AccountsFilePurpose.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,38 @@ private AccountsFilePurpose(string purpose)
88
}
99

1010
public string Value { get; }
11+
12+
public static AccountsFilePurpose AdditionalDocument => new AccountsFilePurpose("additional_document");
13+
14+
public static AccountsFilePurpose ArticlesOfAssociation => new AccountsFilePurpose("articles_of_association");
1115

1216
public static AccountsFilePurpose BankVerification => new AccountsFilePurpose("bank_verification");
17+
18+
public static AccountsFilePurpose CertifiedAuthorisedSignatory => new AccountsFilePurpose("certified_authorised_signatory");
19+
20+
public static AccountsFilePurpose CompanyOwnership => new AccountsFilePurpose("company_ownership");
1321

1422
public static AccountsFilePurpose Identification => new AccountsFilePurpose("identification");
1523

1624
public static AccountsFilePurpose IdentityVerification => new AccountsFilePurpose("identity_verification");
25+
26+
public static AccountsFilePurpose DisputeEvidence => new AccountsFilePurpose("dispute_evidence");
1727

1828
public static AccountsFilePurpose CompanyVerification => new AccountsFilePurpose("company_verification");
1929

2030
public static AccountsFilePurpose FinancialVerification => new AccountsFilePurpose("financial_verification");
2131

2232
public static AccountsFilePurpose TaxVerification => new AccountsFilePurpose("tax_verification");
33+
34+
public static AccountsFilePurpose ProofOfLegality => new AccountsFilePurpose("proof_of_legality");
35+
36+
public static AccountsFilePurpose ProofOfPrincipalAddress => new AccountsFilePurpose("proof_of_principal_address");
37+
38+
public static AccountsFilePurpose ShareholderStructure => new AccountsFilePurpose("shareholder_structure");
39+
40+
public static AccountsFilePurpose ProofOfResidentialAddress => new AccountsFilePurpose("proof_of_residential_address");
41+
42+
public static AccountsFilePurpose ProofOfRegistration => new AccountsFilePurpose("proof_of_registration");
43+
2344
}
2445
}

src/CheckoutSdk/Accounts/BusinessType.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/CheckoutSdk/Accounts/ContactDetails.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/CheckoutSdk/Accounts/Document.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)