diff --git a/src/CheckoutSdk/Accounts/AccountPhone.cs b/src/CheckoutSdk/Accounts/AccountPhone.cs deleted file mode 100644 index 682b10d6..00000000 --- a/src/CheckoutSdk/Accounts/AccountPhone.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Checkout.Common; - -namespace Checkout.Accounts -{ - public class AccountPhone - { - public CountryCode? CountryCode { get; set; } - public string Number { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/AccountsAccountHolder.cs b/src/CheckoutSdk/Accounts/AccountsAccountHolder.cs index 2ee04e17..08a307c0 100644 --- a/src/CheckoutSdk/Accounts/AccountsAccountHolder.cs +++ b/src/CheckoutSdk/Accounts/AccountsAccountHolder.cs @@ -1,4 +1,6 @@ -using Checkout.Common; +using Checkout.Accounts.Entities.Common; +using Checkout.Accounts.Entities.Common.Company; +using Checkout.Common; namespace Checkout.Accounts { @@ -16,7 +18,7 @@ public abstract class AccountsAccountHolder public Address BillingAddress { get; set; } - public AccountPhone Phone { get; set; } + public Phone Phone { get; set; } public AccountHolderIdentification Identification { get; set; } diff --git a/src/CheckoutSdk/Accounts/AccountsClient.cs b/src/CheckoutSdk/Accounts/AccountsClient.cs index fd0696b4..7da50c3f 100644 --- a/src/CheckoutSdk/Accounts/AccountsClient.cs +++ b/src/CheckoutSdk/Accounts/AccountsClient.cs @@ -1,4 +1,6 @@ -using Checkout.Accounts.Payout.Request; +using Checkout.Accounts.Entities.Request; +using Checkout.Accounts.Entities.Response; +using Checkout.Accounts.Payout.Request; using Checkout.Accounts.Payout.Response; using Checkout.Common; using Checkout.Files; @@ -12,6 +14,8 @@ public class AccountsClient : FilesClient, IAccountsClient { private const string AccountsPath = "accounts"; private const string EntitiesPath = "entities"; + private const string MembersPath = "members"; + private const string FilesPath = "files"; private const string InstrumentPath = "instruments"; private const string PayoutSchedulePath = "payout-schedules"; private const string PaymentInstrumentsPath = "payment-instruments"; @@ -24,37 +28,46 @@ public AccountsClient( { } - public async Task SubmitFile(AccountsFileRequest accountsFileRequest, + public async Task CreateEntity( + OnboardEntityRequest entityRequest, CancellationToken cancellationToken = default) { - CheckoutUtils.ValidateParams("accountsFileRequest", accountsFileRequest, - "accountsFileRequest.purpose", accountsFileRequest.Purpose); - return await SubmitFileToFilesApi(accountsFileRequest.File, accountsFileRequest.Purpose.Value, + CheckoutUtils.ValidateParams("entityRequest", entityRequest); + return await ApiClient.Post( + BuildPath(AccountsPath, EntitiesPath), + SdkAuthorization(), + entityRequest, cancellationToken); } - public async Task CreateEntity(OnboardEntityRequest entityRequest, + public async Task GetSubEntityMembers( + string entityId, CancellationToken cancellationToken = default) { - CheckoutUtils.ValidateParams("entityRequest", entityRequest); - return await ApiClient.Post( - BuildPath(AccountsPath, EntitiesPath), + CheckoutUtils.ValidateParams("entityId", entityId); + return await ApiClient.Get( + BuildPath(AccountsPath, EntitiesPath, entityId, MembersPath), SdkAuthorization(), - entityRequest, cancellationToken); } - public async Task RetrievePaymentInstrumentDetails(string entityId, - string paymentInstrumentId, CancellationToken cancellationToken = default) + public async Task ReinviteSubEntityMember( + string entityId, + string userId, + OnboardSubEntityRequest subEntityRequest, + CancellationToken cancellationToken = default) { - CheckoutUtils.ValidateParams("entityId", entityId, "paymentInstrumentId", paymentInstrumentId); - return await ApiClient.Get( - BuildPath(AccountsPath, EntitiesPath, entityId, PaymentInstrumentsPath, paymentInstrumentId), + CheckoutUtils.ValidateParams("entityId", entityId, "userId", userId, + "subEntityRequest", subEntityRequest); + return await ApiClient.Put( + BuildPath(AccountsPath, EntitiesPath, entityId, MembersPath, userId), SdkAuthorization(), + subEntityRequest, cancellationToken); } - public async Task GetEntity(string entityId, + public async Task GetEntity( + string entityId, CancellationToken cancellationToken = default) { CheckoutUtils.ValidateParams("entityId", entityId); @@ -64,10 +77,12 @@ public async Task GetEntity(string entityId, cancellationToken); } - public async Task UpdateEntity(string entityId, OnboardEntityRequest entityRequest, + public async Task UpdateEntity( + string entityId, + OnboardEntityRequest entityRequest, CancellationToken cancellationToken = default) { - CheckoutUtils.ValidateParams("entityRequest", entityRequest, "entityId", entityId); + CheckoutUtils.ValidateParams("entityId", entityId, "entityRequest", entityRequest); return await ApiClient.Put( BuildPath(AccountsPath, EntitiesPath, entityId), SdkAuthorization(), @@ -75,12 +90,12 @@ public async Task UpdateEntity(string entityId, OnboardEn cancellationToken); } - public async Task CreatePaymentInstrument(string entityId, + public async Task CreatePaymentInstrument( + string entityId, AccountsPaymentInstrument accountsPaymentInstrument, CancellationToken cancellationToken = default) { - CheckoutUtils.ValidateParams("accountsPaymentInstrument", accountsPaymentInstrument, "entityId", - entityId); + CheckoutUtils.ValidateParams("entityId", entityId, "accountsPaymentInstrument", accountsPaymentInstrument); return await ApiClient.Post( BuildPath(AccountsPath, EntitiesPath, entityId, InstrumentPath), SdkAuthorization(), @@ -88,7 +103,8 @@ public async Task CreatePaymentInstrument(string entityId, cancellationToken); } - public async Task CreatePaymentInstrument(string entityId, + public async Task CreatePaymentInstrument( + string entityId, PaymentInstrumentRequest paymentInstrumentRequest, CancellationToken cancellationToken = default) { @@ -100,13 +116,26 @@ public async Task CreatePaymentInstrument(string entityId, cancellationToken); } - public async Task UpdatePaymentInstrument(string entityId, + public async Task RetrievePaymentInstrumentDetails( + string entityId, + string paymentInstrumentId, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("entityId", entityId, "paymentInstrumentId", paymentInstrumentId); + return await ApiClient.Get( + BuildPath(AccountsPath, EntitiesPath, entityId, PaymentInstrumentsPath, paymentInstrumentId), + SdkAuthorization(), + cancellationToken); + } + + public async Task UpdatePaymentInstrument( + string entityId, string instrumentId, UpdatePaymentInstrumentRequest updatePaymentInstrumentRequest, CancellationToken cancellationToken = default) { - CheckoutUtils.ValidateParams("entityId", entityId, "updatePaymentInstrumentRequest", - updatePaymentInstrumentRequest); + CheckoutUtils.ValidateParams("entityId", entityId, "instrumentId", instrumentId, + "updatePaymentInstrumentRequest", updatePaymentInstrumentRequest); return await ApiClient.Patch( BuildPath(AccountsPath, EntitiesPath, entityId, PaymentInstrumentsPath, instrumentId), SdkAuthorization(), @@ -114,7 +143,8 @@ public async Task UpdatePaymentInstrument(string entityId, cancellationToken); } - public async Task QueryPaymentInstruments(string entityId, + public async Task QueryPaymentInstruments( + string entityId, PaymentInstrumentsQuery query = null, CancellationToken cancellationToken = default) { @@ -126,7 +156,8 @@ public async Task QueryPaymentInstruments(string cancellationToken); } - public async Task RetrievePayoutSchedule(string entityId, + public async Task RetrievePayoutSchedule( + string entityId, CancellationToken cancellationToken = default) { CheckoutUtils.ValidateParams("entityId", entityId); @@ -136,7 +167,9 @@ public async Task RetrievePayoutSchedule(string entityId, cancellationToken); } - public async Task UpdatePayoutSchedule(string entityId, Currency currency, + public async Task UpdatePayoutSchedule( + string entityId, + Currency currency, UpdateScheduleRequest updateScheduleRequest, CancellationToken cancellationToken = default) { @@ -148,5 +181,40 @@ public async Task UpdatePayoutSchedule(string entityId, Currency new Dictionary() { { currency, updateScheduleRequest } }, cancellationToken); } + + public async Task SubmitFile( + AccountsFileRequest accountsFileRequest, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("accountsFileRequest", accountsFileRequest, + "accountsFileRequest.purpose", accountsFileRequest.Purpose); + return await SubmitFileToFilesApi(accountsFileRequest.File, accountsFileRequest.Purpose.Value, + cancellationToken); + } + + public async Task UploadFile( + string entityId, + AccountsFileRequest accountsFileRequest, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("accountsFileRequest", accountsFileRequest); + return await ApiClient.Post( + BuildPath(AccountsPath, entityId, FilesPath), + SdkAuthorization(), + accountsFileRequest, + cancellationToken); + } + + public async Task RetrieveFile( + string entityId, + string fileId, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("entityId", entityId, "fileId", fileId); + return await ApiClient.Get( + BuildPath(AccountsPath, entityId, FilesPath, fileId), + SdkAuthorization(), + cancellationToken); + } } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/AccountsFilePurpose.cs b/src/CheckoutSdk/Accounts/AccountsFilePurpose.cs index 342cf693..3cd0577e 100644 --- a/src/CheckoutSdk/Accounts/AccountsFilePurpose.cs +++ b/src/CheckoutSdk/Accounts/AccountsFilePurpose.cs @@ -8,17 +8,38 @@ private AccountsFilePurpose(string purpose) } public string Value { get; } + + public static AccountsFilePurpose AdditionalDocument => new AccountsFilePurpose("additional_document"); + + public static AccountsFilePurpose ArticlesOfAssociation => new AccountsFilePurpose("articles_of_association"); public static AccountsFilePurpose BankVerification => new AccountsFilePurpose("bank_verification"); + + public static AccountsFilePurpose CertifiedAuthorisedSignatory => new AccountsFilePurpose("certified_authorised_signatory"); + + public static AccountsFilePurpose CompanyOwnership => new AccountsFilePurpose("company_ownership"); public static AccountsFilePurpose Identification => new AccountsFilePurpose("identification"); public static AccountsFilePurpose IdentityVerification => new AccountsFilePurpose("identity_verification"); + + public static AccountsFilePurpose DisputeEvidence => new AccountsFilePurpose("dispute_evidence"); public static AccountsFilePurpose CompanyVerification => new AccountsFilePurpose("company_verification"); public static AccountsFilePurpose FinancialVerification => new AccountsFilePurpose("financial_verification"); public static AccountsFilePurpose TaxVerification => new AccountsFilePurpose("tax_verification"); + + public static AccountsFilePurpose ProofOfLegality => new AccountsFilePurpose("proof_of_legality"); + + public static AccountsFilePurpose ProofOfPrincipalAddress => new AccountsFilePurpose("proof_of_principal_address"); + + public static AccountsFilePurpose ShareholderStructure => new AccountsFilePurpose("shareholder_structure"); + + public static AccountsFilePurpose ProofOfResidentialAddress => new AccountsFilePurpose("proof_of_residential_address"); + + public static AccountsFilePurpose ProofOfRegistration => new AccountsFilePurpose("proof_of_registration"); + } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/BusinessType.cs b/src/CheckoutSdk/Accounts/BusinessType.cs deleted file mode 100644 index 05de8e46..00000000 --- a/src/CheckoutSdk/Accounts/BusinessType.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Accounts -{ - public enum BusinessType - { - [EnumMember(Value = "general_partnership")] GeneralPartnership, - [EnumMember(Value = "limited_partnership")] LimitedPartnership, - [EnumMember(Value = "public_limited_company")] PublicLimitedCompany, - [EnumMember(Value = "limited_company")] LimitedCompany, - [EnumMember(Value = "professional_association")] ProfessionalAssociation, - [EnumMember(Value = "unincorporated_association")] UnincorporatedAssociation, - [EnumMember(Value = "auto_entrepreneur")] AutoEntrepreneur, - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/ContactDetails.cs b/src/CheckoutSdk/Accounts/ContactDetails.cs deleted file mode 100644 index df37ae82..00000000 --- a/src/CheckoutSdk/Accounts/ContactDetails.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Checkout.Accounts -{ - public class ContactDetails - { - public AccountPhone Phone { get; set; } - - public EntityEmailAddresses EmailAddresses { get; set; } - - public Invitee Invitee { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Document.cs b/src/CheckoutSdk/Accounts/Document.cs deleted file mode 100644 index ea416b92..00000000 --- a/src/CheckoutSdk/Accounts/Document.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Checkout.Common; - -namespace Checkout.Accounts -{ - public class Document - { - public DocumentType? Type { get; set; } - - public string Front { get; set; } - - public string Back { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Common/Company/BusinessType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/BusinessType.cs new file mode 100644 index 00000000..bf77ea05 --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/BusinessType.cs @@ -0,0 +1,66 @@ +using System.Runtime.Serialization; + +namespace Checkout.Accounts.Entities.Common.Company +{ + public enum BusinessType + { + // GB Company Full (3.0) Business Types + [EnumMember(Value = "scottish_limited_partnership")] + ScottishLimitedPartnership, + + // Common + [EnumMember(Value = "unincorporated_association")] + UnincorporatedAssociation, + + [EnumMember(Value = "private_corporation")] + PrivateCorporation, + + [EnumMember(Value = "limited_liability_corporation")] + LimitedLiabilityCorporation, + + [EnumMember(Value = "publicly_traded_corporation")] + PubliclyTradedCorporation, + + [EnumMember(Value = "regulated_financial_institution")] + RegulatedFinancialInstitution, + + [EnumMember(Value = "sec_registered_entity")] + SecRegisteredEntity, + + [EnumMember(Value = "cftc_registered_entity")] + CftcRegisteredEntity, + + [EnumMember(Value = "individual_or_sole_proprietorship")] + IndividualOrSoleProprietorship, + + [EnumMember(Value = "government_agency")] + GovernmentAgency, + + [EnumMember(Value = "non_profit_entity")] + NonProfitEntity, + + [EnumMember(Value = "trust")] + Trust, + + [EnumMember(Value = "club_or_society")] + ClubOrSociety, + + [EnumMember(Value = "general_partnership")] + GeneralPartnership, + + [EnumMember(Value = "limited_partnership")] + LimitedPartnership, + + [EnumMember(Value = "public_limited_company")] + PublicLimitedCompany, + + [EnumMember(Value = "limited_company")] + LimitedCompany, + + [EnumMember(Value = "professional_association")] + ProfessionalAssociation, + + [EnumMember(Value = "auto_entrepreneur")] + AutoEntrepreneur, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Company.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/Company.cs similarity index 65% rename from src/CheckoutSdk/Accounts/Company.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/Company.cs index 598e9c68..aaba99a8 100644 --- a/src/CheckoutSdk/Accounts/Company.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/Company.cs @@ -1,12 +1,11 @@ -using Checkout.Accounts.Regional; -using Checkout.Common; -using Newtonsoft.Json; +using Checkout.Common; using System.Collections.Generic; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { public class Company { + // Common public string LegalName { get; set; } public string TradingName { get; set; } @@ -14,19 +13,24 @@ public class Company public string BusinessRegistrationNumber { get; set; } public DateOfIncorporation DateOfIncorporation { get; set; } - - public string RegulatoryLicenceNumber { get; set; } - + public Address PrincipalAddress { get; set; } public Address RegisteredAddress { get; set; } public IList Representatives { get; set; } - - public EntityDocument Document { get; set; } - - public EntityFinancialDetails FinancialDetails { get; set; } - + public BusinessType? BusinessType { get; set; } + + public FinancialDetails FinancialDetails { get; set; } + + // EEA Company Full (3.0) Company + + public string RegulatoryLicenseNumber { get; set; } + + // Unknown + public EntityDocument Document { get; set; } + + public string RegulatoryLicenceNumber { get; set; } } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Common/Company/CompanyPositionType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/CompanyPositionType.cs new file mode 100644 index 00000000..40c63a60 --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/CompanyPositionType.cs @@ -0,0 +1,40 @@ +using System.Runtime.Serialization; + +namespace Checkout.Accounts.Entities.Common.Company +{ + public enum CompanyPositionType + { + [EnumMember(Value = "ceo")] + CEO, + + [EnumMember(Value = "cfo")] + CFO, + + [EnumMember(Value = "coo")] + COO, + + [EnumMember(Value = "managing_member")] + ManagingMember, + + [EnumMember(Value = "general_partner")] + GeneralPartner, + + [EnumMember(Value = "president")] + President, + + [EnumMember(Value = "vice_president")] + VicePresident, + + [EnumMember(Value = "treasurer")] + Treasurer, + + [EnumMember(Value = "other_senior_management")] + OtherSeniorManagement, + + [EnumMember(Value = "other_executive_officer")] + OtherExecutiveOfficer, + + [EnumMember(Value = "other_non_executive_non_senior")] + OtherNonExecutiveNonSenior + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/DateOfBirth.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/DateOfBirth.cs similarity index 74% rename from src/CheckoutSdk/Accounts/DateOfBirth.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/DateOfBirth.cs index 152c6a1a..7056e805 100644 --- a/src/CheckoutSdk/Accounts/DateOfBirth.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/DateOfBirth.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { public class DateOfBirth { diff --git a/src/CheckoutSdk/Accounts/DateOfIncorporation.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/DateOfIncorporation.cs similarity index 57% rename from src/CheckoutSdk/Accounts/DateOfIncorporation.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/DateOfIncorporation.cs index 7b4f7a64..a517a443 100644 --- a/src/CheckoutSdk/Accounts/DateOfIncorporation.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/DateOfIncorporation.cs @@ -1,9 +1,11 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { public class DateOfIncorporation { public int? Month { get; set; } public int? Year { get; set; } + + public int? Day { get; set; } } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/EntityDocument.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/EntityDocument.cs similarity index 70% rename from src/CheckoutSdk/Accounts/EntityDocument.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/EntityDocument.cs index a5219f7c..23c30521 100644 --- a/src/CheckoutSdk/Accounts/EntityDocument.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/EntityDocument.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { public class EntityDocument { diff --git a/src/CheckoutSdk/Accounts/EntityRoles.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/EntityRoles.cs similarity index 86% rename from src/CheckoutSdk/Accounts/EntityRoles.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/EntityRoles.cs index 88e6e133..40151df2 100644 --- a/src/CheckoutSdk/Accounts/EntityRoles.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/EntityRoles.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { public enum EntityRoles { diff --git a/src/CheckoutSdk/Accounts/EntityFinancialDetails.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/FinancialDetails.cs similarity index 61% rename from src/CheckoutSdk/Accounts/EntityFinancialDetails.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/FinancialDetails.cs index ff6d1a11..7d2868b5 100644 --- a/src/CheckoutSdk/Accounts/EntityFinancialDetails.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/FinancialDetails.cs @@ -1,8 +1,8 @@ using Checkout.Common; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { - public class EntityFinancialDetails + public class FinancialDetails { public long? AnnualProcessingVolume { get; set; } @@ -10,8 +10,10 @@ public class EntityFinancialDetails public long? HighestTransactionValue { get; set; } - public EntityFinancialDocuments Documents { get; set; } public Currency? Currency { get; set; } + + // Unknown + public FinancialDocuments Documents { get; set; } } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/EntityFinancialDocuments.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/FinancialDocuments.cs similarity index 60% rename from src/CheckoutSdk/Accounts/EntityFinancialDocuments.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/FinancialDocuments.cs index c4b26c6d..913a18db 100644 --- a/src/CheckoutSdk/Accounts/EntityFinancialDocuments.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/FinancialDocuments.cs @@ -1,6 +1,6 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { - public class EntityFinancialDocuments + public class FinancialDocuments { public EntityDocument BankStatement { get; set; } diff --git a/src/CheckoutSdk/Accounts/Entities/Common/Company/Identification.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/Identification.cs new file mode 100644 index 00000000..bc4285c5 --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/Identification.cs @@ -0,0 +1,11 @@ +namespace Checkout.Accounts.Entities.Common.Company +{ + public class Identification + { + public string NationalIdNumber { get; set; } + + // Unknown + + public Documents.Documents Document { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Individual.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/Individual.cs similarity index 56% rename from src/CheckoutSdk/Accounts/Individual.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/Individual.cs index 97670a55..e909e520 100644 --- a/src/CheckoutSdk/Accounts/Individual.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/Individual.cs @@ -1,29 +1,39 @@ using Checkout.Common; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { public class Individual { + // Common public string FirstName { get; set; } - - public string MiddleName { get; set; } - + public string LastName { get; set; } - - public string LegalName { get; set; } - - public string TradingName { get; set; } - - public string NationalTaxId { get; set; } - - public Address RegisteredAddress { get; set; } - + public DateOfBirth DateOfBirth { get; set; } public PlaceOfBirth PlaceOfBirth { get; set; } + + public Address Address { get; set; } + public string MiddleName { get; set; } + + public string NationalIdNumber { get; set; } + + public string EmailAddress { get; set; } + + public Phone Phone { get; set; } + + public FinancialDetails FinancialDetails { get; set; } + public Identification Identification { get; set; } - - public EntityFinancialDetails FinancialDetails { get; set; } + + public Address RegisteredAddress { get; set; } + public string TradingName { get; set; } + + // Unknown + + public string LegalName { get; set; } + public string NationalTaxId { get; set; } + } -} \ No newline at end of file +} diff --git a/src/CheckoutSdk/Accounts/PlaceOfBirth.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/PlaceOfBirth.cs similarity index 69% rename from src/CheckoutSdk/Accounts/PlaceOfBirth.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/PlaceOfBirth.cs index c36ddcc5..0be76699 100644 --- a/src/CheckoutSdk/Accounts/PlaceOfBirth.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/PlaceOfBirth.cs @@ -1,6 +1,6 @@ using Checkout.Common; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { public class PlaceOfBirth { diff --git a/src/CheckoutSdk/Accounts/Profile.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/Profile.cs similarity index 86% rename from src/CheckoutSdk/Accounts/Profile.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Company/Profile.cs index 8275f05b..73873f5c 100644 --- a/src/CheckoutSdk/Accounts/Profile.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/Profile.cs @@ -1,7 +1,7 @@ using Checkout.Common; using System.Collections.Generic; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Company { public class Profile { diff --git a/src/CheckoutSdk/Accounts/Entities/Common/Company/Representative.cs b/src/CheckoutSdk/Accounts/Entities/Common/Company/Representative.cs new file mode 100644 index 00000000..3c0c0a80 --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/Company/Representative.cs @@ -0,0 +1,47 @@ +using Checkout.Common; +using System.Collections.Generic; + +namespace Checkout.Accounts.Entities.Common.Company +{ + public class Representative + { + // Common + + public string Id { get; set; } + + public int? OwnershipPercentage { get; set; } + + public IList Roles { get; set; } + + public Documents.Documents Documents { get; set; } + + // 3.0 /1 + + public Individual Individual { get; set; } + + + public CompanyPositionType? CompanyPosition { get; set; } + + + // 3.0 /2 + + public Company Company { get; set; } + + // 2.0 Common + + public string FirstName { get; set; } + + public string LastName { get; set; } + + public Address Address { get; set; } + public DateOfBirth DateOfBirth { get; set; } + + public string MiddleName { get; set; } + + public Phone Phone { get; set; } + + // 2.0 EEA Company Full + + public PlaceOfBirth PlaceOfBirth { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Common/ContactDetails/ContactDetails.cs b/src/CheckoutSdk/Accounts/Entities/Common/ContactDetails/ContactDetails.cs new file mode 100644 index 00000000..f3c5ac30 --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/ContactDetails/ContactDetails.cs @@ -0,0 +1,17 @@ +using Checkout.Common; + +namespace Checkout.Accounts.Entities.Common.ContactDetails +{ + public class ContactDetails + { + // Common + + public Invitee Invitee { get; set; } + + // GB Company Full (3.0) + public Phone Phone { get; set; } + + public EmailAddresses EmailAddresses { get; set; } + + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Common/ContactDetails/EmailAddresses.cs b/src/CheckoutSdk/Accounts/Entities/Common/ContactDetails/EmailAddresses.cs new file mode 100644 index 00000000..0d18337b --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/ContactDetails/EmailAddresses.cs @@ -0,0 +1,7 @@ +namespace Checkout.Accounts.Entities.Common.ContactDetails +{ + public class EmailAddresses + { + public string Primary { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Invitee.cs b/src/CheckoutSdk/Accounts/Entities/Common/ContactDetails/Invitee.cs similarity index 58% rename from src/CheckoutSdk/Accounts/Invitee.cs rename to src/CheckoutSdk/Accounts/Entities/Common/ContactDetails/Invitee.cs index 927f3759..32f3de72 100644 --- a/src/CheckoutSdk/Accounts/Invitee.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/ContactDetails/Invitee.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.ContactDetails { public class Invitee { diff --git a/src/CheckoutSdk/Accounts/AdditionalDocument.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/AdditionalDocument.cs similarity index 63% rename from src/CheckoutSdk/Accounts/AdditionalDocument.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/AdditionalDocument.cs index ecb62c0f..b1131aaf 100644 --- a/src/CheckoutSdk/Accounts/AdditionalDocument.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/AdditionalDocument.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public class AdditionalDocument { diff --git a/src/CheckoutSdk/Accounts/Entities/Common/Documents/ArticlesOfAssociation.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ArticlesOfAssociation.cs new file mode 100644 index 00000000..0f1aac50 --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ArticlesOfAssociation.cs @@ -0,0 +1,11 @@ +using Checkout.Accounts.Entities.Common.Company; + +namespace Checkout.Accounts.Entities.Common.Documents +{ + public class ArticlesOfAssociation + { + public ArticlesOfAssociationType? Type { get; set; } + + public string Front { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/ArticlesOfAssociationType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ArticlesOfAssociationType.cs similarity index 83% rename from src/CheckoutSdk/Accounts/ArticlesOfAssociationType.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/ArticlesOfAssociationType.cs index 6e3109df..61a5cd80 100644 --- a/src/CheckoutSdk/Accounts/ArticlesOfAssociationType.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ArticlesOfAssociationType.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public enum ArticlesOfAssociationType { diff --git a/src/CheckoutSdk/Accounts/BankVerification.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/BankVerification.cs similarity index 73% rename from src/CheckoutSdk/Accounts/BankVerification.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/BankVerification.cs index 6aaa53d6..b89a0554 100644 --- a/src/CheckoutSdk/Accounts/BankVerification.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/BankVerification.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public class BankVerification { diff --git a/src/CheckoutSdk/Accounts/BankVerificationType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/BankVerificationType.cs similarity index 73% rename from src/CheckoutSdk/Accounts/BankVerificationType.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/BankVerificationType.cs index 3f3cac20..2b185fa8 100644 --- a/src/CheckoutSdk/Accounts/BankVerificationType.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/BankVerificationType.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public enum BankVerificationType { diff --git a/src/CheckoutSdk/Accounts/Entities/Common/Documents/CertifiedAuthorisedSignatory.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/CertifiedAuthorisedSignatory.cs new file mode 100644 index 00000000..b9b7ff9b --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/CertifiedAuthorisedSignatory.cs @@ -0,0 +1,11 @@ +namespace Checkout.Accounts.Entities.Common.Documents +{ + public class CertifiedAuthorisedSignatory + { + public CertifiedAuthorisedSignatoryType? Type { get; set; } + + public string Front { get; set; } + + public string Back { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Common/Documents/CertifiedAuthorisedSignatoryType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/CertifiedAuthorisedSignatoryType.cs new file mode 100644 index 00000000..899174bf --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/CertifiedAuthorisedSignatoryType.cs @@ -0,0 +1,10 @@ +using System.Runtime.Serialization; + +namespace Checkout.Accounts.Entities.Common.Documents +{ + public enum CertifiedAuthorisedSignatoryType + { + [EnumMember(Value = "power_of_attorney")] + PowerOfAttorney + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/CompanyVerification.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/CompanyVerification.cs similarity index 75% rename from src/CheckoutSdk/Accounts/CompanyVerification.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/CompanyVerification.cs index 0a00828c..5fadfcc9 100644 --- a/src/CheckoutSdk/Accounts/CompanyVerification.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/CompanyVerification.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public class CompanyVerification { diff --git a/src/CheckoutSdk/Accounts/CompanyVerificationType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/CompanyVerificationType.cs similarity index 82% rename from src/CheckoutSdk/Accounts/CompanyVerificationType.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/CompanyVerificationType.cs index e5aa0ae6..305150a0 100644 --- a/src/CheckoutSdk/Accounts/CompanyVerificationType.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/CompanyVerificationType.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public enum CompanyVerificationType { diff --git a/src/CheckoutSdk/Accounts/OnboardSubEntityDocuments.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/Documents.cs similarity index 57% rename from src/CheckoutSdk/Accounts/OnboardSubEntityDocuments.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/Documents.cs index bfd75759..21c43c3d 100644 --- a/src/CheckoutSdk/Accounts/OnboardSubEntityDocuments.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/Documents.cs @@ -1,17 +1,19 @@ -namespace Checkout.Accounts +using Checkout.Accounts.Entities.Common.Company; + +namespace Checkout.Accounts.Entities.Common.Documents { - public class OnboardSubEntityDocuments + public class Documents { - public Document IdentityVerification { get; set; } - - public CompanyVerification CompanyVerification { get; set; } - - public ArticlesOfAssociationType? ArticlesOfAssociation { get; set; } + // Common - public BankVerification BankVerification { get; set; } + public ArticlesOfAssociation ArticlesOfAssociation { get; set; } public ShareholderStructure ShareholderStructure { get; set; } + public CompanyVerification CompanyVerification { get; set; } + + public BankVerification BankVerification { get; set; } + public ProofOfLegality ProofOfLegality { get; set; } public ProofOfPrincipalAddress ProofOfPrincipalAddress { get; set; } @@ -22,8 +24,18 @@ public class OnboardSubEntityDocuments public AdditionalDocument AdditionalDocument3 { get; set; } + public IdentityVerification IdentityVerification { get; set; } + + // GB Company Full (3.0) Representatives + + public CertifiedAuthorisedSignatory CertifiedAuthorisedSignatory { get; set; } + + // US Company Full (3.0) Representatives + public TaxVerification TaxVerification { get; set; } + // Unknown + public FinancialVerification FinancialVerification { get; set; } } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/FinancialVerification.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/FinancialVerification.cs similarity index 74% rename from src/CheckoutSdk/Accounts/FinancialVerification.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/FinancialVerification.cs index 0bdeb544..76a71601 100644 --- a/src/CheckoutSdk/Accounts/FinancialVerification.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/FinancialVerification.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public class FinancialVerification { diff --git a/src/CheckoutSdk/Accounts/FinancialVerificationType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/FinancialVerificationType.cs similarity index 76% rename from src/CheckoutSdk/Accounts/FinancialVerificationType.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/FinancialVerificationType.cs index b505ca7b..f54b7707 100644 --- a/src/CheckoutSdk/Accounts/FinancialVerificationType.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/FinancialVerificationType.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public enum FinancialVerificationType { diff --git a/src/CheckoutSdk/Accounts/Entities/Common/Documents/IdentityVerification.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/IdentityVerification.cs new file mode 100644 index 00000000..cdba093b --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/IdentityVerification.cs @@ -0,0 +1,11 @@ +namespace Checkout.Accounts.Entities.Common.Documents +{ + public class IdentityVerification + { + public IdentityVerificationType? Type { get; set; } + + public string Front { get; set; } + + public string Back { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Common/Documents/IdentityVerificationType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/IdentityVerificationType.cs new file mode 100644 index 00000000..81f72ab4 --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/IdentityVerificationType.cs @@ -0,0 +1,25 @@ +using System.Runtime.Serialization; + +namespace Checkout.Accounts.Entities.Common.Documents +{ + public enum IdentityVerificationType + { + [EnumMember(Value = "passport")] + Passport, + + [EnumMember(Value = "national_identity_card")] + NationalIdentityCard, + + [EnumMember(Value = "driving_license")] + DrivingLicense, + + [EnumMember(Value = "citizen_card")] + CitizenCard, + + [EnumMember(Value = "residence_permit")] + ResidencePermit, + + [EnumMember(Value = "electoral_id")] + ElectoralId, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/ProofOfLegality.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfLegality.cs similarity index 73% rename from src/CheckoutSdk/Accounts/ProofOfLegality.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfLegality.cs index 20b792ea..86878b91 100644 --- a/src/CheckoutSdk/Accounts/ProofOfLegality.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfLegality.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public class ProofOfLegality { diff --git a/src/CheckoutSdk/Accounts/ProofOfLegalityType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfLegalityType.cs similarity index 75% rename from src/CheckoutSdk/Accounts/ProofOfLegalityType.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfLegalityType.cs index 2082f383..4ca172d2 100644 --- a/src/CheckoutSdk/Accounts/ProofOfLegalityType.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfLegalityType.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public enum ProofOfLegalityType { diff --git a/src/CheckoutSdk/Accounts/ProofOfPrincipalAddress.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfPrincipalAddress.cs similarity index 75% rename from src/CheckoutSdk/Accounts/ProofOfPrincipalAddress.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfPrincipalAddress.cs index 913f683c..2e62b4ec 100644 --- a/src/CheckoutSdk/Accounts/ProofOfPrincipalAddress.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfPrincipalAddress.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public class ProofOfPrincipalAddress { diff --git a/src/CheckoutSdk/Accounts/ProofOfPrincipalAddressType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfPrincipalAddressType.cs similarity index 75% rename from src/CheckoutSdk/Accounts/ProofOfPrincipalAddressType.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfPrincipalAddressType.cs index 078026d3..27e3c154 100644 --- a/src/CheckoutSdk/Accounts/ProofOfPrincipalAddressType.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ProofOfPrincipalAddressType.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public enum ProofOfPrincipalAddressType { diff --git a/src/CheckoutSdk/Accounts/ShareholderStructure.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ShareholderStructure.cs similarity index 74% rename from src/CheckoutSdk/Accounts/ShareholderStructure.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/ShareholderStructure.cs index 34726e3f..5da5e35b 100644 --- a/src/CheckoutSdk/Accounts/ShareholderStructure.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ShareholderStructure.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public class ShareholderStructure { diff --git a/src/CheckoutSdk/Accounts/ShareholderStructureType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ShareholderStructureType.cs similarity index 78% rename from src/CheckoutSdk/Accounts/ShareholderStructureType.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/ShareholderStructureType.cs index 55743aee..d3355735 100644 --- a/src/CheckoutSdk/Accounts/ShareholderStructureType.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/ShareholderStructureType.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public enum ShareholderStructureType { diff --git a/src/CheckoutSdk/Accounts/TaxVerification.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/TaxVerification.cs similarity index 74% rename from src/CheckoutSdk/Accounts/TaxVerification.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/TaxVerification.cs index 3a282e97..6953bbb8 100644 --- a/src/CheckoutSdk/Accounts/TaxVerification.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/TaxVerification.cs @@ -1,4 +1,4 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public class TaxVerification { diff --git a/src/CheckoutSdk/Accounts/TaxVerificationType.cs b/src/CheckoutSdk/Accounts/Entities/Common/Documents/TaxVerificationType.cs similarity index 72% rename from src/CheckoutSdk/Accounts/TaxVerificationType.cs rename to src/CheckoutSdk/Accounts/Entities/Common/Documents/TaxVerificationType.cs index e554d465..ba813a3e 100644 --- a/src/CheckoutSdk/Accounts/TaxVerificationType.cs +++ b/src/CheckoutSdk/Accounts/Entities/Common/Documents/TaxVerificationType.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Common.Documents { public enum TaxVerificationType { diff --git a/src/CheckoutSdk/Accounts/OnboardEntityRequest.cs b/src/CheckoutSdk/Accounts/Entities/Request/OnboardEntityRequest.cs similarity index 56% rename from src/CheckoutSdk/Accounts/OnboardEntityRequest.cs rename to src/CheckoutSdk/Accounts/Entities/Request/OnboardEntityRequest.cs index 198f5da3..4985dba0 100644 --- a/src/CheckoutSdk/Accounts/OnboardEntityRequest.cs +++ b/src/CheckoutSdk/Accounts/Entities/Request/OnboardEntityRequest.cs @@ -1,23 +1,31 @@ -namespace Checkout.Accounts +using Checkout.Accounts.Entities.Common; +using Checkout.Accounts.Entities.Common.Company; +using Checkout.Accounts.Entities.Common.ContactDetails; +using Checkout.Accounts.Entities.Common.Documents; + +namespace Checkout.Accounts.Entities.Request { public class OnboardEntityRequest { public string Reference { get; set; } - public bool IsDraft { get; set; } + public Company Company { get; set; } public Profile Profile { get; set; } public ContactDetails ContactDetails { get; set; } - public Company Company { get; set; } + public Documents Documents { get; set; } public ProcessingDetails ProcessingDetails { get; set; } + public bool Draft { get; set; } + public bool IsDraft { get; set; } + public Individual Individual { get; set; } - - public OnboardSubEntityDocuments Documents { get; set; } - + + // Unknown + public AdditionalInfo AdditionalInfo { get; set; } } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Request/OnboardSubEntityRequest.cs b/src/CheckoutSdk/Accounts/Entities/Request/OnboardSubEntityRequest.cs new file mode 100644 index 00000000..a6659aad --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Request/OnboardSubEntityRequest.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Checkout.Accounts.Entities.Request +{ + public class OnboardSubEntityRequest + { + public IDictionary Request { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/ProcessingDetails.cs b/src/CheckoutSdk/Accounts/Entities/Request/ProcessingDetails.cs similarity index 91% rename from src/CheckoutSdk/Accounts/ProcessingDetails.cs rename to src/CheckoutSdk/Accounts/Entities/Request/ProcessingDetails.cs index 86fb9858..351b4531 100644 --- a/src/CheckoutSdk/Accounts/ProcessingDetails.cs +++ b/src/CheckoutSdk/Accounts/Entities/Request/ProcessingDetails.cs @@ -1,7 +1,7 @@ using Checkout.Common; using System.Collections.Generic; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Request { public class ProcessingDetails { diff --git a/src/CheckoutSdk/Accounts/OnboardEntityDetailsResponse.cs b/src/CheckoutSdk/Accounts/Entities/Response/OnboardEntityDetailsResponse.cs similarity index 77% rename from src/CheckoutSdk/Accounts/OnboardEntityDetailsResponse.cs rename to src/CheckoutSdk/Accounts/Entities/Response/OnboardEntityDetailsResponse.cs index 1347abfd..b9574843 100644 --- a/src/CheckoutSdk/Accounts/OnboardEntityDetailsResponse.cs +++ b/src/CheckoutSdk/Accounts/Entities/Response/OnboardEntityDetailsResponse.cs @@ -1,9 +1,10 @@ -using Checkout.Accounts.Regional; +using Checkout.Accounts.Entities.Common; +using Checkout.Accounts.Entities.Common.Company; +using Checkout.Accounts.Entities.Common.ContactDetails; using Checkout.Common; -using Newtonsoft.Json; using System.Collections.Generic; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Response { public class OnboardEntityDetailsResponse : Resource { diff --git a/src/CheckoutSdk/Accounts/OnboardEntityResponse.cs b/src/CheckoutSdk/Accounts/Entities/Response/OnboardEntityResponse.cs similarity index 71% rename from src/CheckoutSdk/Accounts/OnboardEntityResponse.cs rename to src/CheckoutSdk/Accounts/Entities/Response/OnboardEntityResponse.cs index bfd81ff6..3ae6ac78 100644 --- a/src/CheckoutSdk/Accounts/OnboardEntityResponse.cs +++ b/src/CheckoutSdk/Accounts/Entities/Response/OnboardEntityResponse.cs @@ -1,18 +1,23 @@ using Checkout.Common; using System.Collections.Generic; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Response { public class OnboardEntityResponse : Resource { + // Common public string Id { get; set; } - public string Reference { get; set; } - - public OnboardingStatus? Status { get; set; } - public Capabilities Capabilities { get; set; } - public IList RequirementsDue { get; set; } + + // Company Platform (2.0) + + public Capabilities Capabilities { get; set; } + + // Unknown + + public OnboardingStatus? Status { get; set; } + } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Response/OnboardSubEntityDetailsResponse.cs b/src/CheckoutSdk/Accounts/Entities/Response/OnboardSubEntityDetailsResponse.cs new file mode 100644 index 00000000..cd123dec --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Response/OnboardSubEntityDetailsResponse.cs @@ -0,0 +1,10 @@ +using Checkout.Common; +using System.Collections.Generic; + +namespace Checkout.Accounts.Entities.Response +{ + public class OnboardSubEntityDetailsResponse : Resource + { + public IList Data { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Response/OnboardSubEntityResponse.cs b/src/CheckoutSdk/Accounts/Entities/Response/OnboardSubEntityResponse.cs new file mode 100644 index 00000000..27e3bb0c --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Response/OnboardSubEntityResponse.cs @@ -0,0 +1,11 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Checkout.Accounts.Entities.Response +{ + public class OnboardSubEntityResponse : HttpMetadata + { + [JsonExtensionData] + public IDictionary Response { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/OnboardingStatus.cs b/src/CheckoutSdk/Accounts/Entities/Response/OnboardingStatus.cs similarity index 90% rename from src/CheckoutSdk/Accounts/OnboardingStatus.cs rename to src/CheckoutSdk/Accounts/Entities/Response/OnboardingStatus.cs index 653bbffb..ba156a81 100644 --- a/src/CheckoutSdk/Accounts/OnboardingStatus.cs +++ b/src/CheckoutSdk/Accounts/Entities/Response/OnboardingStatus.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Response { public enum OnboardingStatus { diff --git a/src/CheckoutSdk/Accounts/RequirementsDue.cs b/src/CheckoutSdk/Accounts/Entities/Response/RequirementsDue.cs similarity index 56% rename from src/CheckoutSdk/Accounts/RequirementsDue.cs rename to src/CheckoutSdk/Accounts/Entities/Response/RequirementsDue.cs index a8bb7162..83ee3da0 100644 --- a/src/CheckoutSdk/Accounts/RequirementsDue.cs +++ b/src/CheckoutSdk/Accounts/Entities/Response/RequirementsDue.cs @@ -1,9 +1,11 @@ -namespace Checkout.Accounts +namespace Checkout.Accounts.Entities.Response { public class RequirementsDue { public string Field { get; set; } public string Reason { get; set; } + + public string Message { get; set; } } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Response/SubEntityMemberData.cs b/src/CheckoutSdk/Accounts/Entities/Response/SubEntityMemberData.cs new file mode 100644 index 00000000..227b0ddf --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Response/SubEntityMemberData.cs @@ -0,0 +1,7 @@ +namespace Checkout.Accounts.Entities.Response +{ + public class SubEntityMemberData + { + public string UserId { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Entities/Response/UploadFileResponse.cs b/src/CheckoutSdk/Accounts/Entities/Response/UploadFileResponse.cs new file mode 100644 index 00000000..22dbc5ad --- /dev/null +++ b/src/CheckoutSdk/Accounts/Entities/Response/UploadFileResponse.cs @@ -0,0 +1,14 @@ +using Checkout.Common; +using System.Collections.Generic; + +namespace Checkout.Accounts.Entities.Response +{ + public class UploadFileResponse : Resource + { + public string Id { get; set; } + + public long MaximumSizeInBytes { get; set; } + + public IList DocumentTypesForPurpose { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/EntityEmailAddresses.cs b/src/CheckoutSdk/Accounts/EntityEmailAddresses.cs deleted file mode 100644 index a2f7ec8e..00000000 --- a/src/CheckoutSdk/Accounts/EntityEmailAddresses.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Checkout.Accounts -{ - public class EntityEmailAddresses - { - public string Primary { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/IAccountsClient.cs b/src/CheckoutSdk/Accounts/IAccountsClient.cs index e2058814..5a013f7e 100644 --- a/src/CheckoutSdk/Accounts/IAccountsClient.cs +++ b/src/CheckoutSdk/Accounts/IAccountsClient.cs @@ -1,7 +1,9 @@ -using Checkout.Accounts.Payout.Request; +using Checkout.Accounts.Entities.Request; +using Checkout.Accounts.Entities.Response; +using Checkout.Accounts.Payout.Request; using Checkout.Accounts.Payout.Response; -using Checkout.Accounts.Regional.US; using Checkout.Common; +using Checkout.Files; using System; using System.Threading; using System.Threading.Tasks; @@ -9,18 +11,19 @@ namespace Checkout.Accounts { public interface IAccountsClient - { - Task SubmitFile( - AccountsFileRequest accountsFileRequest, - CancellationToken cancellationToken = default); - + { Task CreateEntity( OnboardEntityRequest entityRequest, CancellationToken cancellationToken = default); - - Task RetrievePaymentInstrumentDetails( + + Task GetSubEntityMembers( string entityId, - string paymentInstrumentId, + CancellationToken cancellationToken = default); + + Task ReinviteSubEntityMember( + string entityId, + string userId, + OnboardSubEntityRequest subEntityRequest, CancellationToken cancellationToken = default); Task GetEntity( @@ -42,6 +45,11 @@ Task CreatePaymentInstrument( string entityId, PaymentInstrumentRequest paymentInstrumentRequest, CancellationToken cancellationToken = default); + + Task RetrievePaymentInstrumentDetails( + string entityId, + string paymentInstrumentId, + CancellationToken cancellationToken = default); Task UpdatePaymentInstrument( string entityId, @@ -63,5 +71,19 @@ Task UpdatePayoutSchedule( Currency currency, UpdateScheduleRequest updateScheduleRequest, CancellationToken cancellationToken = default); + + Task SubmitFile( + AccountsFileRequest accountsFileRequest, + CancellationToken cancellationToken = default); + + Task UploadFile( + string entityId, + AccountsFileRequest accountsFileRequest, + CancellationToken cancellationToken = default); + + Task RetrieveFile( + string entityId, + string fileId, + CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Identification.cs b/src/CheckoutSdk/Accounts/Identification.cs deleted file mode 100644 index 42efd6fe..00000000 --- a/src/CheckoutSdk/Accounts/Identification.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Checkout.Accounts -{ - public class Identification - { - public string NationalIdNumber { get; set; } - - public Document Document { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Regional/CompanyTypeConverter.cs b/src/CheckoutSdk/Accounts/Regional/CompanyTypeConverter.cs deleted file mode 100644 index d3dca35a..00000000 --- a/src/CheckoutSdk/Accounts/Regional/CompanyTypeConverter.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Checkout.Accounts.Regional.US; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.Reflection; - -namespace Checkout.Accounts.Regional -{ - public class CompanyTypeConverter : JsonConverter - { - public override bool CanWrite => false; - - public override bool CanConvert(Type objectType) - { - return typeof(OnboardEntityDetailsResponse).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); - } - - public override void WriteJson( - JsonWriter writer, - object value, - Newtonsoft.Json.JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override object ReadJson( - JsonReader reader, - Type objectType, - object existingValue, - Newtonsoft.Json.JsonSerializer serializer) - { - - if (reader.TokenType == JsonToken.Null) - return null; - - var jObject = JToken.Load(reader); - if (jObject.Type == JTokenType.Object) - { - var businessTypeToken = jObject["company"]?["business_type"]; - if (businessTypeToken != null && businessTypeToken.Type == JTokenType.String ) - { - var enumString = businessTypeToken.Value(); - - var businessType = CheckoutUtils.GetEnumFromStringMemberValue(enumString); - if (businessType != null) - { - var target = new OnboardEntityDetailsResponse(); - serializer.Populate(jObject.CreateReader(), target); - return target; - } - - var usBusinessType = CheckoutUtils.GetEnumFromStringMemberValue(enumString); - if (usBusinessType != null) - { - var target = new OnboardEntityDetailsUSCompanyResponse(); - serializer.Populate(jObject.CreateReader(), target); - return target; - } - } - else - { - var target = new OnboardEntityDetailsResponse(); - serializer.Populate(jObject.CreateReader(), target); - return target; - } - } - - throw new JsonSerializationException($"Unexpected token or value when parsing enum. Token: {reader.TokenType}, Value: {jObject}"); - } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Regional/US/OnboardEntityDetailsUSCompanyResponse.cs b/src/CheckoutSdk/Accounts/Regional/US/OnboardEntityDetailsUSCompanyResponse.cs deleted file mode 100644 index 05bc7c8f..00000000 --- a/src/CheckoutSdk/Accounts/Regional/US/OnboardEntityDetailsUSCompanyResponse.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Checkout.Accounts.Regional.US -{ - public class OnboardEntityDetailsUSCompanyResponse : OnboardEntityDetailsResponse - { - public new USCompany Company { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Regional/US/USBusinessType.cs b/src/CheckoutSdk/Accounts/Regional/US/USBusinessType.cs deleted file mode 100644 index 5a49733c..00000000 --- a/src/CheckoutSdk/Accounts/Regional/US/USBusinessType.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Runtime.Serialization; - -namespace Checkout.Accounts.Regional.US -{ - public enum USBusinessType - { - [EnumMember(Value = "private_corporation")] PrivateCorporation, - [EnumMember(Value = "publicly_traded_corporation")] PubliclyTradedCorporation, - [EnumMember(Value = "government_agency")] GovernmentAgency, - [EnumMember(Value = "individual_or_sole_proprietorship")] IndividualOrSoleProprietorship, - [EnumMember(Value = "limited_liability_corporation")] LimitedLiabilityCorporation, - [EnumMember(Value = "limited_partnership")] LimitedPartnership, - [EnumMember(Value = "non_profit_entity")] NonProfitEntity, - [EnumMember(Value = "sec_registered_entity")] SecRegisteredEntity, - [EnumMember(Value = "cftc_registered_entity")] CftcRegisteredEntity, - [EnumMember(Value = "regulated_financial_institution")] RegulatedFinancialInstitution, - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Regional/US/USCompany.cs b/src/CheckoutSdk/Accounts/Regional/US/USCompany.cs deleted file mode 100644 index df05bad2..00000000 --- a/src/CheckoutSdk/Accounts/Regional/US/USCompany.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Newtonsoft.Json; - -namespace Checkout.Accounts.Regional.US -{ - public class USCompany : Company - { - public new USBusinessType? BusinessType { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Accounts/Representative.cs b/src/CheckoutSdk/Accounts/Representative.cs deleted file mode 100644 index 8695d651..00000000 --- a/src/CheckoutSdk/Accounts/Representative.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Checkout.Common; -using System.Collections.Generic; - -namespace Checkout.Accounts -{ - public class Representative - { - public string Id { get; set; } - - public string FirstName { get; set; } - - public string LastName { get; set; } - - public Address Address { get; set; } - - public Identification Identification { get; set; } - - public AccountPhone Phone { get; set; } - - public DateOfBirth DateOfBirth { get; set; } - - public PlaceOfBirth PlaceOfBirth { get; set; } - - public IList Roles { get; set; } - - public OnboardSubEntityDocuments Documents { get; set; } - } -} \ No newline at end of file diff --git a/src/CheckoutSdk/Common/Resource.cs b/src/CheckoutSdk/Common/Resource.cs index 69c0530c..d824460d 100644 --- a/src/CheckoutSdk/Common/Resource.cs +++ b/src/CheckoutSdk/Common/Resource.cs @@ -17,7 +17,12 @@ public Link GetSelfLink() { return GetLink("self"); } - + + public Link GetUploadLink() + { + return GetLink("upload"); + } + public bool HasLink(string relation) { return Links.ContainsKey(relation); diff --git a/src/CheckoutSdk/Files/FileDetailsResponse.cs b/src/CheckoutSdk/Files/FileDetailsResponse.cs index 5881b6ce..8220157d 100644 --- a/src/CheckoutSdk/Files/FileDetailsResponse.cs +++ b/src/CheckoutSdk/Files/FileDetailsResponse.cs @@ -1,18 +1,25 @@ using Checkout.Common; using System; +using System.Collections.Generic; namespace Checkout.Files { public class FileDetailsResponse : Resource { public string Id { get; set; } + + public string Status { get; set; } + + public IList StatusReasons { get; set; } + public string Size { get; set; } + + public string MimeType { get; set; } + + public DateTime? UploadedOn { get; set; } + public string Filename { get; set; } public string Purpose { get; set; } - - public string Size { get; set; } - - public DateTime? UploadedOn { get; set; } } } \ No newline at end of file diff --git a/src/CheckoutSdk/JsonSerializer.cs b/src/CheckoutSdk/JsonSerializer.cs index a730b0fc..693f419f 100644 --- a/src/CheckoutSdk/JsonSerializer.cs +++ b/src/CheckoutSdk/JsonSerializer.cs @@ -1,5 +1,4 @@ using Checkout.Accounts.Payout.Response.Util; -using Checkout.Accounts.Regional; using Checkout.Instruments.Create.Util; using Checkout.Instruments.Get.Util; using Checkout.Instruments.Update.Util; @@ -51,7 +50,6 @@ private static JsonSerializerSettings CreateSerializerSettings(Action + x.Get( + "accounts/entities/entity_id/members", + It.IsAny(), + It.IsAny())) + .ReturnsAsync(responseObject); + + var response = await _accountsClient.GetSubEntityMembers("entity_id"); + + response.ShouldNotBeNull(); + response.ShouldBe(responseObject); + } + + [Fact] + private async Task ShouldReinviteSubEntityMember() + { + var request = new OnboardSubEntityRequest(); + var responseObject = new OnboardSubEntityResponse + { + Response = new Dictionary + { + { "custom_field_1", "value_1" }, + { "custom_field_2", 12345 } + } + }; + + _apiClient + .Setup(x => + x.Put( + "accounts/entities/entity_id/members/user_id", + It.IsAny(), + It.IsAny(), + It.IsAny(), + null)) + .ReturnsAsync(responseObject); + + var response = await _accountsClient.ReinviteSubEntityMember( + "entity_id", + "user_id", + request); + + response.ShouldNotBeNull(); + response.Response.ShouldNotBeNull(); + response.Response.ContainsKey("custom_field_1").ShouldBeTrue(); + response.Response["custom_field_1"].ShouldBe("value_1"); + response.Response.ContainsKey("custom_field_2").ShouldBeTrue(); + response.Response["custom_field_2"].ShouldBe(12345); + } [Fact] private async Task ShouldGetEntity() @@ -73,7 +132,7 @@ private async Task ShouldUpdateEntity() var request = new OnboardEntityRequest { Reference = "123", - ContactDetails = new ContactDetails {Phone = new AccountPhone()}, + ContactDetails = new ContactDetails {Phone = new Phone()}, Profile = new Profile(), Company = new Company { @@ -91,20 +150,19 @@ private async Task ShouldUpdateEntity() FirstName = "first", LastName = "last", Address = new Address(), - Identification = new Identification(), - Phone = new AccountPhone(), + Phone = new Phone(), DateOfBirth = new DateOfBirth {Day = 1, Month = 1, Year = 2000}, PlaceOfBirth = new PlaceOfBirth {Country = CountryCode.AF}, Roles = new List {EntityRoles.Ubo} } }, Document = new EntityDocument(), - FinancialDetails = new EntityFinancialDetails + FinancialDetails = new FinancialDetails { AnnualProcessingVolume = 1, AverageTransactionValue = 1, HighestTransactionValue = 1, - Documents = new EntityFinancialDocuments + Documents = new FinancialDocuments { BankStatement = new EntityDocument(), FinancialStatement = new EntityDocument() @@ -140,12 +198,12 @@ private async Task ShouldUpdateEntityUsCompany() var request = new OnboardEntityRequest { Reference = "123", - ContactDetails = new ContactDetails {Phone = new AccountPhone()}, + ContactDetails = new ContactDetails {Phone = new Phone()}, Profile = new Profile(), - Company = new USCompany + Company = new Company { BusinessRegistrationNumber = "123", - BusinessType = USBusinessType.PrivateCorporation, + BusinessType = BusinessType.PrivateCorporation, LegalName = "LEGAL", TradingName = "TRADING", PrincipalAddress = new Address(), @@ -158,20 +216,19 @@ private async Task ShouldUpdateEntityUsCompany() FirstName = "first", LastName = "last", Address = new Address(), - Identification = new Identification(), - Phone = new AccountPhone(), + Phone = new Phone(), DateOfBirth = new DateOfBirth {Day = 1, Month = 1, Year = 2000}, PlaceOfBirth = new PlaceOfBirth {Country = CountryCode.AF}, Roles = new List {EntityRoles.Ubo} } }, Document = new EntityDocument(), - FinancialDetails = new EntityFinancialDetails + FinancialDetails = new FinancialDetails { AnnualProcessingVolume = 1, AverageTransactionValue = 1, HighestTransactionValue = 1, - Documents = new EntityFinancialDocuments + Documents = new FinancialDocuments { BankStatement = new EntityDocument(), FinancialStatement = new EntityDocument() @@ -200,7 +257,26 @@ private async Task ShouldUpdateEntityUsCompany() response.Reference.ShouldBe(responseObject.Reference); } + + [Fact] + private async Task ShouldRetrievePaymentInstrumentDetails() + { + var responseAsync = new PaymentInstrumentDetailsResponse(); + _apiClient + .Setup(x => + x.Get( + "accounts/entities/entity_id/payment-instruments/instrument_id", + It.IsAny(), + It.IsAny())) + .ReturnsAsync(responseAsync); + + var response = await _accountsClient.RetrievePaymentInstrumentDetails( + "entity_id", "instrument_id"); + + response.ShouldNotBeNull(); + } + [Fact] private async Task ShouldCreatePaymentInstrumentDeprecated() { @@ -227,7 +303,7 @@ private async Task ShouldCreatePaymentInstrumentDeprecated() CountryOfBirth = CountryCode.AC, ResidentialStatus = "status", BillingAddress = new Address(), - Phone = new AccountPhone(), + Phone = new Phone(), Identification = new AccountHolderIdentification(), Email = "account@checkout.com", FirstName = "First", @@ -237,94 +313,23 @@ private async Task ShouldCreatePaymentInstrumentDeprecated() response.ShouldNotBeNull(); } - - [Fact] - private async Task ShouldSubmitFile() - { - //Arrange - var responseObject = new IdResponse {Id = "Id"}; - - _apiFilesClient - .Setup(x => - x.Post( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - null - ) - ) - .ReturnsAsync(responseObject); - - var response = - await _accountsClient.SubmitFile(new AccountsFileRequest - { - File = "./Resources/checkout.jpeg", - ContentType = null, - Purpose = AccountsFilePurpose.Identification - }); - - response.ShouldNotBeNull(); - response.ShouldBe(responseObject); - } - + [Fact] - private async Task ShouldUpdatePayoutSchedule() + private async Task ShouldCreatePaymentInstrumentDeprecatedWithEmptyResponse() { - var responseAsync = new EmptyResponse(); + var request = new AccountsPaymentInstrument(); _apiClient .Setup(x => - x.Put( - "accounts/entities/entity_id/payout-schedules", + x.Post( + "accounts/entities/entity_id/instruments", It.IsAny(), It.IsAny(), It.IsAny(), - null - ) - ) - .ReturnsAsync(responseAsync); + null)) + .ReturnsAsync(new EmptyResponse()); - var response = - await _accountsClient.UpdatePayoutSchedule("entity_id", Currency.AED, new UpdateScheduleRequest()); - - response.ShouldNotBeNull(); - } - - [Fact] - private async Task ShouldRetrievePayoutSchedule() - { - var responseAsync = new GetScheduleResponse(); - - _apiClient - .Setup(x => - x.Get( - "accounts/entities/entity_id/payout-schedules", - It.IsAny(), - It.IsAny())) - .ReturnsAsync(responseAsync); - - var response = await _accountsClient.RetrievePayoutSchedule( - "entity_id"); - - response.ShouldNotBeNull(); - } - - [Fact] - private async Task ShouldRetrievePaymentInstrumentDetails() - { - var responseAsync = new PaymentInstrumentDetailsResponse(); - - _apiClient - .Setup(x => - x.Get( - "accounts/entities/entity_id/payment-instruments/instrument_id", - It.IsAny(), - It.IsAny())) - .ReturnsAsync(responseAsync); - - var response = await _accountsClient.RetrievePaymentInstrumentDetails( - "entity_id", "instrument_id"); + var response = await _accountsClient.CreatePaymentInstrument("entity_id", request); response.ShouldNotBeNull(); } @@ -416,5 +421,118 @@ private async Task ShouldQueryPaymentInstruments() response.ShouldNotBeNull(); } + + [Fact] + private async Task ShouldUpdatePayoutSchedule() + { + var responseAsync = new EmptyResponse(); + + _apiClient + .Setup(x => + x.Put( + "accounts/entities/entity_id/payout-schedules", + It.IsAny(), + It.IsAny(), + It.IsAny(), + null + ) + ) + .ReturnsAsync(responseAsync); + + var response = + await _accountsClient.UpdatePayoutSchedule("entity_id", Currency.AED, new UpdateScheduleRequest()); + + response.ShouldNotBeNull(); + } + + [Fact] + private async Task ShouldRetrievePayoutSchedule() + { + var responseAsync = new GetScheduleResponse(); + + _apiClient + .Setup(x => + x.Get( + "accounts/entities/entity_id/payout-schedules", + It.IsAny(), + It.IsAny())) + .ReturnsAsync(responseAsync); + + var response = await _accountsClient.RetrievePayoutSchedule( + "entity_id"); + + response.ShouldNotBeNull(); + } + + [Fact] + private async Task ShouldSubmitFile() + { + //Arrange + var responseObject = new IdResponse {Id = "Id"}; + + _apiFilesClient + .Setup(x => + x.Post( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + null + ) + ) + .ReturnsAsync(responseObject); + + var response = + await _accountsClient.SubmitFile(new AccountsFileRequest + { + File = "./Resources/checkout.jpeg", + ContentType = null, + Purpose = AccountsFilePurpose.Identification + }); + + response.ShouldNotBeNull(); + response.ShouldBe(responseObject); + } + + [Fact] + private async Task ShouldUploadFile() + { + var request = new AccountsFileRequest(); + var responseObject = new UploadFileResponse { Id = "file_id" }; + + _apiClient + .Setup(x => + x.Post( + "accounts/entity_id/files", + It.IsAny(), + It.IsAny(), + It.IsAny(), + null)) + .ReturnsAsync(responseObject); + + var response = await _accountsClient.UploadFile("entity_id", request); + + response.ShouldNotBeNull(); + response.ShouldBe(responseObject); + } + + [Fact] + private async Task ShouldRetrieveFile() + { + var responseObject = new FileDetailsResponse { Id = "file_id" }; + + _apiClient + .Setup(x => + x.Get( + "accounts/entity_id/files/file_id", + It.IsAny(), + It.IsAny())) + .ReturnsAsync(responseObject); + + var response = await _accountsClient.RetrieveFile("entity_id", "file_id"); + + response.ShouldNotBeNull(); + response.ShouldBe(responseObject); + } } } \ No newline at end of file diff --git a/test/CheckoutSdkTest/Accounts/AccountsIntegrationTest.cs b/test/CheckoutSdkTest/Accounts/AccountsIntegrationTest.cs index e2cbf64b..c5031163 100644 --- a/test/CheckoutSdkTest/Accounts/AccountsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Accounts/AccountsIntegrationTest.cs @@ -1,4 +1,8 @@ -using Checkout.Accounts.Regional.US; +using Checkout.Accounts.Entities.Common.Company; +using Checkout.Accounts.Entities.Common.ContactDetails; +using Checkout.Accounts.Entities.Common.Documents; +using Checkout.Accounts.Entities.Request; +using Checkout.Accounts.Entities.Response; using Checkout.Common; using Checkout.Instruments; using Shouldly; @@ -7,6 +11,7 @@ using System.Linq; using System.Net; using System.Net.Mime; +using System.Reflection.Metadata; using System.Threading.Tasks; using Xunit; @@ -20,6 +25,87 @@ public AccountsIntegrationTest() : base(PlatformType.DefaultOAuth) { } + [Fact(Skip = "beta")] + public async Task ShouldCreateHostedOnboardingInvitationRequest() + { + string randomReference = RandomString(15); + var entityRequest = new OnboardEntityRequest + { + Reference = randomReference, + IsDraft = false, + ContactDetails = new ContactDetails { Invitee = new Invitee { Email = "admin@superhero1234.com" } } + }; + + var response = await DefaultApi.AccountsClient().CreateEntity(entityRequest); + + response.ShouldNotBeNull(); + response.Id.ShouldNotBeNullOrEmpty(); + response.Reference.ShouldBe(randomReference); + } + + [Fact] + public async Task ShouldCreateCompany() + { + string randomReference = RandomString(15); + var entityRequest = new OnboardEntityRequest + { + Reference = randomReference, + Draft = true, + Profile = + new Profile + { + Urls = new List { "http://example.com" }, + Mccs = new List { "4814" }, + HoldingCurrencies = new List { Currency.GBP } + }, + ContactDetails = + new ContactDetails + { + Phone = new Phone { CountryCode = "GI", Number = "656453654" }, + EmailAddresses = new EmailAddresses { Primary = null }, + Invitee = new Invitee { Email = null } + }, + Company = + new Company + { + LegalName = "string", + TradingName = "string", + BusinessRegistrationNumber = "AC123456", + DateOfIncorporation = new DateOfIncorporation { Day = 1, Month = 1, Year = 2001 }, + PrincipalAddress = GetAddress(), + RegisteredAddress = GetAddress(), + BusinessType = BusinessType.IndividualOrSoleProprietorship + }, + ProcessingDetails = + new ProcessingDetails + { + SettlementCountry = "GB", + TargetCountries = new List { "GB" }, + Currency = Currency.GBP + }, + Documents = new Documents + { + ArticlesOfAssociation = + new ArticlesOfAssociation() + { + Type = ArticlesOfAssociationType.ArticlesOfAssociation, + Front = "stringstringstringstringstrings" + }, + ShareholderStructure = new ShareholderStructure() + { + Type = ShareholderStructureType.CertifiedShareholderStructure, + Front = "stringstringstringstringstrings" + }, + } + }; + + var response = await DefaultApi.AccountsClient().CreateEntity(entityRequest); + + response.ShouldNotBeNull(); + response.Id.ShouldNotBeNullOrEmpty(); + response.Reference.ShouldBe(randomReference); + } + [Fact] public async Task ShouldCreateGetAndUpdateOnboardEntity() { @@ -129,15 +215,66 @@ public async Task ShouldThrowConflictWhenCreatingExistingEntity() entityId.ShouldNotBeNullOrEmpty(); entityResponse.Reference.ShouldBe(randomReference); - CheckoutApiException ex = await Assert.ThrowsAsync(() => + CheckoutApiException ex = await Assert.ThrowsAsync(() => DefaultApi.AccountsClient().CreateEntity(onboardEntityRequest)); - + ex.HttpStatusCode.ShouldBe(HttpStatusCode.Conflict); ex.ErrorDetails.ShouldNotBeNull(); Assert.True(ex.ErrorDetails.ContainsKey("id")); ex.ErrorDetails["id"].ShouldBe(entityId); } + [Fact(Skip = "unavailable")] + public async Task ShouldCreateEntityUploadAndRetrieveFile() + { + var entityRequest = new OnboardEntityRequest + { + Reference = RandomString(15), + Draft = true, + ContactDetails = + new ContactDetails + { + Phone = new Phone { CountryCode = "GI", Number = "123456789" }, + EmailAddresses = new EmailAddresses { Primary = "admin@example.com" } + }, + Profile = + new Profile + { + Urls = new List { "http://example.com" }, + Mccs = new List { "4814" }, + HoldingCurrencies = new List { Currency.GBP } + }, + Company = new Company + { + LegalName = "Test Company", + TradingName = "Test Trading", + BusinessRegistrationNumber = "AC123456", + DateOfIncorporation = new DateOfIncorporation { Day = 1, Month = 1, Year = 2020 }, + PrincipalAddress = GetAddress(), + RegisteredAddress = GetAddress(), + } + }; + + var entityResponse = await DefaultApi.AccountsClient().CreateEntity(entityRequest); + + entityResponse.ShouldNotBeNull(); + entityResponse.Id.ShouldNotBeNullOrEmpty(); + + var fileRequest = new AccountsFileRequest { Purpose = AccountsFilePurpose.IdentityVerification }; + + var uploadResponse = await DefaultApi.AccountsClient() + .UploadFile(entityResponse.Id, fileRequest); + + uploadResponse.ShouldNotBeNull(); + uploadResponse.Id.ShouldNotBeNullOrEmpty(); + + var retrievedFile = await DefaultApi.AccountsClient() + .RetrieveFile(entityResponse.Id, uploadResponse.Id); + + retrievedFile.ShouldNotBeNull(); + retrievedFile.Id.ShouldBe(uploadResponse.Id); + } + [Fact] private async Task ShouldUploadAccountsFile() { @@ -163,13 +300,7 @@ private async Task ShouldCreateAndRetrievePaymentInstrument() RegisteredAddress = GetAddress(), Representatives = new List { - new Representative - { - FirstName = "John", - LastName = "Doe", - Address = GetAddress(), - Identification = new Identification { NationalIdNumber = "AB123456C", } - } + new Representative { FirstName = "John", LastName = "Doe", Address = GetAddress(), } } } }; @@ -192,11 +323,13 @@ private async Task ShouldCreateAndRetrievePaymentInstrument() } }; - var instrumentResponse = await api.AccountsClient().CreatePaymentInstrument(entityResponse.Id, instrumentRequest); + var instrumentResponse = + await api.AccountsClient().CreatePaymentInstrument(entityResponse.Id, instrumentRequest); instrumentResponse.ShouldNotBeNull(); instrumentResponse.Id.ShouldNotBeNull(); - var instrumentDetails = await api.AccountsClient().RetrievePaymentInstrumentDetails(entityResponse.Id, instrumentResponse.Id); + var instrumentDetails = await api.AccountsClient() + .RetrievePaymentInstrumentDetails(entityResponse.Id, instrumentResponse.Id); instrumentDetails.ShouldNotBeNull(); instrumentDetails.Id.ShouldNotBeNull(); instrumentDetails.Status.ShouldNotBeNull(); @@ -210,10 +343,9 @@ private async Task ShouldCreateAndRetrievePaymentInstrument() queryResponse.ShouldNotBeNull(); queryResponse.Data.ShouldNotBeNull(); } - - + [Fact] - private async Task ShouldCreateAndRetrievePaymentInstrumentUSCompany() + private async Task ShouldCreateAndRetrievePaymentInstrumentCompany() { CheckoutApi api = GetAccountsCheckoutApi(); @@ -222,23 +354,17 @@ private async Task ShouldCreateAndRetrievePaymentInstrumentUSCompany() Reference = RandomString(15), ContactDetails = BuildContactDetails(), Profile = BuildProfile(), - Company = new USCompany() + Company = new Company() { BusinessRegistrationNumber = "01234567", - BusinessType = USBusinessType.PrivateCorporation, + BusinessType = BusinessType.PrivateCorporation, LegalName = "Super Hero Masks Inc.", TradingName = "Super Hero Masks", PrincipalAddress = GetAddress(), RegisteredAddress = GetAddress(), Representatives = new List { - new Representative - { - FirstName = "John", - LastName = "Doe", - Address = GetAddress(), - Identification = new Identification { NationalIdNumber = "AB123456C", } - } + new Representative { FirstName = "John", LastName = "Doe", Address = GetAddress(), } } } }; @@ -263,13 +389,15 @@ private async Task ShouldCreateAndRetrievePaymentInstrumentUSCompany() } }; - var instrumentResponse = await api.AccountsClient().CreatePaymentInstrument(entityResponse.Id, instrumentRequest); + var instrumentResponse = + await api.AccountsClient().CreatePaymentInstrument(entityResponse.Id, instrumentRequest); instrumentResponse.ShouldNotBeNull(); instrumentResponse.Id.ShouldNotBeNull(); - + entityDetailsResponse.ShouldNotBeNull(); - var instrumentDetails = await api.AccountsClient().RetrievePaymentInstrumentDetails(entityResponse.Id, instrumentResponse.Id); + var instrumentDetails = await api.AccountsClient() + .RetrievePaymentInstrumentDetails(entityResponse.Id, instrumentResponse.Id); instrumentDetails.ShouldNotBeNull(); instrumentDetails.Id.ShouldNotBeNull(); instrumentDetails.Status.ShouldNotBeNull(); @@ -283,9 +411,6 @@ private async Task ShouldCreateAndRetrievePaymentInstrumentUSCompany() queryResponse.ShouldNotBeNull(); queryResponse.Data.ShouldNotBeNull(); } - - - private static string RandomString(int length) { @@ -298,12 +423,11 @@ private static ContactDetails BuildContactDetails() { return new ContactDetails { - Phone = new AccountPhone { Number = "2345678910" }, - EmailAddresses = new EntityEmailAddresses { Primary = GenerateRandomEmail() } + Phone = new Phone { Number = "2345678910" }, + EmailAddresses = new EmailAddresses { Primary = GenerateRandomEmail() } }; } - private static Profile BuildProfile() { return new Profile diff --git a/test/CheckoutSdkTest/Customers/CustomersIntegrationTest.cs b/test/CheckoutSdkTest/Customers/CustomersIntegrationTest.cs index 69cc2fef..335ed1d4 100644 --- a/test/CheckoutSdkTest/Customers/CustomersIntegrationTest.cs +++ b/test/CheckoutSdkTest/Customers/CustomersIntegrationTest.cs @@ -19,7 +19,7 @@ private async Task ShouldCreateAndGetCustomer() { Email = GenerateRandomEmail(), Name = "Customer", - Phone = new Phone {CountryCode = "1", Number = "4155552671"} + Phone = new Phone {CountryCode = "+1", Number = "4155552671"} }; var customerResponse = await DefaultApi.CustomersClient().Create(request); customerResponse.ShouldNotBeNull(); diff --git a/test/CheckoutSdkTest/Customers/Previous/CustomersIntegrationTest.cs b/test/CheckoutSdkTest/Customers/Previous/CustomersIntegrationTest.cs index ddde267b..2decaed8 100644 --- a/test/CheckoutSdkTest/Customers/Previous/CustomersIntegrationTest.cs +++ b/test/CheckoutSdkTest/Customers/Previous/CustomersIntegrationTest.cs @@ -14,7 +14,7 @@ public CustomersIntegrationTest() : base(PlatformType.Previous) { } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldCreateAndGetCustomer() { var request = new CustomerRequest @@ -39,7 +39,7 @@ private async Task ShouldCreateAndGetCustomer() customerDetails.Instruments.ShouldBeEmpty(); } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldCreateAndUpdateCustomer() { //Create Customer @@ -68,7 +68,7 @@ private async Task ShouldCreateAndUpdateCustomer() customerDetails.Name.ShouldBe(request.Name); } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldCreateAndDeleteCustomer() { var request = new CustomerRequest @@ -92,7 +92,7 @@ private async Task ShouldCreateAndDeleteCustomer() await AssertNotFound(PreviousApi.CustomersClient().Get(customerId)); } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldGetCustomerDetailsWithInstrument() { var cardTokenResponse = await PreviousApi.TokensClient().Request(GetCardTokenRequest()); diff --git a/test/CheckoutSdkTest/Instruments/Previous/InstrumentsIntegrationTest.cs b/test/CheckoutSdkTest/Instruments/Previous/InstrumentsIntegrationTest.cs index 098e67f2..96990cdf 100644 --- a/test/CheckoutSdkTest/Instruments/Previous/InstrumentsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Instruments/Previous/InstrumentsIntegrationTest.cs @@ -12,7 +12,7 @@ public InstrumentsIntegrationTest() : base(PlatformType.Previous) { } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldCreateAndGetInstrument() { var createInstrumentResponse = await CreateTokenInstrument(); @@ -62,7 +62,7 @@ private async Task ShouldCreateAndGetInstrument() retrieveInstrumentResponse.Type.ShouldBe(InstrumentType.Card); } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldCreateAndUpdateInstrument() { var createInstrumentResponse = await CreateTokenInstrument(); @@ -87,7 +87,7 @@ private async Task ShouldCreateAndUpdateInstrument() retrieveInstrumentResponse.ExpiryYear.ShouldBe(2026); } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldCreateAndDeleteInstrument() { var createInstrumentResponse = await CreateTokenInstrument(); diff --git a/test/CheckoutSdkTest/JsonSerializerTest.cs b/test/CheckoutSdkTest/JsonSerializerTest.cs index d429bf1b..af01a5fe 100644 --- a/test/CheckoutSdkTest/JsonSerializerTest.cs +++ b/test/CheckoutSdkTest/JsonSerializerTest.cs @@ -1,5 +1,5 @@ -using Checkout.Accounts; -using Checkout.Accounts.Regional.US; +using Checkout.Accounts.Entities.Common.Company; +using Checkout.Accounts.Entities.Response; using Checkout.Financial; using Checkout.Issuing.Cards.Requests.Create; using Checkout.Issuing.Cards.Responses; @@ -140,17 +140,6 @@ public void ShouldSerializeOnBoardSubEntityCompanyFromJson() onboardEntityDetailsResponse.Company.BusinessType.ShouldBeOfType(); } - [Fact] - public void ShouldSerializeOnBoardSubEntityUSCompanyFromJson() - { - var fileContent = GetJsonFileContent("./Resources/OnBoardSubEntityUSCompanyResponse.json"); - OnboardEntityDetailsUSCompanyResponse onboardEntityDetailsResponse = - (OnboardEntityDetailsUSCompanyResponse)new JsonSerializer().Deserialize(fileContent, - typeof(OnboardEntityDetailsUSCompanyResponse)); - onboardEntityDetailsResponse.ShouldNotBeNull(); - onboardEntityDetailsResponse.Company.BusinessType.ShouldBeOfType(); - } - [Fact] public void ShouldSerializePaymentContextsPayPalDetailsResponseFromJson() { diff --git a/test/CheckoutSdkTest/Payments/Previous/Links/PaymentLinksIntegrationTest.cs b/test/CheckoutSdkTest/Payments/Previous/Links/PaymentLinksIntegrationTest.cs index fa9bfdd2..6d474d30 100644 --- a/test/CheckoutSdkTest/Payments/Previous/Links/PaymentLinksIntegrationTest.cs +++ b/test/CheckoutSdkTest/Payments/Previous/Links/PaymentLinksIntegrationTest.cs @@ -13,7 +13,7 @@ public PaymentLinksIntegrationTest() : base(PlatformType.Previous) { } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldCreatePaymentLink() { var address = new Address diff --git a/test/CheckoutSdkTest/Payments/Previous/RequestPaymentsIntegrationTest.cs b/test/CheckoutSdkTest/Payments/Previous/RequestPaymentsIntegrationTest.cs index 359ca0e7..a3b9b061 100644 --- a/test/CheckoutSdkTest/Payments/Previous/RequestPaymentsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Payments/Previous/RequestPaymentsIntegrationTest.cs @@ -238,7 +238,7 @@ private async Task ShouldMakeCard3dsPayment_N3d() paymentResponse.HasLink("void").ShouldBeTrue(); } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldTokenPayment() { var paymentResponse = await MakeTokenPayment(); diff --git a/test/CheckoutSdkTest/Tokens/Previous/TokensIntegrationTest.cs b/test/CheckoutSdkTest/Tokens/Previous/TokensIntegrationTest.cs index 1a2a1efb..2a8552c0 100644 --- a/test/CheckoutSdkTest/Tokens/Previous/TokensIntegrationTest.cs +++ b/test/CheckoutSdkTest/Tokens/Previous/TokensIntegrationTest.cs @@ -11,7 +11,7 @@ public TokensIntegrationTest() : base(PlatformType.Previous) { } - [Fact] + [Fact(Skip = "unavailable")] private async Task ShouldRequestCardToken() { var phone = new Phone {CountryCode = "44", Number = "020 222333"};