diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AbstractSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AbstractSource.cs new file mode 100644 index 00000000..85324792 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AbstractSource.cs @@ -0,0 +1,16 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source +{ + /// + /// Abstract source Class + /// The source of the payment + /// + public abstract class AbstractSource + { + public SourceType? Type; + + protected AbstractSource(SourceType type) + { + Type = type; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AfterpaySource/AfterpaySource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AfterpaySource/AfterpaySource.cs new file mode 100644 index 00000000..e2fd8733 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AfterpaySource/AfterpaySource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + AfterpaySource +{ + /// + /// afterpay source Class + /// The source of the payment + /// + public class AfterpaySource : AbstractSource + { + /// + /// Initializes a new instance of the AfterpaySource class. + /// + public AfterpaySource() : base(SourceType.Afterpay) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlipayCnSource/AlipayCnSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlipayCnSource/AlipayCnSource.cs new file mode 100644 index 00000000..8233f41d --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlipayCnSource/AlipayCnSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + AlipayCnSource +{ + /// + /// alipay_cn source Class + /// The source of the payment + /// + public class AlipayCnSource : AbstractSource + { + /// + /// Initializes a new instance of the AlipayCnSource class. + /// + public AlipayCnSource() : base(SourceType.AlipayCn) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlipayHkSource/AlipayHkSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlipayHkSource/AlipayHkSource.cs new file mode 100644 index 00000000..60539abd --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlipayHkSource/AlipayHkSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + AlipayHkSource +{ + /// + /// alipay_hk source Class + /// The source of the payment + /// + public class AlipayHkSource : AbstractSource + { + /// + /// Initializes a new instance of the AlipayHkSource class. + /// + public AlipayHkSource() : base(SourceType.AlipayHk) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlipayPlusSource/AlipayPlusSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlipayPlusSource/AlipayPlusSource.cs new file mode 100644 index 00000000..44c033ae --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlipayPlusSource/AlipayPlusSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + AlipayPlusSource +{ + /// + /// alipay_plus source Class + /// The source of the payment + /// + public class AlipayPlusSource : AbstractSource + { + /// + /// Initializes a new instance of the AlipayPlusSource class. + /// + public AlipayPlusSource() : base(SourceType.AlipayPlus) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlmaSource/AlmaSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlmaSource/AlmaSource.cs new file mode 100644 index 00000000..fd19a7fa --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/AlmaSource/AlmaSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + AlmaSource +{ + /// + /// alma source Class + /// The source of the payment + /// + public class AlmaSource : AbstractSource + { + /// + /// Initializes a new instance of the AlmaSource class. + /// + public AlmaSource() : base(SourceType.Alma) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/BancontactSource/BancontactSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/BancontactSource/BancontactSource.cs new file mode 100644 index 00000000..08f5ed44 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/BancontactSource/BancontactSource.cs @@ -0,0 +1,24 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + BancontactSource +{ + /// + /// bancontact source Class + /// The source of the payment + /// + public class BancontactSource : AbstractSource + { + /// + /// Initializes a new instance of the BancontactSource class. + /// + public BancontactSource() : base(SourceType.Bancontact) + { + } + + /// + /// The IBAN of the Consumer Bank account used for payment (if applicable). + /// [Optional] + /// <= 34 + /// + public string Iban { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/BenefitSource/BenefitSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/BenefitSource/BenefitSource.cs new file mode 100644 index 00000000..705b9d9a --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/BenefitSource/BenefitSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + BenefitSource +{ + /// + /// benefit source Class + /// The source of the payment + /// + public class BenefitSource : AbstractSource + { + /// + /// Initializes a new instance of the BenefitSource class. + /// + public BenefitSource() : base(SourceType.Benefit) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/AbstractAccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/AbstractAccountHolder.cs new file mode 100644 index 00000000..6fe2de3b --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/AbstractAccountHolder.cs @@ -0,0 +1,16 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder +{ + /// + /// Abstract account_holder Class + /// Information about the account holder of the card + /// + public abstract class AbstractAccountHolder + { + public AccountHolderType Type; + + protected AbstractAccountHolder(AccountHolderType type) + { + Type = type; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/AccountHolderType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/AccountHolderType.cs new file mode 100644 index 00000000..affa234c --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/AccountHolderType.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder +{ + public enum AccountHolderType + { + [EnumMember(Value = "individual")] + Individual, + + [EnumMember(Value = "corporate")] + Corporate, + + [EnumMember(Value = "government")] + Government, + + } +} diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/Common/AccountNameInquiryType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/Common/AccountNameInquiryType.cs new file mode 100644 index 00000000..f6d0ed69 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/Common/AccountNameInquiryType.cs @@ -0,0 +1,23 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder.Common +{ + public enum AccountNameInquiryType + { + [EnumMember(Value = "full_match")] + FullMatch, + + [EnumMember(Value = "partial_match")] + PartialMatch, + + [EnumMember(Value = "no_match")] + NoMatch, + + [EnumMember(Value = "not_performed")] + NotPerformed, + + [EnumMember(Value = "not_supported")] + NotSupported, + + } +} diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/CorporateAccountHolder/CorporateAccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/CorporateAccountHolder/CorporateAccountHolder.cs new file mode 100644 index 00000000..f3d3fd52 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/CorporateAccountHolder/CorporateAccountHolder.cs @@ -0,0 +1,33 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder.CorporateAccountHolder +{ + /// + /// corporate account_holder Class + /// Information about the account holder of the card + /// + public class CorporateAccountHolder : AbstractAccountHolder + { + /// + /// Initializes a new instance of the CorporateAccountHolder class. + /// + public CorporateAccountHolder() : base(AccountHolderType.Corporate) + { + } + + /// + /// The card account holder's company name + /// A valid and legal name must be populated in this field. The populated value cannot be only one character or + /// all numeric. + /// [Required] + /// <= 35 + /// + public string CompanyName { get; set; } + + /// + /// The Account Name Inquiry check result. + /// [Required] + /// + public AccountNameInquiryType? AccountNameInquiry { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/GovernmentAccountHolder/GovernmentAccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/GovernmentAccountHolder/GovernmentAccountHolder.cs new file mode 100644 index 00000000..a3efeabf --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/GovernmentAccountHolder/GovernmentAccountHolder.cs @@ -0,0 +1,33 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder.GovernmentAccountHolder +{ + /// + /// government account_holder Class + /// Information about the account holder of the card + /// + public class GovernmentAccountHolder : AbstractAccountHolder + { + /// + /// Initializes a new instance of the GovernmentAccountHolder class. + /// + public GovernmentAccountHolder() : base(AccountHolderType.Government) + { + } + + /// + /// The card account holder's company name + /// A valid and legal name must be populated in this field. The populated value cannot be only one character or + /// all numeric. + /// [Required] + /// <= 35 + /// + public string CompanyName { get; set; } + + /// + /// The Account Name Inquiry check result. + /// [Required] + /// + public AccountNameInquiryType? AccountNameInquiry { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/AccountNameInquiryDetails.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/AccountNameInquiryDetails.cs new file mode 100644 index 00000000..42740e6f --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/AccountNameInquiryDetails.cs @@ -0,0 +1,29 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder.IndividualAccountHolder.AccountNameInquiryDetails +{ + /// + /// account_name_inquiry_details + /// Details of the Account Name Inquiry check. + /// + public class AccountNameInquiryDetails + { + + /// + /// The result of the first name check. + /// [Optional] + /// + public FirstNameType? FirstName { get; set; } + + /// + /// The result of the middle name check. + /// [Optional] + /// + public MiddleNameType? MiddleName { get; set; } + + /// + /// The result of the last name check. + /// [Optional] + /// + public LastNameType? LastName { get; set; } + + } +} diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/FirstNameType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/FirstNameType.cs new file mode 100644 index 00000000..8dc772b3 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/FirstNameType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder.IndividualAccountHolder.AccountNameInquiryDetails +{ + public enum FirstNameType + { + [EnumMember(Value = "full_match")] + FullMatch, + + [EnumMember(Value = "partial_match")] + PartialMatch, + + [EnumMember(Value = "no_match")] + NoMatch, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/LastNameType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/LastNameType.cs new file mode 100644 index 00000000..236f6718 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/LastNameType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder.IndividualAccountHolder.AccountNameInquiryDetails +{ + public enum LastNameType + { + [EnumMember(Value = "full_match")] + FullMatch, + + [EnumMember(Value = "partial_match")] + PartialMatch, + + [EnumMember(Value = "no_match")] + NoMatch, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/MiddleNameType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/MiddleNameType.cs new file mode 100644 index 00000000..f0fc8651 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/AccountNameInquiryDetails/MiddleNameType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder.IndividualAccountHolder.AccountNameInquiryDetails +{ + public enum MiddleNameType + { + [EnumMember(Value = "full_match")] + FullMatch, + + [EnumMember(Value = "partial_match")] + PartialMatch, + + [EnumMember(Value = "no_match")] + NoMatch, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/IndividualAccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/IndividualAccountHolder.cs new file mode 100644 index 00000000..820ea860 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountHolder/IndividualAccountHolder/IndividualAccountHolder.cs @@ -0,0 +1,56 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.AccountHolder.IndividualAccountHolder +{ + /// + /// individual account_holder Class + /// Information about the account holder of the card + /// + public class IndividualAccountHolder : AbstractAccountHolder + { + /// + /// Initializes a new instance of the IndividualAccountHolder class. + /// + public IndividualAccountHolder() : base(AccountHolderType.Individual) + { + } + + /// + /// The card account holder's first name + /// A valid and legal name must be populated in this field. The populated value cannot be only one character or + /// all numeric. + /// [Required] + /// <= 35 + /// + public string FirstName { get; set; } + + /// + /// The card account holder's last name + /// A valid and legal name must be populated in this field. The populated value cannot be only one character or + /// all numeric. + /// [Required] + /// <= 35 + /// + public string LastName { get; set; } + + /// + /// The result of the Account Name Inquiry check. + /// [Required] + /// + public AccountNameInquiryType? AccountNameInquiry { get; set; } + + /// + /// The card account holder's middle name + /// Conditional - required when the card metadata issuer_country = ZA (South Africa) + /// [Optional] + /// <= 35 + /// + public string MiddleName { get; set; } + + /// + /// Details of the Account Name Inquiry check. + /// [Optional] + /// + public AccountNameInquiryDetails.AccountNameInquiryDetails AccountNameInquiryDetails { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountUpdateStatusType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountUpdateStatusType.cs new file mode 100644 index 00000000..85244cfc --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/AccountUpdateStatusType.cs @@ -0,0 +1,20 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + CardSource +{ + public enum AccountUpdateStatusType + { + [EnumMember(Value = "card_updated")] + CardUpdated, + + [EnumMember(Value = "card_expiry_updated")] + CardExpiryUpdated, + + [EnumMember(Value = "card_closed")] + CardClosed, + + [EnumMember(Value = "contact_cardholder")] + ContactCardholder, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/BillingAddress/BillingAddress.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/BillingAddress/BillingAddress.cs new file mode 100644 index 00000000..9cd42806 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/BillingAddress/BillingAddress.cs @@ -0,0 +1,54 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.BillingAddress +{ + /// + /// billing_address + /// The payment source owner's billing address + /// + public class BillingAddress + { + /// + /// The first line of the address. + /// [Optional] + /// <= 200 + /// + public string AddressLine1 { get; set; } + + /// + /// The second line of the address + /// [Optional] + /// <= 200 + /// + public string AddressLine2 { get; set; } + + /// + /// The address city. + /// [Optional] + /// <= 50 + /// + public string City { get; set; } + + /// + /// The state or province of the address country ISO 3166-2 code (for example: CA for California in the United + /// States). + /// [Optional] + /// <= 3 + /// + public string State { get; set; } + + /// + /// The address zip or postal code. + /// [Optional] + /// <= 50 + /// + public string Zip { get; set; } + + /// + /// The two-letter ISO country code of the address. + /// [Optional] + /// 2 characters + /// + public CountryCode? Country { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardCategoryType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardCategoryType.cs new file mode 100644 index 00000000..28f9d8ba --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardCategoryType.cs @@ -0,0 +1,14 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + CardSource +{ + public enum CardCategoryType + { + [EnumMember(Value = "CONSUMER")] + CONSUMER, + + [EnumMember(Value = "COMMERCIAL")] + COMMERCIAL, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardSource.cs new file mode 100644 index 00000000..8d7b2f50 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardSource.cs @@ -0,0 +1,186 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common.AccountHolder; +using System; +using System.Collections.Generic; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + CardSource +{ + /// + /// card source Class + /// The source of the payment + /// + public class CardSource : AbstractSource + { + /// + /// Initializes a new instance of the CardSource class. + /// + public CardSource() : base(SourceType.Card) + { + } + + /// + /// The expiry month + /// [Required] + /// [ 1 .. 2 ] characters >= 1 + /// >= 1 + /// + public int ExpiryMonth { get; set; } + + /// + /// The expiry year + /// [Required] + /// 4 characters + /// + public int ExpiryYear { get; set; } + + /// + /// The last four digits of the card number + /// [Required] + /// + public string LastFour { get; set; } + + /// + /// Uniquely identifies this particular card number. You can use this to compare cards across customers. + /// [Required] + /// + public string Fingerprint { get; set; } + + /// + /// The card issuer's Bank Identification Number (BIN) + /// [Required] + /// <= 8 + /// + public string Bin { get; set; } + + /// + /// The payment source identifier that can be used for subsequent payments. For new sources, this will only be + /// returned if the payment was approved + /// [Optional] + /// + public string Id { get; set; } + + /// + /// The payment source owner's billing address + /// [Optional] + /// + public BillingAddress.BillingAddress BillingAddress { get; set; } + + /// + /// The payment source owner's phone number + /// [Optional] + /// + public Phone.Phone Phone { get; set; } + + /// + /// The cardholder's name + /// [Optional] + /// + public string Name { get; set; } + + /// + /// The card scheme + /// [Optional] + /// + public string Scheme { get; set; } + + /// + /// [DEPRECATED] + /// Replaced by local_schemes + /// The local co-branded card scheme. + /// [Optional] + /// + [Obsolete("This property will be removed in the future, and should not be used.")] + public string SchemeLocal { get; set; } + + /// + /// The local co-branded card schemes. + /// [Optional] + /// + public IList LocalSchemes { get; set; } + + /// + /// The card type + /// [Optional] + /// + public CardType? CardType { get; set; } + + /// + /// The card category + /// [Optional] + /// + public CardCategoryType? CardCategory { get; set; } + + /// + /// The card wallet type + /// [Optional] + /// + public CardWalletType? CardWalletType { get; set; } + + /// + /// The name of the card issuer + /// [Optional] + /// + public string Issuer { get; set; } + + /// + /// The card issuer's country (two-letter ISO code) + /// [Optional] + /// 2 characters + /// + public string IssuerCountry { get; set; } + + /// + /// The issuer/card scheme product identifier + /// [Optional] + /// + public string ProductId { get; set; } + + /// + /// The issuer/card scheme product type + /// [Optional] + /// + public string ProductType { get; set; } + + /// + /// The Address Verification System check result + /// [Optional] + /// + public string AvsCheck { get; set; } + + /// + /// The card verification value (CVV) check result + /// [Optional] + /// + public string CvvCheck { get; set; } + + /// + /// A unique reference to the underlying card for network tokens (e.g., Apple Pay, Google Pay) + /// [Optional] + /// + public string PaymentAccountReference { get; set; } + + /// + /// The JWE encrypted full card number that has been updated by real-time account updater. + /// [Optional] + /// + public string EncryptedCardNumber { get; set; } + + /// + /// Specifies what card information was updated by the Real-Time Account Updater. + /// [Optional] + /// + public AccountUpdateStatusType? AccountUpdateStatus { get; set; } + + /// + /// Provides the failure code if the Real-Time Account Updater fails to update the card information. + /// [Optional] + /// + public string AccountUpdateFailureCode { get; set; } + + /// + /// Information about the account holder of the card + /// [Optional] + /// + public AbstractAccountHolder AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardType.cs new file mode 100644 index 00000000..f2a04e30 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardType.cs @@ -0,0 +1,23 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + CardSource +{ + public enum CardType + { + [EnumMember(Value = "CREDIT")] + CREDIT, + + [EnumMember(Value = "DEBIT")] + DEBIT, + + [EnumMember(Value = "PREPAID")] + PREPAID, + + [EnumMember(Value = "CHARGE")] + CHARGE, + + [EnumMember(Value = "DEFERRED DEBIT")] + DEFERREDDEBIT, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardWalletType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardWalletType.cs new file mode 100644 index 00000000..97a2a863 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/CardWalletType.cs @@ -0,0 +1,14 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + CardSource +{ + public enum CardWalletType + { + [EnumMember(Value = "applepay")] + Applepay, + + [EnumMember(Value = "googlepay")] + Googlepay, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/Phone/Phone.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/Phone/Phone.cs new file mode 100644 index 00000000..454617c1 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CardSource/Phone/Phone.cs @@ -0,0 +1,25 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.Phone +{ + /// + /// phone + /// The payment source owner's phone number + /// + public class Phone + { + /// + /// The international country calling code. Required if source.type is tamara. + /// [Optional] + /// [ 1 .. 7 ] characters + /// + public CountryCode? CountryCode { get; set; } + + /// + /// The phone number. Required if source.type is tamara. + /// [Optional] + /// [ 6 .. 25 ] characters + /// + public string Number { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CurrencyAccountSource/CurrencyAccountSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CurrencyAccountSource/CurrencyAccountSource.cs new file mode 100644 index 00000000..25d69ae0 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CurrencyAccountSource/CurrencyAccountSource.cs @@ -0,0 +1,31 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + CurrencyAccountSource +{ + /// + /// currency_account source Class + /// The source of the payment + /// + public class CurrencyAccountSource : AbstractSource + { + /// + /// Initializes a new instance of the CurrencyAccountSource class. + /// + public CurrencyAccountSource() : base(SourceType.CurrencyAccount) + { + } + + /// + /// The ID of the currency account + /// [Required] + /// ^(ca)_(\w{26})$ + /// + public string Id { get; set; } + + /// + /// If specified, indicates the amount in the source currency to be paid out. If omitted, the root amount in the + /// destination currency will be used.The amount must be provided in the minor currency unit. + /// [Optional] + /// + public long? Amount { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CvconnectSource/CvconnectSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CvconnectSource/CvconnectSource.cs new file mode 100644 index 00000000..f6233a35 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/CvconnectSource/CvconnectSource.cs @@ -0,0 +1,18 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CvconnectSource +{ + /// + /// cvconnect source Class + /// The source of the payment + /// + public class CvconnectSource : AbstractSource + { + + /// + /// Initializes a new instance of the CvconnectSource class. + /// + public CvconnectSource() : base(SourceType.Cvconnect) + { + } + + } +} diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/DanaSource/DanaSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/DanaSource/DanaSource.cs new file mode 100644 index 00000000..5fa7d4cf --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/DanaSource/DanaSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + DanaSource +{ + /// + /// dana source Class + /// The source of the payment + /// + public class DanaSource : AbstractSource + { + /// + /// Initializes a new instance of the DanaSource class. + /// + public DanaSource() : base(SourceType.Dana) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/EpsSource/AccountHolder/AccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/EpsSource/AccountHolder/AccountHolder.cs new file mode 100644 index 00000000..164b831e --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/EpsSource/AccountHolder/AccountHolder.cs @@ -0,0 +1,23 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.EpsSource.AccountHolder +{ + /// + /// account_holder + /// The account holder details + /// + public class AccountHolder + { + + /// + /// The first name of the account holder + /// [Required] + /// + public string FirstName { get; set; } + + /// + /// The last name of the account holder + /// [Required] + /// + public string LastName { get; set; } + + } +} diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/EpsSource/EpsSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/EpsSource/EpsSource.cs new file mode 100644 index 00000000..b81565a3 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/EpsSource/EpsSource.cs @@ -0,0 +1,52 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + EpsSource +{ + /// + /// eps source Class + /// The source of the payment + /// + public class EpsSource : AbstractSource + { + /// + /// Initializes a new instance of the EpsSource class. + /// + public EpsSource() : base(SourceType.Eps) + { + } + + /// + /// Purpose of the payment as appearing on customer's bank statement. + /// [Optional] + /// <= 27 + /// + public string Purpose { get; set; } + + /// + /// Bank Identifier Code (BIC). It can be exactly 8 characters or 11 characters long. + /// [Optional] + /// <= 11 + /// 8 characters + /// 11 characters + /// + public string Bic { get; set; } + + /// + /// International Bank Account Number (IBAN) without whitespaces. + /// [Optional] + /// <= 34 + /// + public string Iban { get; set; } + + /// + /// Account holder information. + /// [Optional] + /// + public string AccountHolderName { get; set; } + + /// + /// The account holder details + /// [Optional] + /// + public AccountHolder.AccountHolder AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/FawrySource/FawrySource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/FawrySource/FawrySource.cs new file mode 100644 index 00000000..d2719d0e --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/FawrySource/FawrySource.cs @@ -0,0 +1,30 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + FawrySource +{ + /// + /// fawry source Class + /// The source of the payment + /// + public class FawrySource : AbstractSource + { + /// + /// Initializes a new instance of the FawrySource class. + /// + public FawrySource() : base(SourceType.Fawry) + { + } + + /// + /// Payment description + /// [Required] + /// <= 65534 + /// + public string Description { get; set; } + + /// + /// The customer pays using this number at Fawry's outlets + /// [Optional] + /// + public string ReferenceNumber { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/GcashSource/GcashSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/GcashSource/GcashSource.cs new file mode 100644 index 00000000..baa8d2ba --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/GcashSource/GcashSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + GcashSource +{ + /// + /// gcash source Class + /// The source of the payment + /// + public class GcashSource : AbstractSource + { + /// + /// Initializes a new instance of the GcashSource class. + /// + public GcashSource() : base(SourceType.Gcash) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/IdealSource/IdealSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/IdealSource/IdealSource.cs new file mode 100644 index 00000000..f3c4aa58 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/IdealSource/IdealSource.cs @@ -0,0 +1,48 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + IdealSource +{ + /// + /// ideal source Class + /// The source of the payment + /// + public class IdealSource : AbstractSource + { + /// + /// Initializes a new instance of the IdealSource class. + /// + public IdealSource() : base(SourceType.Ideal) + { + } + + /// + /// description + /// [Required] + /// <= 27 + /// + public string Description { get; set; } + + /// + /// BIC (8 or 11-digits) BIC of the bank where the Consumer account is held. If governing law prevents Issuers + /// outside the Netherlands from disclosing this information, field may be omitted. + /// [Required] + /// <= 11 + /// + public string Bic { get; set; } + + /// + /// The IBAN of the Consumer Bank account used for payment. If governing law prevents Issuers outside the + /// Netherlands from disclosing this information, field may be omitted. + /// [Optional] + /// <= 34 + /// + public string Iban { get; set; } + + /// + /// Name of the Consumer according to the name of the account used for payment. In the exceptional case that + /// the consumerName cannot be retrieved by the Issuer, this is filled with 'N/A'. If governing law prevents + /// Issuers outside the Netherlands from disclosing this information, field may be omitted. + /// [Optional] + /// + public string AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/IllicadoSource/IllicadoSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/IllicadoSource/IllicadoSource.cs new file mode 100644 index 00000000..3d856746 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/IllicadoSource/IllicadoSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + IllicadoSource +{ + /// + /// illicado source Class + /// The source of the payment + /// + public class IllicadoSource : AbstractSource + { + /// + /// Initializes a new instance of the IllicadoSource class. + /// + public IllicadoSource() : base(SourceType.Illicado) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KakaopaySource/KakaopaySource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KakaopaySource/KakaopaySource.cs new file mode 100644 index 00000000..9148f878 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KakaopaySource/KakaopaySource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + KakaopaySource +{ + /// + /// kakaopay source Class + /// The source of the payment + /// + public class KakaopaySource : AbstractSource + { + /// + /// Initializes a new instance of the KakaopaySource class. + /// + public KakaopaySource() : base(SourceType.Kakaopay) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KlarnaSource/KlarnaSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KlarnaSource/KlarnaSource.cs new file mode 100644 index 00000000..e11d966a --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KlarnaSource/KlarnaSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + KlarnaSource +{ + /// + /// klarna source Class + /// The source of the payment + /// + public class KlarnaSource : AbstractSource + { + /// + /// Initializes a new instance of the KlarnaSource class. + /// + public KlarnaSource() : base(SourceType.Klarna) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KnetSource/KnetSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KnetSource/KnetSource.cs new file mode 100644 index 00000000..5d2c73e0 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KnetSource/KnetSource.cs @@ -0,0 +1,159 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + KnetSource +{ + /// + /// knet source Class + /// The source of the payment + /// + public class KnetSource : AbstractSource + { + /// + /// Initializes a new instance of the KnetSource class. + /// + public KnetSource() : base(SourceType.Knet) + { + } + + /// + /// Required for KNet Gateway payments. + /// This field enables the issuer's site to select the consumer's preferred language. For example, the language + /// selected on the merchant's site – if the issuer's site supports it. Code list in accordance with ISO 639-1. + /// (Arabic = 'ar', English = 'en'). Note that 'ar' corresponds to 'ARA' and 'en' to 'USA'. Both values accepted + /// by KNet Gateway. + /// [Optional] + /// + public LanguageType? Language { get; set; } + + /// + /// User-defined field that can be used to pass and store any additional transaction data required to be + /// archived with the transaction and available as a searching criterion. Only alphanumeric characters and + /// spaces are allowed. + /// [Optional] + /// + public string UserDefinedFieldOne { get; set; } + + /// + /// User-defined field can be used to pass and store any additional transaction data required to be archived + /// with the transaction and available as a searching criterion. Only alphanumeric characters and spaces are + /// allowed. + /// [Optional] + /// + public string UserDefinedFieldTwo { get; set; } + + /// + /// User-defined field can be used to pass and store any additional transaction data required to be archived + /// with the transaction and available as a searching criterion. Only alphanumeric characters and spaces are + /// allowed. Note that this field must be omitted when the card_token field is not empty. This restriction + /// exists because a card token is passed to KNet Gateway as user_defined_field3. + /// [Optional] + /// + public string UserDefinedFieldThree { get; set; } + + /// + /// User-defined field can be used to pass and store any additional transaction data required to be archived + /// with the transaction and available as a searching criterion. Only alphanumeric characters and spaces are + /// allowed. + /// [Optional] + /// + public string UserDefinedFieldFour { get; set; } + + /// + /// User-defined field can be used to pass and store any additional transaction data required to be archived + /// with the transaction and available as a searching criterion. Only alphanumeric characters and spaces are + /// allowed. Note that this field must be omitted when the ptlf field is not empty. This restriction exists + /// because a PTLF value is passed to KNet Gateway as user_defined_field5. + /// [Optional] + /// + public string UserDefinedFieldFive { get; set; } + + /// + /// This token allows re-usage of card details for multiple payments. This 8-digit token should be generated by + /// a merchant. When a subsequent payment is initialized with the same card token, a customer is presented with + /// two options. The customer can choose to pay with KFast (doesn't need to enter card details again), or with + /// KNet as usual. The payment flow stays the same i.e. a merchant should redirect a customer to the redirect + /// URL which is provided in the payment creation response. Note that user_defined_field3 must be omitted when + /// the card_token field is not empty. This restriction exists because a card token is passed to KNet Gateway as + /// user_defined_field3. + /// [Optional] + /// ^[0-9]{8}$ + /// + public string CardToken { get; set; } + + /// + /// This is an ID for merchant PTLF functionality tracking. Only alphanumeric characters are allowed. Note that + /// user_defined_field5 must be omitted when the ptlf field is not empty. This restriction exists because a PTLF + /// value is passed to KNet Gateway as user_defined_field5. + /// [Optional] + /// <= 45 + /// + public string Ptlf { get; set; } + + /// + /// The payment identifier assigned by KNet Gateway. + /// [Optional] + /// + public string KnetPaymentId { get; set; } + + /// + /// The state of the payment, returned by KNet Gateway after the customer is redirected from the payment page. + /// [Optional] + /// + public string KnetResult { get; set; } + + /// + /// The state of the payment, returned by KNet Gateway in the response from the payment inquiry. This field is + /// populated in rare cases when the redirection from the payment page did not occur properly. + /// [Optional] + /// + public string InquiryResult { get; set; } + + /// + /// The result transaction reference, given by some banks/institutions. + /// [Optional] + /// + public string BankReference { get; set; } + + /// + /// The transaction identifier assigned by KNet Gateway. + /// [Optional] + /// + public string KnetTransactionId { get; set; } + + /// + /// The resulting authorization code from the issuing bank. + /// [Optional] + /// + public string AuthCode { get; set; } + + /// + /// The auth response code / reason code relating to the issuing bank authorization code. + /// [Optional] + /// + public string AuthResponseCode { get; set; } + + /// + /// The transaction date in the authorization system format, with the value defined by the issuing bank, so may + /// not match the actual transaction date. The format is MMDD. + /// [Optional] + /// + public string PostDate { get; set; } + + /// + /// The Address Verification Response returned from the address verification service. + /// [Optional] + /// + public string Avr { get; set; } + + /// + /// The KNET error code for transaction processing. + /// [Optional] + /// + public string Error { get; set; } + + /// + /// The KNET text detail for the error, including an error code. + /// [Optional] + /// + public string ErrorText { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KnetSource/LanguageType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KnetSource/LanguageType.cs new file mode 100644 index 00000000..70c6a0ae --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/KnetSource/LanguageType.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.KnetSource +{ + public enum LanguageType + { + [EnumMember(Value = "ar")] + Ar, + + [EnumMember(Value = "en")] + En, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/MbwaySource/MbwaySource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/MbwaySource/MbwaySource.cs new file mode 100644 index 00000000..4e89de2b --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/MbwaySource/MbwaySource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + MbwaySource +{ + /// + /// mbway source Class + /// The source of the payment + /// + public class MbwaySource : AbstractSource + { + /// + /// Initializes a new instance of the MbwaySource class. + /// + public MbwaySource() : base(SourceType.Mbway) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/MobilepaySource/MobilepaySource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/MobilepaySource/MobilepaySource.cs new file mode 100644 index 00000000..bc74079a --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/MobilepaySource/MobilepaySource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + MobilepaySource +{ + /// + /// mobilepay source Class + /// The source of the payment + /// + public class MobilepaySource : AbstractSource + { + /// + /// Initializes a new instance of the MobilepaySource class. + /// + public MobilepaySource() : base(SourceType.Mobilepay) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/MultibancoSource/MultibancoSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/MultibancoSource/MultibancoSource.cs new file mode 100644 index 00000000..b447d5dd --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/MultibancoSource/MultibancoSource.cs @@ -0,0 +1,29 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + MultibancoSource +{ + /// + /// multibanco source Class + /// The source of the payment + /// + public class MultibancoSource : AbstractSource + { + /// + /// Initializes a new instance of the MultibancoSource class. + /// + public MultibancoSource() : base(SourceType.Multibanco) + { + } + + /// + /// Multibanco payment reference + /// [Optional] + /// + public string PaymentReference { get; set; } + + /// + /// The identifier of a supplier charging for its service or product + /// [Optional] + /// + public string ServiceSupplierId { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/OctopusSource/OctopusSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/OctopusSource/OctopusSource.cs new file mode 100644 index 00000000..1340decd --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/OctopusSource/OctopusSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + OctopusSource +{ + /// + /// octopus source Class + /// The source of the payment + /// + public class OctopusSource : AbstractSource + { + /// + /// Initializes a new instance of the OctopusSource class. + /// + public OctopusSource() : base(SourceType.Octopus) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/P24Source/P24Source.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/P24Source/P24Source.cs new file mode 100644 index 00000000..671b061f --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/P24Source/P24Source.cs @@ -0,0 +1,24 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + P24Source +{ + /// + /// p24 source Class + /// The source of the payment + /// + public class P24Source : AbstractSource + { + /// + /// Initializes a new instance of the SepaSource class. + /// + public P24Source() : base(SourceType.P24) + { + } + + /// + /// P24-generated payment descriptor, which contains the requested billing descriptor or the merchant's default + /// descriptor (subject to truncation). + /// [Optional] + /// + public string P24Descriptor { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseGiropaySourceSource/AccountHolder/AccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseGiropaySourceSource/AccountHolder/AccountHolder.cs new file mode 100644 index 00000000..63e07332 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseGiropaySourceSource/AccountHolder/AccountHolder.cs @@ -0,0 +1,23 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.PaymentGetResponseGiropaySourceSource.AccountHolder +{ + /// + /// account_holder + /// The account holder details + /// + public class AccountHolder + { + + /// + /// The first name of the account holder + /// [Required] + /// + public string FirstName { get; set; } + + /// + /// The last name of the account holder + /// [Required] + /// + public string LastName { get; set; } + + } +} diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseGiropaySourceSource/PaymentGetResponseGiropaySourceSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseGiropaySourceSource/PaymentGetResponseGiropaySourceSource.cs new file mode 100644 index 00000000..18f51fe0 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseGiropaySourceSource/PaymentGetResponseGiropaySourceSource.cs @@ -0,0 +1,52 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + PaymentGetResponseGiropaySourceSource +{ + /// + /// PaymentGetResponseGiropaySource source Class + /// The source of the payment + /// + public class PaymentGetResponseGiropaySourceSource : AbstractSource + { + /// + /// Initializes a new instance of the PaymentGetResponseGiropaySourceSource class. + /// + public PaymentGetResponseGiropaySourceSource() : base(SourceType.PaymentGetResponseGiropaySource) + { + } + + /// + /// Purpose of the payment as appearing on customer's bank statement. + /// [Optional] + /// <= 27 + /// + public string Purpose { get; set; } + + /// + /// Bank Identifier Code (BIC). It can be exactly 8 characters or 11 characters long. + /// [Optional] + /// <= 11 + /// 8 characters + /// 11 characters + /// + public string Bic { get; set; } + + /// + /// International Bank Account Number (IBAN) without whitespaces. + /// [Optional] + /// <= 34 + /// + public string Iban { get; set; } + + /// + /// Account holder information. + /// [Optional] + /// + public string AccountHolderName { get; set; } + + /// + /// The account holder details + /// [Optional] + /// + public AccountHolder.AccountHolder AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/AccountHolder/AccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/AccountHolder/AccountHolder.cs new file mode 100644 index 00000000..6bc7e60f --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/AccountHolder/AccountHolder.cs @@ -0,0 +1,55 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.PaymentGetResponseKlarnaSourceSource.AccountHolder +{ + /// + /// account_holder + /// object describes payee details + /// + public class AccountHolder + { + /// + /// First name of the account holder. + /// [Optional] + /// + public string FirstName { get; set; } + + /// + /// Last name of the account holder. + /// [Optional] + /// + public string LastName { get; set; } + + /// + /// Address of the account holder. + /// [Optional] + /// + public BillingAddress.BillingAddress BillingAddress { get; set; } + + /// + /// Email address of the account holder. + /// [Optional] + /// + public string Email { get; set; } + + /// + /// Date of birth of the account holder. + /// [Optional] + /// + public string DateOfBirth { get; set; } + + /// + /// Gender of the account holder. + /// [Optional] + /// + public string Gender { get; set; } + + /// + /// Phone number of the account holder. + /// [Optional] + /// + public Phone.Phone Phone + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/AccountHolder/BillingAddress/BillingAddress.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/AccountHolder/BillingAddress/BillingAddress.cs new file mode 100644 index 00000000..5a0bde0e --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/AccountHolder/BillingAddress/BillingAddress.cs @@ -0,0 +1,41 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.PaymentGetResponseKlarnaSourceSource.AccountHolder.BillingAddress +{ + /// + /// billing_address + /// Address of the account holder. + /// + public class BillingAddress + { + /// + /// Postal code of the account holder. + /// [Required] + /// + public string Zip { get; set; } + + /// + /// City of the account holder. + /// [Required] + /// + public string City { get; set; } + + /// + /// ISO 3166 alpha-2 account holder country code. + /// [Required] + /// + public CountryCode? Country { get; set; } + + /// + /// Street address of the account holder. + /// [Optional] + /// + public string AddressLine1 { get; set; } + + /// + /// Street address of the account holder. + /// [Optional] + /// + public string AddressLine2 { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/AccountHolder/Phone/Phone.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/AccountHolder/Phone/Phone.cs new file mode 100644 index 00000000..788fa442 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/AccountHolder/Phone/Phone.cs @@ -0,0 +1,21 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.PaymentGetResponseKlarnaSourceSource.AccountHolder.Phone +{ + /// + /// phone + /// Phone number of the account holder. + /// + public class Phone + { + /// + /// [Optional] + /// + public CountryCode? CountryCode { get; set; } + + /// + /// [Optional] + /// + public string Number { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/PaymentGetResponseKlarnaSourceSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/PaymentGetResponseKlarnaSourceSource.cs new file mode 100644 index 00000000..c8bc3753 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseKlarnaSourceSource/PaymentGetResponseKlarnaSourceSource.cs @@ -0,0 +1,23 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + PaymentGetResponseKlarnaSourceSource +{ + /// + /// PaymentGetResponseKlarnaSource source Class + /// The source of the payment + /// + public class PaymentGetResponseKlarnaSourceSource : AbstractSource + { + /// + /// Initializes a new instance of the PaymentGetResponseKlarnaSourceSource class. + /// + public PaymentGetResponseKlarnaSourceSource() : base(SourceType.PaymentGetResponseKlarnaSource) + { + } + + /// + /// object describes payee details + /// [Optional] + /// + public AccountHolder.AccountHolder AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseSEPAVFourSourceSource/PaymentGetResponseSEPAVFourSourceSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseSEPAVFourSourceSource/PaymentGetResponseSEPAVFourSourceSource.cs new file mode 100644 index 00000000..2ebc896d --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentGetResponseSEPAVFourSourceSource/PaymentGetResponseSEPAVFourSourceSource.cs @@ -0,0 +1,23 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + PaymentGetResponseSEPAVFourSourceSource +{ + /// + /// PaymentGetResponseSEPAV4Source source Class + /// The source of the payment + /// + public class PaymentGetResponseSEPAVFourSourceSource : AbstractSource + { + /// + /// Initializes a new instance of the PaymentGetResponseSEPAVFourSourceSource class. + /// + public PaymentGetResponseSEPAVFourSourceSource() : base(SourceType.PaymentGetResponseSEPAVFourSource) + { + } + + /// + /// The instrument ID + /// [Required] + /// + public string Id { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentResponseSourceSource/PaymentResponseSourceSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentResponseSourceSource/PaymentResponseSourceSource.cs new file mode 100644 index 00000000..d76c4771 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaymentResponseSourceSource/PaymentResponseSourceSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + PaymentResponseSourceSource +{ + /// + /// PaymentResponseSource source Class + /// The source of the payment + /// + public class PaymentResponseSourceSource : AbstractSource + { + /// + /// Initializes a new instance of the PaymentResponseSourceSource class. + /// + public PaymentResponseSourceSource() : base(SourceType.PaymentResponseSource) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaynowSource/PaynowSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaynowSource/PaynowSource.cs new file mode 100644 index 00000000..1f8fbbc8 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaynowSource/PaynowSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + PaynowSource +{ + /// + /// paynow source Class + /// The source of the payment + /// + public class PaynowSource : AbstractSource + { + /// + /// Initializes a new instance of the PaynowSource class. + /// + public PaynowSource() : base(SourceType.Paynow) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaypalSource/PaypalSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaypalSource/PaypalSource.cs new file mode 100644 index 00000000..c34f8b40 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PaypalSource/PaypalSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + PaypalSource +{ + /// + /// paypal source Class + /// The source of the payment + /// + public class PaypalSource : AbstractSource + { + /// + /// Initializes a new instance of the PaypalSource class. + /// + public PaypalSource() : base(SourceType.Paypal) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PostfinanceSource/PostfinanceSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PostfinanceSource/PostfinanceSource.cs new file mode 100644 index 00000000..5f75067b --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/PostfinanceSource/PostfinanceSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + PostfinanceSource +{ + /// + /// postfinance source Class + /// The source of the payment + /// + public class PostfinanceSource : AbstractSource + { + /// + /// Initializes a new instance of the PostfinanceSource class. + /// + public PostfinanceSource() : base(SourceType.Postfinance) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/QpaySource/QpaySource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/QpaySource/QpaySource.cs new file mode 100644 index 00000000..1c026733 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/QpaySource/QpaySource.cs @@ -0,0 +1,47 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + QpaySource +{ + /// + /// qpay source Class + /// The source of the payment + /// + public class QpaySource : AbstractSource + { + /// + /// Initializes a new instance of the QpaySource class. + /// + public QpaySource() : base(SourceType.Qpay) + { + } + + /// + /// Alphanumeric string containing a description of the payment order. + /// [Required] + /// + public string Description { get; set; } + + /// + /// QPay Payment Unique Number + /// [Required] + /// + public string Pun { get; set; } + + /// + /// The status code returned from the QPay gateway on payment, if available. + /// [Optional] + /// + public string QpayStatus { get; set; } + + /// + /// A message giving further detail on the payment status, for failure/cancelled/success status payments. + /// [Optional] + /// + public string StatusMessage { get; set; } + + /// + /// An identifier from the QPay gateway for a successful payment. + /// [Optional] + /// + public string ConfirmationId { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/SepaSource/SepaSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/SepaSource/SepaSource.cs new file mode 100644 index 00000000..8753109d --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/SepaSource/SepaSource.cs @@ -0,0 +1,23 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + SepaSource +{ + /// + /// sepa source Class + /// The source of the payment + /// + public class SepaSource : AbstractSource + { + /// + /// Initializes a new instance of the SepaSource class. + /// + public SepaSource() : base(SourceType.Sepa) + { + } + + /// + /// The instrument ID + /// [Required] + /// + public string Id { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/SequraSource/SequraSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/SequraSource/SequraSource.cs new file mode 100644 index 00000000..6f64b9d7 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/SequraSource/SequraSource.cs @@ -0,0 +1,18 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.SequraSource +{ + /// + /// sequra source Class + /// The source of the payment + /// + public class SequraSource : AbstractSource + { + + /// + /// Initializes a new instance of the SequraSource class. + /// + public SequraSource() : base(SourceType.Sequra) + { + } + + } +} diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/SourceType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/SourceType.cs new file mode 100644 index 00000000..40248fef --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/SourceType.cs @@ -0,0 +1,130 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source +{ + public enum SourceType + { + [EnumMember(Value = "card")] + Card, + + [EnumMember(Value = "afterpay")] + Afterpay, + + [EnumMember(Value = "alipay_cn")] + AlipayCn, + + [EnumMember(Value = "alipay_hk")] + AlipayHk, + + [EnumMember(Value = "alipay_plus")] + AlipayPlus, + + [EnumMember(Value = "alma")] + Alma, + + [EnumMember(Value = "bancontact")] + Bancontact, + + [EnumMember(Value = "benefit")] + Benefit, + + [EnumMember(Value = "cvconnect")] + Cvconnect, + + [EnumMember(Value = "dana")] + Dana, + + [EnumMember(Value = "eps")] + Eps, + + [EnumMember(Value = "fawry")] + Fawry, + + [EnumMember(Value = "gcash")] + Gcash, + + [EnumMember(Value = "ideal")] + Ideal, + + [EnumMember(Value = "illicado")] + Illicado, + + [EnumMember(Value = "kakaopay")] + Kakaopay, + + [EnumMember(Value = "klarna")] + Klarna, + + [EnumMember(Value = "knet")] + Knet, + + [EnumMember(Value = "mbway")] + Mbway, + + [EnumMember(Value = "mobilepay")] + Mobilepay, + + [EnumMember(Value = "multibanco")] + Multibanco, + + [EnumMember(Value = "octopus")] + Octopus, + + [EnumMember(Value = "paynow")] + Paynow, + + [EnumMember(Value = "paypal")] + Paypal, + + [EnumMember(Value = "postfinance")] + Postfinance, + + [EnumMember(Value = "p24")] + P24, + + [EnumMember(Value = "qpay")] + Qpay, + + [EnumMember(Value = "sepa")] + Sepa, + + [EnumMember(Value = "sequra")] + Sequra, + + [EnumMember(Value = "stcpay")] + Stcpay, + + [EnumMember(Value = "tamara")] + Tamara, + + [EnumMember(Value = "tng")] + Tng, + + [EnumMember(Value = "truemoney")] + Truemoney, + + [EnumMember(Value = "twint")] + Twint, + + [EnumMember(Value = "vipps")] + Vipps, + + [EnumMember(Value = "wechatpay")] + Wechatpay, + + [EnumMember(Value = "currency_account")] + CurrencyAccount, + + [EnumMember(Value = "PaymentGetResponseGiropaySource")] + PaymentGetResponseGiropaySource, + + [EnumMember(Value = "PaymentGetResponseKlarnaSource")] + PaymentGetResponseKlarnaSource, + + [EnumMember(Value = "PaymentGetResponseSEPAV4Source")] + PaymentGetResponseSEPAVFourSource, + + [EnumMember(Value = "PaymentResponseSource")] + PaymentResponseSource, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/StcpaySource/StcpaySource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/StcpaySource/StcpaySource.cs new file mode 100644 index 00000000..9ed2da33 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/StcpaySource/StcpaySource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + StcpaySource +{ + /// + /// stcpay source Class + /// The source of the payment + /// + public class StcpaySource : AbstractSource + { + /// + /// Initializes a new instance of the StcpaySource class. + /// + public StcpaySource() : base(SourceType.Stcpay) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TamaraSource/TamaraSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TamaraSource/TamaraSource.cs new file mode 100644 index 00000000..a8865248 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TamaraSource/TamaraSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + TamaraSource +{ + /// + /// tamara source Class + /// The source of the payment + /// + public class TamaraSource : AbstractSource + { + /// + /// Initializes a new instance of the TamaraSource class. + /// + public TamaraSource() : base(SourceType.Tamara) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TngSource/TngSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TngSource/TngSource.cs new file mode 100644 index 00000000..f6cc8d30 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TngSource/TngSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + TngSource +{ + /// + /// tng source Class + /// The source of the payment + /// + public class TngSource : AbstractSource + { + /// + /// Initializes a new instance of the TngSource class. + /// + public TngSource() : base(SourceType.Tng) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TruemoneySource/TruemoneySource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TruemoneySource/TruemoneySource.cs new file mode 100644 index 00000000..0e238d06 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TruemoneySource/TruemoneySource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + TruemoneySource +{ + /// + /// truemoney source Class + /// The source of the payment + /// + public class TruemoneySource : AbstractSource + { + /// + /// Initializes a new instance of the TruemoneySource class. + /// + public TruemoneySource() : base(SourceType.Truemoney) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TwintSource/TwintSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TwintSource/TwintSource.cs new file mode 100644 index 00000000..8e7e8705 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/TwintSource/TwintSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + TwintSource +{ + /// + /// twint source Class + /// The source of the payment + /// + public class TwintSource : AbstractSource + { + /// + /// Initializes a new instance of the TwintSource class. + /// + public TwintSource() : base(SourceType.Twint) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/Util/RequestAPaymentOrPayoutResponseCreatedSourceTypeConverter.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/Util/RequestAPaymentOrPayoutResponseCreatedSourceTypeConverter.cs new file mode 100644 index 00000000..5112f7ff --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/Util/RequestAPaymentOrPayoutResponseCreatedSourceTypeConverter.cs @@ -0,0 +1,334 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Net; +using System.Reflection; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.Util +{ + public class RequestAPaymentOrPayoutResponseCreatedSourceTypeConverter : JsonConverter + { + public override bool CanWrite => false; + + public override bool CanConvert(Type objectType) + { + return typeof(AbstractSource).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + } + + public override object ReadJson( + JsonReader reader, + Type objectType, + object existingValue, + Newtonsoft.Json.JsonSerializer serializer) + { + var jObject = JObject.Load(reader); + var target = Create(jObject); + if (target != null) + { + // Check if the original type is an unknown value that would cause enum parsing to fail + var originalType = jObject.SelectToken(CheckoutUtils.Type)?.Value()?.ToLowerInvariant(); + + if (IsUnknownType(originalType) && target.GetType().Name == "CardSource") + { + // This is a fallback case - replace the unknown type with "card" to allow proper deserialization + var modifiedJObject = (JObject)jObject.DeepClone(); + modifiedJObject[CheckoutUtils.Type] = CheckoutUtils.GetEnumMemberValue(SourceType.Card); + serializer.Populate(modifiedJObject.CreateReader(), target); + } + else + { + // Normal case - use original JSON + serializer.Populate(jObject.CreateReader(), target); + } + } + + return target; + } + + public override void WriteJson( + JsonWriter writer, + object value, + Newtonsoft.Json.JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + private static AbstractSource Create(JToken jToken) + { + CheckoutUtils.ValidateParams("jToken", jToken); + var sourceType = GetSourceType(jToken); + return CreateResponse(sourceType); + } + + private static AbstractSource CreateResponse(string sourceType) + { + if (CheckoutUtils.GetEnumMemberValue(SourceType.Card).Equals(sourceType)) + { + return new CardSource.CardSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Afterpay).Equals(sourceType)) + { + return new AfterpaySource.AfterpaySource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.AlipayCn).Equals(sourceType)) + { + return new AlipayCnSource.AlipayCnSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.AlipayHk).Equals(sourceType)) + { + return new AlipayHkSource.AlipayHkSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.AlipayPlus).Equals(sourceType)) + { + return new AlipayPlusSource.AlipayPlusSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Alma).Equals(sourceType)) + { + return new AlmaSource.AlmaSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Bancontact).Equals(sourceType)) + { + return new BancontactSource.BancontactSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Benefit).Equals(sourceType)) + { + return new BenefitSource.BenefitSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.CurrencyAccount).Equals(sourceType)) + { + return new CurrencyAccountSource.CurrencyAccountSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Cvconnect).Equals(sourceType)) + { + return new CvconnectSource.CvconnectSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Dana).Equals(sourceType)) + { + return new DanaSource.DanaSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Eps).Equals(sourceType)) + { + return new EpsSource.EpsSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Fawry).Equals(sourceType)) + { + return new FawrySource.FawrySource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Gcash).Equals(sourceType)) + { + return new GcashSource.GcashSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Ideal).Equals(sourceType)) + { + return new IdealSource.IdealSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Illicado).Equals(sourceType)) + { + return new IllicadoSource.IllicadoSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Kakaopay).Equals(sourceType)) + { + return new KakaopaySource.KakaopaySource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Klarna).Equals(sourceType)) + { + return new KlarnaSource.KlarnaSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Knet).Equals(sourceType)) + { + return new KnetSource.KnetSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Mbway).Equals(sourceType)) + { + return new MbwaySource.MbwaySource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Mobilepay).Equals(sourceType)) + { + return new MobilepaySource.MobilepaySource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Multibanco).Equals(sourceType)) + { + return new MultibancoSource.MultibancoSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Octopus).Equals(sourceType)) + { + return new OctopusSource.OctopusSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Paynow).Equals(sourceType)) + { + return new PaynowSource.PaynowSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Paypal).Equals(sourceType)) + { + return new PaypalSource.PaypalSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Postfinance).Equals(sourceType)) + { + return new PostfinanceSource.PostfinanceSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.P24).Equals(sourceType)) + { + return new P24Source.P24Source(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Qpay).Equals(sourceType)) + { + return new QpaySource.QpaySource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Sepa).Equals(sourceType)) + { + return new SepaSource.SepaSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Sequra).Equals(sourceType)) + { + return new SequraSource.SequraSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Stcpay).Equals(sourceType)) + { + return new StcpaySource.StcpaySource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Tamara).Equals(sourceType)) + { + return new TamaraSource.TamaraSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Tng).Equals(sourceType)) + { + return new TngSource.TngSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Truemoney).Equals(sourceType)) + { + return new TruemoneySource.TruemoneySource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Twint).Equals(sourceType)) + { + return new TwintSource.TwintSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Vipps).Equals(sourceType)) + { + return new VippsSource.VippsSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.Wechatpay).Equals(sourceType)) + { + return new WechatpaySource.WechatpaySource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.PaymentGetResponseGiropaySource).Equals(sourceType)) + { + return new PaymentGetResponseGiropaySourceSource.PaymentGetResponseGiropaySourceSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.PaymentGetResponseKlarnaSource).Equals(sourceType)) + { + return new PaymentGetResponseKlarnaSourceSource.PaymentGetResponseKlarnaSourceSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.PaymentGetResponseSEPAVFourSource).Equals(sourceType)) + { + return new PaymentGetResponseSEPAVFourSourceSource.PaymentGetResponseSEPAVFourSourceSource(); + } + + if (CheckoutUtils.GetEnumMemberValue(SourceType.PaymentResponseSource).Equals(sourceType)) + { + return new PaymentResponseSourceSource.PaymentResponseSourceSource(); + } + + throw new CheckoutApiException("Unsupported source type", HttpStatusCode.BadRequest, new Dictionary { { "sourceType", sourceType } }); + } + + private static string GetSourceType(JToken jObject) + { + return jObject.SelectToken(CheckoutUtils.Type)?.Value()?.ToLowerInvariant(); + } + + private static bool IsUnknownType(string sourceType) + { + if (string.IsNullOrEmpty(sourceType)) + return false; + + // Check if the source type matches any known enum value + return !IsKnownSourceType(sourceType); + } + + private static bool IsKnownSourceType(string sourceType) + { + // Check all known SourceType enum values + return CheckoutUtils.GetEnumMemberValue(SourceType.Card).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Afterpay).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.AlipayCn).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.AlipayHk).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.AlipayPlus).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Alma).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Bancontact).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Benefit).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Cvconnect).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Dana).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Eps).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Fawry).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Gcash).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Ideal).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Illicado).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Kakaopay).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Klarna).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Knet).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Mbway).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Mobilepay).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Multibanco).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Octopus).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Paynow).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Paypal).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Postfinance).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.P24).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Qpay).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Sepa).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Sequra).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Stcpay).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Tamara).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Tng).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Truemoney).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Twint).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Vipps).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.CurrencyAccount).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.Wechatpay).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.PaymentGetResponseGiropaySource).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.PaymentGetResponseKlarnaSource).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.PaymentGetResponseSEPAVFourSource).Equals(sourceType) || + CheckoutUtils.GetEnumMemberValue(SourceType.PaymentResponseSource).Equals(sourceType); + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/VippsSource/VippsSource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/VippsSource/VippsSource.cs new file mode 100644 index 00000000..680c8d1c --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/VippsSource/VippsSource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + VippsSource +{ + /// + /// vipps source Class + /// The source of the payment + /// + public class VippsSource : AbstractSource + { + /// + /// Initializes a new instance of the VippsSource class. + /// + public VippsSource() : base(SourceType.Vipps) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/WechatpaySource/WechatpaySource.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/WechatpaySource/WechatpaySource.cs new file mode 100644 index 00000000..d2674006 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/Common/Source/WechatpaySource/WechatpaySource.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.Common.Source. + WechatpaySource +{ + /// + /// wechatpay source Class + /// The source of the payment + /// + public class WechatpaySource : AbstractSource + { + /// + /// Initializes a new instance of the WechatpaySource class. + /// + public WechatpaySource() : base(SourceType.Wechatpay) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/AbstractDestination.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/AbstractDestination.cs new file mode 100644 index 00000000..55b3a284 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/AbstractDestination.cs @@ -0,0 +1,16 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination +{ + /// + /// Abstract destination Class + /// The destination of the unreferenced refund. + /// + public abstract class AbstractDestination + { + public DestinationType Type; + + protected AbstractDestination(DestinationType type) + { + Type = type; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/CardDestination/CardDestination.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/CardDestination/CardDestination.cs new file mode 100644 index 00000000..15cebf12 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/CardDestination/CardDestination.cs @@ -0,0 +1,47 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination. + CardDestination +{ + /// + /// card destination Class + /// The destination of the unreferenced refund. + /// + public class CardDestination : AbstractDestination + { + /// + /// Initializes a new instance of the CardDestination class. + /// + public CardDestination() : base(DestinationType.Card) + { + } + + /// + /// The card number. + /// [Required] + /// <= 19 + /// + public string Number { get; set; } + + /// + /// The card's expiration month. + /// [Required] + /// [ 1 .. 2 ] characters [ 1 .. 12 ] + /// + public int ExpiryMonth { get; set; } + + /// + /// The card's expiration year. + /// [Required] + /// 4 characters + /// + public int ExpiryYear { get; set; } + + /// + /// The unreferenced refund destination account holder. + /// [Required] + /// + public AbstractAccountHolder AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/AbstractAccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/AbstractAccountHolder.cs new file mode 100644 index 00000000..8f05e0a1 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/AbstractAccountHolder.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder +{ + /// + /// Abstract account_holder Class + /// The unreferenced refund destination account holder. + /// + public abstract class AbstractAccountHolder + { + public AccountHolderType? Type; + + protected AbstractAccountHolder(AccountHolderType type) + { + Type = type; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/AccountHolderType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/AccountHolderType.cs new file mode 100644 index 00000000..3c785a19 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/AccountHolderType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common.AccountHolder +{ + public enum AccountHolderType + { + [EnumMember(Value = "individual")] + Individual, + + [EnumMember(Value = "corporate")] + Corporate, + + [EnumMember(Value = "government")] + Government, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/BillingAddress/BillingAddress.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/BillingAddress/BillingAddress.cs new file mode 100644 index 00000000..27985488 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/BillingAddress/BillingAddress.cs @@ -0,0 +1,57 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.BillingAddress +{ + /// + /// billing_address + /// The account holder's billing address. + /// If your company is incorporated in the United States, this field is required for all unreferenced refunds you + /// perform. + /// + public class BillingAddress + { + /// + /// The first line of the address. + /// [Optional] + /// <= 200 + /// + public string AddressLine1 { get; set; } + + /// + /// The second line of the address. + /// [Optional] + /// <= 200 + /// + public string AddressLine2 { get; set; } + + /// + /// The address city. + /// [Optional] + /// <= 50 + /// + public string City { get; set; } + + /// + /// The address state. + /// [Optional] + /// [ 2 .. 3 ] characters + /// + public string State { get; set; } + + /// + /// The address ZIP or postal code. + /// You must provide US ZIPs in the format 00000, or 00000-0000. + /// [Optional] + /// <= 10 + /// + public string Zip { get; set; } + + /// + /// The address country, as a two-letter ISO country code. + /// [Optional] + /// 2 characters + /// + public CountryCode? Country { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/Identification/Identification.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/Identification/Identification.cs new file mode 100644 index 00000000..bff1cdbb --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/Identification/Identification.cs @@ -0,0 +1,42 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.Identification +{ + /// + /// identification + /// The account holder's identification. + /// Providing identification details for the unreferenced refund recipient increases the likelihood of a successful + /// unreferenced refund. + /// + public class Identification + { + /// + /// The type of identification for the account holder. + /// [Required] + /// + public Type Type { get; set; } + + /// + /// The account holder's identification number. + /// [Required] + /// <= 25 + /// + public string Number { get; set; } + + /// + /// If applicable, the country that issued the account holder's identification, as a two-letter ISO country + /// code. + /// Providing issuing_country increases the likelihood of a successful identity verification. + /// [Optional] + /// 2 characters + /// + public string IssuingCountry { get; set; } + + /// + /// If applicable, the expiration date of the account holder's identification, in the format YYYY-MM-DD. + /// Providing date_of_expiry increases the likelihood of a successful identity verification. + /// [Optional] + /// 10 characters + /// + public string DateOfExpiry { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/Identification/Type.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/Identification/Type.cs new file mode 100644 index 00000000..75c65c3f --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/Identification/Type.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common.AccountHolder.Common.Identification +{ + public enum Type + { + [EnumMember(Value = "passport")] + Passport, + + [EnumMember(Value = "driving_license")] + DrivingLicense, + + [EnumMember(Value = "national_id")] + NationalId, + + [EnumMember(Value = "company_registration")] + CompanyRegistration, + + [EnumMember(Value = "tax_id")] + TaxId, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/Phone/Phone.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/Phone/Phone.cs new file mode 100644 index 00000000..a45d837f --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/Common/Phone/Phone.cs @@ -0,0 +1,26 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.Phone +{ + /// + /// phone + /// The account holder's phone number. + /// + public class Phone + { + /// + /// The international dialing code for the account holder's address country, as an ITU-T E.164 code. + /// [Required] + /// [ 1 .. 7 ] characters + /// + public CountryCode? CountryCode { get; set; } + + /// + /// The digits of the phone number, not including the country_code. + /// [Required] + /// [ 6 .. 25 ] characters + /// + public string Number { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/CorporateAccountHolder/CorporateAccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/CorporateAccountHolder/CorporateAccountHolder.cs new file mode 100644 index 00000000..34e1b098 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/CorporateAccountHolder/CorporateAccountHolder.cs @@ -0,0 +1,65 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.BillingAddress; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.Identification; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.Phone; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.CorporateAccountHolder +{ + /// + /// corporate account_holder Class + /// The unreferenced refund destination account holder. + /// + public class CorporateAccountHolder : AbstractAccountHolder + { + /// + /// Initializes a new instance of the CorporateAccountHolder class. + /// + public CorporateAccountHolder() : base(AccountHolderType.Corporate) + { + } + + /// + /// The corporate account holder's company name. + /// This must be a valid legal name. The following formats for the company_name value will return a field + /// validation error: + /// a single character + /// all numeric characters + /// all punctuation characters + /// [Required] + /// <= 50 + /// + public string CompanyName { get; set; } + + /// + /// The account holder's billing address. + /// If your company is incorporated in the United States, this field is required for all unreferenced refunds + /// you perform. + /// [Optional] + /// + public BillingAddress BillingAddress { get; set; } + + /// + /// The account holder's phone number. + /// [Optional] + /// + public Phone Phone { get; set; } + + /// + /// The account holder's identification. + /// Providing identification details for the unreferenced refund recipient increases the likelihood of a + /// successful unreferenced refund. + /// [Optional] + /// + public Identification Identification { get; set; } + + /// + /// The account holder's email address. + /// [Optional] + /// <= 255 + /// + public string Email { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/GovernmentAccountHolder/GovernmentAccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/GovernmentAccountHolder/GovernmentAccountHolder.cs new file mode 100644 index 00000000..c5bcd812 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/GovernmentAccountHolder/GovernmentAccountHolder.cs @@ -0,0 +1,65 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.BillingAddress; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.Identification; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.Phone; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.GovernmentAccountHolder +{ + /// + /// government account_holder Class + /// The unreferenced refund destination account holder. + /// + public class GovernmentAccountHolder : AbstractAccountHolder + { + /// + /// Initializes a new instance of the GovernmentAccountHolder class. + /// + public GovernmentAccountHolder() : base(AccountHolderType.Government) + { + } + + /// + /// The account holder's company name. + /// This must be a valid legal name. The following formats for the company_name value will return a field + /// validation error: + /// a single character + /// all numeric characters + /// all punctuation characters + /// [Required] + /// <= 50 + /// + public string CompanyName { get; set; } + + /// + /// The account holder's billing address. + /// If your company is incorporated in the United States, this field is required for all unreferenced refunds + /// you perform. + /// [Optional] + /// + public BillingAddress BillingAddress { get; set; } + + /// + /// The account holder's phone number. + /// [Optional] + /// + public Phone Phone { get; set; } + + /// + /// The account holder's identification. + /// Providing identification details for the unreferenced refund recipient increases the likelihood of a + /// successful unreferenced refund. + /// [Optional] + /// + public Identification Identification { get; set; } + + /// + /// The account holder's email address. + /// [Optional] + /// <= 255 + /// + public string Email { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/IndividualAccountHolder/IndividualAccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/IndividualAccountHolder/IndividualAccountHolder.cs new file mode 100644 index 00000000..b1a899ef --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/Common/AccountHolder/IndividualAccountHolder/IndividualAccountHolder.cs @@ -0,0 +1,98 @@ +using Checkout.Common; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.BillingAddress; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.Common.Identification; +using Phone = Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common.AccountHolder.Common.Phone.Phone; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.IndividualAccountHolder +{ + /// + /// individual account_holder Class + /// The unreferenced refund destination account holder. + /// + public class IndividualAccountHolder : AbstractAccountHolder + { + /// + /// Initializes a new instance of the IndividualAccountHolder class. + /// + public IndividualAccountHolder() : base(AccountHolderType.Individual) + { + } + + /// + /// The account holder's first name. + /// This must be a valid legal name. The following formats for the first_name value will return a field + /// validation error: + /// a single character + /// all numeric characters + /// all punctuation characters + /// [Required] + /// <= 50 + /// + public string FirstName { get; set; } + + /// + /// The account holder's last name. + /// This must be a valid legal name. The following formats for the last_name value will return a field + /// validation error: + /// a single character + /// all numeric characters + /// all punctuation characters + /// [Required] + /// <= 50 + /// + public string LastName { get; set; } + + /// + /// The account holder's middle name. + /// [Optional] + /// <= 50 + /// + public string MiddleName { get; set; } + + /// + /// The account holder's billing address. + /// If your company is incorporated in the United States, this field is required for all unreferenced refunds + /// you perform. + /// [Optional] + /// + public BillingAddress BillingAddress { get; set; } + + /// + /// The account holder's phone number. + /// [Optional] + /// + public Phone Phone { get; set; } + + /// + /// The account holder's identification. + /// Providing identification details for the unreferenced refund recipient increases the likelihood of a + /// successful unreferenced refund. + /// [Optional] + /// + public Identification Identification { get; set; } + + /// + /// The account holder's email address. + /// [Optional] + /// <= 255 + /// + public string Email { get; set; } + + /// + /// The account holder's date of birth, in the format YYYY-MM-DD. + /// [Optional] + /// 10 characters + /// + public string DateOfBirth { get; set; } + + /// + /// The account holder's country of birth, as a two-letter ISO country code. + /// [Optional] + /// 2 characters + /// + public CountryCode? CountryOfBirth { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/DestinationType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/DestinationType.cs new file mode 100644 index 00000000..09d341ea --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/DestinationType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination +{ + public enum DestinationType + { + [EnumMember(Value = "token")] + Token, + + [EnumMember(Value = "id")] + Id, + + [EnumMember(Value = "card")] + Card, + + [EnumMember(Value = "network_token")] + NetworkToken, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/IdDestination/IdDestination.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/IdDestination/IdDestination.cs new file mode 100644 index 00000000..038fcb93 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/IdDestination/IdDestination.cs @@ -0,0 +1,34 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination. + IdDestination +{ + /// + /// id destination Class + /// The destination of the unreferenced refund. + /// + public class IdDestination : AbstractDestination + { + /// + /// Initializes a new instance of the IdDestination class. + /// + public IdDestination() : base(DestinationType.Id) + { + } + + /// + /// The payment source ID. This will be an ID with the prefix src_. + /// [Required] + /// ^(src)_(\w{26})$ + /// 30 characters + /// + public string Id { get; set; } + + /// + /// The unreferenced refund destination account holder. + /// [Optional] + /// + public AbstractAccountHolder AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/NetworkTokenDestination/NetworkTokenDestination.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/NetworkTokenDestination/NetworkTokenDestination.cs new file mode 100644 index 00000000..ab745c43 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/NetworkTokenDestination/NetworkTokenDestination.cs @@ -0,0 +1,68 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination. + NetworkTokenDestination +{ + /// + /// network_token destination Class + /// The destination of the unreferenced refund. + /// + public class NetworkTokenDestination : AbstractDestination + { + /// + /// Initializes a new instance of the NetworkTokenDestination class. + /// + public NetworkTokenDestination() : base(DestinationType.NetworkToken) + { + } + + /// + /// The network token's Primary Account Number (PAN). + /// [Required] + /// + public string Token { get; set; } + + /// + /// The network token's expiration month. + /// [Required] + /// [ 1 .. 2 ] characters >= 1 + /// >= 1 + /// + public int ExpiryMonth { get; set; } + + /// + /// The network token's expiration year. + /// [Required] + /// 4 characters + /// + public int ExpiryYear { get; set; } + + /// + /// The network token type. + /// [Required] + /// + public TokenType TokenType { get; set; } + + /// + /// The network token's Base64-encoded cryptographic identifier (TAVV). + /// The cryptogram is used by card schemes to validate the token verification result. + /// [Required] + /// <= 50 + /// + public string Cryptogram { get; set; } + + /// + /// The network token's Electronic Commerce Indicator (ECI) security level. + /// [Required] + /// <= 2 + /// + public string Eci { get; set; } + + /// + /// The unreferenced refund destination account holder. + /// [Required] + /// + public AbstractAccountHolder AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/NetworkTokenDestination/TokenType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/NetworkTokenDestination/TokenType.cs new file mode 100644 index 00000000..032640b5 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/NetworkTokenDestination/TokenType.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.NetworkTokenDestination +{ + public enum TokenType + { + [EnumMember(Value = "vts")] + Vts, + + [EnumMember(Value = "mdes")] + Mdes, + + [EnumMember(Value = "applepay")] + Applepay, + + [EnumMember(Value = "googlepay")] + Googlepay, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/TokenDestination/TokenDestination.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/TokenDestination/TokenDestination.cs new file mode 100644 index 00000000..28f4c3b8 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Destination/TokenDestination/TokenDestination.cs @@ -0,0 +1,34 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination. + TokenDestination +{ + /// + /// token destination Class + /// The destination of the unreferenced refund. + /// + public class TokenDestination : AbstractDestination + { + /// + /// Initializes a new instance of the TokenDestination class. + /// + public TokenDestination() : base(DestinationType.Token) + { + } + + /// + /// The Checkout.com card token ID. This will be an ID with the prefix tok_. + /// [Required] + /// ^(tok)_(\w{26})$ + /// 30 characters + /// + public string Token { get; set; } + + /// + /// The unreferenced refund destination account holder. + /// [Optional] + /// + public AbstractAccountHolder AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Instruction/Instruction.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Instruction/Instruction.cs new file mode 100644 index 00000000..b2ae6c6b --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Instruction/Instruction.cs @@ -0,0 +1,33 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Instruction +{ + /// + /// instruction + /// Additional details about the unreferenced refund instruction. + /// + public class Instruction + { + /// + /// Required if processing.processing_speed is fast. + /// Value of this field should be based on the destination card scheme: + /// For Visa, use MI + /// For Mastercard, use C60 + /// [Optional] + /// + public string FundsTransferType { get; set; } + + /// + /// The purpose of the unreferenced refund. + /// This field is required if the card's issuer_country is one of: + /// AR (Argentina) + /// BD (Bangladesh) + /// CL (Chile) + /// CO (Colombia) + /// EG (Egypt) + /// IN (India) + /// MX (Mexico) + /// To view a card's issuer_country, retrieve the card's metadata. + /// [Optional] + /// + public PurposeType? Purpose { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Instruction/PurposeType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Instruction/PurposeType.cs new file mode 100644 index 00000000..fbc48413 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Instruction/PurposeType.cs @@ -0,0 +1,64 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Instruction +{ + public enum PurposeType + { + [EnumMember(Value = "family_support")] + FamilySupport, + + [EnumMember(Value = "expatriation")] + Expatriation, + + [EnumMember(Value = "travel_and_tourism")] + TravelAndTourism, + + [EnumMember(Value = "education")] + Education, + + [EnumMember(Value = "medical_treatment")] + MedicalTreatment, + + [EnumMember(Value = "emergency_need")] + EmergencyNeed, + + [EnumMember(Value = "leisure")] + Leisure, + + [EnumMember(Value = "savings")] + Savings, + + [EnumMember(Value = "gifts")] + Gifts, + + [EnumMember(Value = "donations")] + Donations, + + [EnumMember(Value = "financial_services")] + FinancialServices, + + [EnumMember(Value = "it_services")] + ItServices, + + [EnumMember(Value = "investment")] + Investment, + + [EnumMember(Value = "insurance")] + Insurance, + + [EnumMember(Value = "loan_payment")] + LoanPayment, + + [EnumMember(Value = "pension")] + Pension, + + [EnumMember(Value = "royalties")] + Royalties, + + [EnumMember(Value = "other")] + Other, + + [EnumMember(Value = "income")] + Income, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Processing/Processing.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Processing/Processing.cs new file mode 100644 index 00000000..984c196f --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Processing/Processing.cs @@ -0,0 +1,16 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Processing +{ + /// + /// processing + /// Returns information related to the processing of the payment. + /// + public class Processing + { + /// + /// The speed at which the unreferenced refund is processed. + /// Only applicable for unreferenced refunds. + /// [Optional] + /// + public string ProcessingSpeed { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Segment/Segment.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Segment/Segment.cs new file mode 100644 index 00000000..7189df74 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Segment/Segment.cs @@ -0,0 +1,30 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Segment +{ + /// + /// segment + /// The dimension details about business segment for payment request. At least one dimension required. + /// + public class Segment + { + /// + /// The brand of business segment. + /// [Optional] + /// <= 50 + /// + public string Brand { get; set; } + + /// + /// The category of business segment. + /// [Optional] + /// <= 50 + /// + public string BusinessCategory { get; set; } + + /// + /// The market of business segment. + /// [Optional] + /// <= 50 + /// + public string Market { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Source/Source.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Source/Source.cs new file mode 100644 index 00000000..50a93717 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/Source/Source.cs @@ -0,0 +1,23 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Source +{ + /// + /// source + /// The source of the unreferenced refund. + /// + public class Source + { + /// + /// The unreferenced refund source type. + /// [Required] + /// + public string Type { get; set; } + + /// + /// The ID of the currency account that will fund the unreferenced refund. + /// [Required] + /// ^(ca)_(\w{26})$ + /// 29 characters + /// + public string Id { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/UnreferencedRefundRequest.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/UnreferencedRefundRequest.cs new file mode 100644 index 00000000..715601cb --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Requests/UnreferencedRefundRequest/UnreferencedRefundRequest.cs @@ -0,0 +1,90 @@ +using Checkout.Common; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination; +using System.Collections.Generic; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest +{ + /// + /// Request a payment or payout + /// Send a payment or payout.Note: successful payout requests will always return a 202 response. + /// + public class UnreferencedRefundRequest + { + /// + /// The source of the unreferenced refund. + /// [Required] + /// + public Source.Source Source { get; set; } + + /// + /// The destination of the unreferenced refund. + /// [Required] + /// + public AbstractDestination Destination { get; set; } + + /// + /// The amount of the payment + /// [Required] + /// >= 1 + /// + public int Amount { get; set; } + + /// + /// The three-letter ISO currency code of the payment. + /// [Required] + /// 3 characters + /// + public Currency Currency { get; set; } + + /// + /// The type of the payment + /// [Required] + /// + public string PaymentType { get; set; } + + /// + /// The processing channel identifier + /// [Required] + /// ^(pc)_(\w{26})$ + /// + public string ProcessingChannelId { get; set; } + + /// + /// Additional details about the unreferenced refund instruction. + /// [Optional] + /// + public Instruction.Instruction Instruction { get; set; } + + /// + /// An internal reference you can later use to identify this payment + /// [Optional] + /// + public string Reference { get; set; } + + /// + /// A set of key-value pairs that you can attach to the refund request. It can be useful for storing additional + /// information in a structured format. Note: This object only allows one level of depth, so cannot accept + /// non-primitive data types such as objects or arrays. + /// [Optional] + /// + public IDictionary Metadata { get; set; } = new Dictionary(); + + /// + /// The previous related payment identifier. This could be the ID of the payment that you want to refund. + /// [Optional] + /// + public string PreviousPaymentId { get; set; } + + /// + /// The dimension details about business segment for payment request. At least one dimension required. + /// [Optional] + /// + public Segment.Segment Segment { get; set; } + + /// + /// Returns information related to the processing of the payment. + /// [Optional] + /// + public Processing.Processing Processing { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponse.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponse.cs new file mode 100644 index 00000000..9589a424 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponse.cs @@ -0,0 +1,18 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses +{ + public class RequestAPaymentOrPayoutResponse + { + public RequestAPaymentOrPayoutResponseAccepted.RequestAPaymentOrPayoutResponseAccepted Accepted { get; set; } + public RequestAPaymentOrPayoutResponseCreated.RequestAPaymentOrPayoutResponseCreated Created { get; set; } + + public RequestAPaymentOrPayoutResponse(RequestAPaymentOrPayoutResponseAccepted.RequestAPaymentOrPayoutResponseAccepted accepted) + { + Accepted = accepted; + } + + public RequestAPaymentOrPayoutResponse(RequestAPaymentOrPayoutResponseCreated.RequestAPaymentOrPayoutResponseCreated created) + { + Created = created; + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/Destination/AccountHolder/AccountHolder.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/Destination/AccountHolder/AccountHolder.cs new file mode 100644 index 00000000..66d6a198 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/Destination/AccountHolder/AccountHolder.cs @@ -0,0 +1,12 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseAccepted. + Destination.AccountHolder +{ + public class AccountHolder + { + /// + /// The payment destination identifier (e.g., a card source identifier) + /// = 30 characters ^(src)_(\w{26})$ + /// + public string Id { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/Destination/Destination.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/Destination/Destination.cs new file mode 100644 index 00000000..c912bd57 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/Destination/Destination.cs @@ -0,0 +1,11 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseAccepted. + Destination +{ + public class Destination + { + /// + /// The account holder details. + /// + public AccountHolder.AccountHolder AccountHolder { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/Instruction/Instruction.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/Instruction/Instruction.cs new file mode 100644 index 00000000..811150ff --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/Instruction/Instruction.cs @@ -0,0 +1,14 @@ +using System; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseAccepted. + Instruction +{ + public class Instruction + { + /// + /// The date (in ISO 8601 format) and time at which the recipient's account will be credited. + /// + /// + public DateTime? ValueDate { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/RequestAPaymentOrPayoutResponseAccepted.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/RequestAPaymentOrPayoutResponseAccepted.cs new file mode 100644 index 00000000..d9b14b16 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/RequestAPaymentOrPayoutResponseAccepted.cs @@ -0,0 +1,40 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseAccepted +{ + /// + /// Request a payment or payout Response 202 + /// Payment asynchronous or further action required + /// + public class RequestAPaymentOrPayoutResponseAccepted : Resource + { + /// + /// The payment's unique identifier. + /// = 30 characters ^(pay)_(\w{26})$ + /// + public string Id { get; set; } + + /// + /// The refund status. + /// Enum: "Accepted" "Rejected" "Pending" + /// + public StatusType Status { get; set; } + + /// + /// The payment's unique identifier. + /// The reference you provided in the refund request. + /// <= 50 characters + /// + public string Reference { get; set; } + + /// + /// Instruction details for payouts to bank accounts. + /// + public Instruction.Instruction Instruction { get; set; } + + /// + /// The refund destination. + /// + public Destination.Destination Destination { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/StatusType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/StatusType.cs new file mode 100644 index 00000000..65639ec7 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseAccepted/StatusType.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseAccepted +{ + public enum StatusType + { + [EnumMember(Value = "Accepted")] + Accepted, + + [EnumMember(Value = "Rejected")] + Rejected, + + [EnumMember(Value = "Pending")] + Pending, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Balances/Balances.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Balances/Balances.cs new file mode 100644 index 00000000..a4a83f24 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Balances/Balances.cs @@ -0,0 +1,52 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated. + Balances +{ + /// + /// balances + /// The payment balances + /// + public class Balances + { + /// + /// The total amount that has been authorized + /// [Optional] + /// + public int TotalAuthorized { get; set; } + + /// + /// The total amount that has been voided + /// [Optional] + /// + public int TotalVoided { get; set; } + + /// + /// The total amount that is still available for voiding + /// [Optional] + /// + public int AvailableToVoid { get; set; } + + /// + /// The total amount that has been captured + /// [Optional] + /// + public int TotalCaptured { get; set; } + + /// + /// The total amount that is still available for capture + /// [Optional] + /// + public int AvailableToCapture { get; set; } + + /// + /// The total amount that has been refunded + /// [Optional] + /// + public int TotalRefunded { get; set; } + + /// + /// The total amount that is still available for refund + /// [Optional] + /// + public int AvailableToRefund { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Customer/Customer.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Customer/Customer.cs new file mode 100644 index 00000000..87d356ee --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Customer/Customer.cs @@ -0,0 +1,41 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated. + Customer +{ + /// + /// customer + /// The customer associated with the payment, if provided in the request + /// + public class Customer + { + /// + /// The customer's unique identifier. This can be passed as a source when making a payment. + /// [Required] + /// ^(cus)_(\w{26})$ + /// + public string Id { get; set; } + + /// + /// The customer's email address. + /// [Optional] + /// + public string Email { get; set; } + + /// + /// The customer's name. + /// [Optional] + /// + public string Name { get; set; } + + /// + /// The customer's phone number. + /// [Optional] + /// + public Phone.Phone Phone { get; set; } + + /// + /// Summary of the customer's transaction history. Used for risk assessment when source.type is Tamara + /// [Optional] + /// + public Summary.Summary Summary { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Customer/Phone/Phone.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Customer/Phone/Phone.cs new file mode 100644 index 00000000..c83a104f --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Customer/Phone/Phone.cs @@ -0,0 +1,27 @@ +using Checkout.Common; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated. + Customer. + Phone +{ + /// + /// phone + /// The customer's phone number. + /// + public class Phone + { + /// + /// The international country calling code. Required if source.type is tamara. + /// [Optional] + /// [ 1 .. 7 ] characters + /// + public CountryCode? CountryCode { get; set; } + + /// + /// The phone number. Required if source.type is tamara. + /// [Optional] + /// [ 6 .. 25 ] characters + /// + public string Number { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Customer/Summary/Summary.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Customer/Summary/Summary.cs new file mode 100644 index 00000000..a276fcb1 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Customer/Summary/Summary.cs @@ -0,0 +1,70 @@ +using System; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated. + Customer. + Summary +{ + /// + /// summary + /// Summary of the customer's transaction history. Used for risk assessment when source.type is Tamara + /// + public class Summary + { + /// + /// The date the customer registered. + /// [Optional] + /// + /// + public DateTime? RegistrationDate { get; set; } + + /// + /// The date of the customer's first transaction. + /// [Optional] + /// + /// + public DateTime? FirstTransactionDate { get; set; } + + /// + /// The date of the customer's last payment. + /// [Optional] + /// + /// + public DateTime? LastPaymentDate { get; set; } + + /// + /// The total number of orders made by the customer. + /// [Optional] + /// + public int? TotalOrderCount { get; set; } + + /// + /// The amount of the customer's last payment. + /// [Optional] + /// + public long? LastPaymentAmount { get; set; } + + /// + /// Specifies whether the customer is a premium customer. + /// [Optional] + /// + public bool? IsPremiumCustomer { get; set; } + + /// + /// Specifies whether the customer is a returning customer. + /// [Optional] + /// + public bool? IsReturningCustomer { get; set; } + + /// + /// The customer's lifetime value. This is the total monetary amount that the customer has ordered, in their + /// local currency, excluding the following: + /// canceled orders + /// rejected payments + /// refunded payments + /// Tamara payments + /// The lifetime value is an indicator of how valuable the relationship with the customer is to your company. + /// [Optional] + /// + public long? LifetimeValue { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Processing/PanTypeProcessedType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Processing/PanTypeProcessedType.cs new file mode 100644 index 00000000..651fc480 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Processing/PanTypeProcessedType.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated.Processing +{ + public enum PanTypeProcessedType + { + [EnumMember(Value = "fpan")] + Fpan, + + [EnumMember(Value = "dpan")] + Dpan, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Processing/Processing.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Processing/Processing.cs new file mode 100644 index 00000000..cf7964f0 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Processing/Processing.cs @@ -0,0 +1,126 @@ +using System.Collections.Generic; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated. + Processing +{ + /// + /// processing + /// Returns information related to the processing of the payment + /// + public class Processing + { + /// + /// A unique identifier for the authorization that is submitted to the card scheme during processing + /// [Optional] + /// + public string RetrievalReferenceNumber { get; set; } + + /// + /// A unique identifier for the transaction generated by the acquirer + /// [Optional] + /// + public string AcquirerTransactionId { get; set; } + + /// + /// A code representing the follow-up action to take with the payment, as recommended by Checkout.com + /// [Optional] + /// + public string RecommendationCode { get; set; } + + /// + /// The scheme the transaction was processed with + /// [Optional] + /// + public string Scheme { get; set; } + + /// + /// [BETA] + /// The Merchant Advice Code (MAC) provided by Mastercard, which contains additional information about the + /// transaction. + /// For example, the MAC can inform you if the transaction was performed using a consumer non-reloadable prepaid + /// card or a consumer single-use virtual card. + /// For declined transactions, the MAC will also let you know whether the payment can be retried, and how long + /// you should wait before doing so. + /// [Optional] + /// + public string PartnerMerchantAdviceCode { get; set; } + + /// + /// [BETA] + /// The original authorization response code sent by the scheme. This is also referred to as the raw response + /// code. + /// This differs from the recommendation_code value, which is provided by Checkout.com and is standardized + /// across all schemes. + /// [Optional] + /// + public string PartnerResponseCode { get; set; } + + /// + /// Unique order identification of an Afterpay payment + /// [Optional] + /// + public string PartnerOrderId { get; set; } + + /// + /// Unique identification of a payment provided by partner + /// [Optional] + /// + public string PartnerPaymentId { get; set; } + + /// + /// Status of a payment provided by partner + /// [Optional] + /// + public string PartnerStatus { get; set; } + + /// + /// Unique transaction identification provided by partner + /// [Optional] + /// + public string PartnerTransactionId { get; set; } + + /// + /// Error codes provided by partner + /// [Optional] + /// + public IList PartnerErrorCodes { get; set; } + + /// + /// Error description provided by partner + /// [Optional] + /// + public string PartnerErrorMessage { get; set; } + + /// + /// Authorization code provided by partner + /// [Optional] + /// + public string PartnerAuthorizationCode { get; set; } + + /// + /// Authorization response code provided by partner + /// [Optional] + /// + public string PartnerAuthorizationResponseCode { get; set; } + + /// + /// Surcharge amount applied to the transaction in minor units + /// [Optional] + /// >= 0 + /// + public int? SurchargeAmount { get; set; } + + /// + /// The type of Primary Account Number (PAN) used for the payment. DPAN indicates network token was used, FPAN + /// indicates the full card was used + /// [Optional] + /// + public PanTypeProcessedType? PanTypeProcessed { get; set; } + + /// + /// The flag indicating if Checkout Network Token was available for the payment + /// [Optional] + /// + public bool? CkoNetworkTokenAvailable { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/RequestAPaymentOrPayoutResponseCreated.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/RequestAPaymentOrPayoutResponseCreated.cs new file mode 100644 index 00000000..64fddc89 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/RequestAPaymentOrPayoutResponseCreated.cs @@ -0,0 +1,160 @@ +using Checkout.Common; +using Checkout.HandlePaymentsAndPayouts.Payments.Common.Source; +using Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.Util; +using Newtonsoft.Json; +using System; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated +{ + /// + /// Request a payment or payout Response 201 + /// Payment processed successfully + /// + public class RequestAPaymentOrPayoutResponseCreated : Resource + { + /// + /// The payment's unique identifier + /// [Required] + /// + public string Id { get; set; } + + /// + /// The unique identifier for the action performed against this payment + /// [Required] + /// ^(act)_(\w{26})$ + /// 30 characters + /// + public string ActionId { get; set; } + + /// + /// The payment amount. + /// [Required] + /// + public long Amount { get; set; } + + /// + /// The three-letter ISO currency code of the payment + /// [Required] + /// 3 characters + /// + public string Currency { get; set; } + + /// + /// Whether or not the authorization or capture was successful + /// [Required] + /// + public bool Approved { get; set; } + + /// + /// The status of the payment + /// [Required] + /// + public StatusType? Status { get; set; } + + /// + /// The Gateway response code + /// [Required] + /// + public string ResponseCode { get; set; } + + /// + /// The date/time the payment was processed + /// [Required] + /// + /// + public DateTime ProcessedOn { get; set; } + + /// + /// The full amount from the original authorization, if a partial authorization was requested and approved. + /// [Optional] + /// + public int AmountRequested { get; set; } + + /// + /// The acquirer authorization code if the payment was authorized + /// [Optional] + /// + public string AuthCode { get; set; } + + /// + /// The Gateway response summary + /// [Optional] + /// + public string ResponseSummary { get; set; } + + /// + /// The timestamp (ISO 8601 code) for when the authorization's validity period expires + /// [Optional] + /// + public string ExpiresOn { get; set; } + + /// + /// Provides 3D Secure enrollment status if the payment was downgraded to non-3D Secure + /// [Optional] + /// + [JsonProperty(PropertyName = "3ds")] + public Threeds.Threeds Threeds { get; set; } + + /// + /// Returns the payment's risk assessment results + /// [Optional] + /// + public Risk.Risk Risk { get; set; } + + /// + /// The source of the payment + /// [Optional] + /// + [JsonConverter(typeof(RequestAPaymentOrPayoutResponseCreatedSourceTypeConverter))] + public AbstractSource Source { get; set; } + + /// + /// The customer associated with the payment, if provided in the request + /// [Optional] + /// + public Customer.Customer Customer { get; set; } + + /// + /// The payment balances + /// [Optional] + /// + public Balances.Balances Balances { get; set; } + + /// + /// Your reference for the payment + /// [Optional] + /// + public string Reference { get; set; } + + /// + /// The details of the subscription. + /// [Optional] + /// + public Subscription.Subscription Subscription { get; set; } + + /// + /// Returns information related to the processing of the payment + /// [Optional] + /// + public Processing.Processing Processing { get; set; } + + /// + /// The final Electronic Commerce Indicator (ECI) security level used to authorize the payment. Applicable for + /// 3D Secure and network token payments + /// [Optional] + /// + public string Eci { get; set; } + + /// + /// The scheme transaction identifier + /// [Optional] + /// + public string SchemeId { get; set; } + + /// + /// Configuration relating to asynchronous retries + /// [Optional] + /// + public Retry.Retry Retry { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Retry/Retry.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Retry/Retry.cs new file mode 100644 index 00000000..42212761 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Retry/Retry.cs @@ -0,0 +1,31 @@ +using System; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated.Retry +{ + /// + /// retry + /// Configuration relating to asynchronous retries + /// + public class Retry + { + /// + /// Default: 6 The maximum number of authorization retry attempts, excluding the initial authorization. + /// [ 1 .. 15 ] + /// + public int MaxAttempts { get; set; } = 6; + + /// + /// A timestamp that details the date on which the retry schedule expires, in ISO 8601 format. + /// [Optional] + /// + /// + public DateTime? EndsOn { get; set; } + + /// + /// A timestamp of the date on which the next authorization attempt will take place, in ISO 8601 format. + /// [Optional] + /// + /// + public DateTime? NextAttemptOn { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Risk/Risk.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Risk/Risk.cs new file mode 100644 index 00000000..d7a3ce84 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Risk/Risk.cs @@ -0,0 +1,22 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated.Risk +{ + /// + /// risk + /// Returns the payment's risk assessment results + /// + public class Risk + { + /// + /// Default: false Whether or not the payment was flagged by a risk check + /// [Optional] + /// + public bool? Flagged { get; set; } = false; + + /// + /// The risk score calculated by our Fraud Detection engine. Absent if not enough data provided. + /// [Optional] + /// [ 0 .. 100 ] + /// + public int? Score { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/StatusType.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/StatusType.cs new file mode 100644 index 00000000..180a5ebb --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/StatusType.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated +{ + public enum StatusType + { + [EnumMember(Value = "Authorized")] + Authorized, + + [EnumMember(Value = "Pending")] + Pending, + + [EnumMember(Value = "Card Verified")] + CardVerified, + + [EnumMember(Value = "Declined")] + Declined, + + [EnumMember(Value = "Retry Scheduled")] + RetryScheduled, + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Subscription/Subscription.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Subscription/Subscription.cs new file mode 100644 index 00000000..6973fe63 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Subscription/Subscription.cs @@ -0,0 +1,17 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated. + Subscription +{ + /// + /// subscription + /// The details of the subscription. + /// + public class Subscription + { + /// + /// The ID or reference linking a series of recurring payments together. + /// [Optional] + /// <= 50 + /// + public string Id { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Threeds/Threeds.cs b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Threeds/Threeds.cs new file mode 100644 index 00000000..ebd90856 --- /dev/null +++ b/src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/Threeds/Threeds.cs @@ -0,0 +1,31 @@ +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated. + Threeds +{ + /// + /// 3ds + /// Provides 3D Secure enrollment status if the payment was downgraded to non-3D Secure + /// + public class Threeds + { + /// + /// Indicates whether this was a 3D Secure payment downgraded to non-3D-Secure (when attempt_n3d is specified) + /// [Optional] + /// + public bool? Downgraded { get; set; } + + /// + /// Indicates the 3D Secure enrollment status of the issuer + /// Y - Issuer enrolled + /// N - Customer not enrolled + /// U - Unknown + /// [Optional] + /// + public string Enrolled { get; set; } + + /// + /// Indicates the reason why the payment was upgraded to 3D Secure. + /// [Optional] + /// + public string UpgradeReason { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/JsonSerializer.cs b/src/CheckoutSdk/JsonSerializer.cs index a45d9593..8c286f51 100644 --- a/src/CheckoutSdk/JsonSerializer.cs +++ b/src/CheckoutSdk/JsonSerializer.cs @@ -1,4 +1,5 @@ using Checkout.Accounts.Payout.Response.Util; +using Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.Util; using Checkout.Instruments.Create.Util; using Checkout.Instruments.Get.Util; using Checkout.Instruments.Update.Util; @@ -51,23 +52,20 @@ private static JsonSerializerSettings CreateSerializerSettings(Action RequestPayment( PaymentRequest paymentRequest, string idempotencyKey = null, CancellationToken cancellationToken = default); + + Task RequestPayment( + UnreferencedRefundRequest paymentRequest, + string idempotencyKey = null, + CancellationToken cancellationToken = default); Task RequestPayout( PayoutRequest payoutRequest, diff --git a/src/CheckoutSdk/Payments/PaymentsClient.cs b/src/CheckoutSdk/Payments/PaymentsClient.cs index 06deb3f7..378f6c3d 100644 --- a/src/CheckoutSdk/Payments/PaymentsClient.cs +++ b/src/CheckoutSdk/Payments/PaymentsClient.cs @@ -1,5 +1,11 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseAccepted; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated; using Checkout.Payments.Request; using Checkout.Payments.Response; +using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -10,9 +16,18 @@ public class PaymentsClient : AbstractClient, IPaymentsClient private const string PaymentsPath = "payments"; private const string CancelAScheduledRetryPath = "cancellations"; + private static readonly IDictionary RequestASessionResponseMappings = new Dictionary(); + + static PaymentsClient() + { + RequestASessionResponseMappings[201] = typeof(RequestAPaymentOrPayoutResponseCreated); + RequestASessionResponseMappings[202] = typeof(RequestAPaymentOrPayoutResponseAccepted); + } + public PaymentsClient( IApiClient apiClient, - CheckoutConfiguration configuration) : base(apiClient, configuration, SdkAuthorizationType.SecretKeyOrOAuth) + CheckoutConfiguration configuration) + : base(apiClient, configuration, SdkAuthorizationType.SecretKeyOrOAuth) { } @@ -29,6 +44,29 @@ public Task RequestPayment(PaymentRequest paymentRequest, idempotencyKey); } + public async Task RequestPayment(UnreferencedRefundRequest paymentRequest, + string idempotencyKey = null, + CancellationToken cancellationToken = default) + { + CheckoutUtils.ValidateParams("paymentRequest", paymentRequest); + var resource = await ApiClient.Post(PaymentsPath, SdkAuthorization(), + RequestASessionResponseMappings, + paymentRequest, cancellationToken, + idempotencyKey); + + switch (resource) + { + case RequestAPaymentOrPayoutResponseCreated requestAPaymentOrPayoutResponseCreated: + return new RequestAPaymentOrPayoutResponse(requestAPaymentOrPayoutResponseCreated); + + case RequestAPaymentOrPayoutResponseAccepted requestAPaymentOrPayoutResponseAccepted: + return new RequestAPaymentOrPayoutResponse(requestAPaymentOrPayoutResponseAccepted); + + default: + throw new InvalidOperationException("Unexpected mapping type " + resource.GetType()); + } + } + public Task RequestPayout(PayoutRequest payoutRequest, string idempotencyKey = null, CancellationToken cancellationToken = default) @@ -73,12 +111,14 @@ public Task> GetPaymentActions( SdkAuthorization(), cancellationToken); } - - public Task CancelAScheduledRetry(string paymentId, CancelAScheduledRetryRequest cancelAScheduledRetryRequest, + + public Task CancelAScheduledRetry(string paymentId, + CancelAScheduledRetryRequest cancelAScheduledRetryRequest, string idempotencyKey = null, CancellationToken cancellationToken = default) { - CheckoutUtils.ValidateParams("paymentId",paymentId,"cancelAScheduledRetryRequest", cancelAScheduledRetryRequest); + CheckoutUtils.ValidateParams("paymentId", paymentId, "cancelAScheduledRetryRequest", + cancelAScheduledRetryRequest); return ApiClient.Post( BuildPath(PaymentsPath, paymentId, CancelAScheduledRetryPath), SdkAuthorization(), diff --git a/test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPayments/HandlePaymentsAndPayoutsClientTest.cs b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPayments/HandlePaymentsAndPayoutsClientTest.cs new file mode 100644 index 00000000..6e0acdda --- /dev/null +++ b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPayments/HandlePaymentsAndPayoutsClientTest.cs @@ -0,0 +1,98 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Source; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination. + CardDestination; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.IndividualAccountHolder; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated; +using Checkout.Common; +using Checkout.Payments; +using Moq; +using Shouldly; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments +{ + public class HandlePaymentsAndPayoutsClientTest : UnitTestFixture + { + private const string PaymentsPath = "payments"; + + private readonly SdkAuthorization _authorization = + new SdkAuthorization(PlatformType.DefaultOAuth, ValidDefaultSk); + + private readonly Mock _apiClient = new Mock(); + private readonly Mock _sdkCredentials = new Mock(PlatformType.DefaultOAuth); + private readonly Mock _httpClientFactory = new Mock(); + private readonly Mock _configuration; + + public HandlePaymentsAndPayoutsClientTest() + { + _sdkCredentials.Setup(credentials => credentials.GetSdkAuthorization(SdkAuthorizationType.SecretKeyOrOAuth)) + .Returns(_authorization); + + _configuration = new Mock(_sdkCredentials.Object, Environment.Sandbox, + _httpClientFactory.Object); + } + + [Fact] + public async Task ShouldRequestPaymentWithUnreferencedRefund_WhenSuccessful() + { + // Arrange + var request = CreateUnreferencedRefundRequest(); + var response = new RequestAPaymentOrPayoutResponseCreated(); + + _apiClient.Setup(apiClient => + apiClient.Post( + "payments", + _authorization, + It.IsAny>(), + request, + CancellationToken.None, + null)) + .ReturnsAsync(response); + + var client = new PaymentsClient(_apiClient.Object, _configuration.Object); + + // Act + var result = await client.RequestPayment(request); + + // Assert + result.ShouldNotBeNull(); + } + + [Fact] + public async Task ShouldThrowCheckoutArgumentException_WhenRequestIsNull() + { + // Arrange + var client = new PaymentsClient(_apiClient.Object, _configuration.Object); + + // Act & Assert + await Should.ThrowAsync(async () => + await client.RequestPayment((UnreferencedRefundRequest)null)); + } + + private UnreferencedRefundRequest CreateUnreferencedRefundRequest() + { + return new UnreferencedRefundRequest + { + Amount = 1000, + Currency = Currency.USD, + PaymentType = "UnreferencedRefund", + Reference = "test-reference", + Source = new Source { Type = "currency_account", Id = "ca_test_12345678901234567890123456" }, + Destination = new CardDestination + { + Number = "4242424242424242", + ExpiryMonth = 12, + ExpiryYear = 2025, + AccountHolder = new IndividualAccountHolder { FirstName = "John", LastName = "Doe" } + }, + ProcessingChannelId = "pc_test_12345" + }; + } + } +} \ No newline at end of file diff --git a/test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPayments/HandlePaymentsAndPayoutsIntegrationTest.cs b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPayments/HandlePaymentsAndPayoutsIntegrationTest.cs new file mode 100644 index 00000000..4aecdfe5 --- /dev/null +++ b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPayments/HandlePaymentsAndPayoutsIntegrationTest.cs @@ -0,0 +1,122 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Source; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination. + CardDestination; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common. + AccountHolder.IndividualAccountHolder; +using Checkout.Common; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Destination.Common.AccountHolder.Common.BillingAddress; +using Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Requests.UnreferencedRefundRequest.Instruction; +using Shouldly; +using System; +using System.Threading.Tasks; +using Xunit; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments +{ + public class HandlePaymentsAndPayoutsIntegrationTest : SandboxTestFixture + { + public HandlePaymentsAndPayoutsIntegrationTest() : base(PlatformType.DefaultOAuth) + { + } + + [Fact(Skip = "use on demand")] + public async Task ShouldRequestPaymentWithUnreferencedRefund_CardDestination() + { + // Arrange + var unreferencedRefundRequest = CreateUnreferencedRefundRequest(); + + // Act + var response = await DefaultApi.PaymentsClient().RequestPayment(unreferencedRefundRequest); + + // Assert + response.ShouldNotBeNull(); + + if (response.Created != null) + { + response.Created.Id.ShouldNotBeNull(); + response.Created.Status.ShouldNotBeNull(); + response.Created.Amount.ShouldBe(1000); + response.Created.Currency.ShouldBe("USD"); + response.Created.Reference.ShouldBe("ORD-5023-4E89"); + response.Created.Source.ShouldNotBeNull(); + response.Created.Source.Type.ShouldNotBeNull(); + } + else if (response.Accepted != null) + { + response.Accepted.Id.ShouldNotBeNull(); + response.Accepted.Status.ShouldNotBeNull(); + response.Accepted.Reference.ShouldBe("ORD-5023-4E89"); + } + else + { + throw new Exception("Neither Created nor Accepted response was returned"); + } + } + + [Fact(Skip = "use on demand")] + public async Task ShouldRequestPaymentWithUnreferencedRefund_WithIdempotencyKey() + { + // Arrange + var unreferencedRefundRequest = CreateUnreferencedRefundRequest(); + var idempotencyKey = Guid.NewGuid().ToString(); + + // Act + var response1 = await DefaultApi.PaymentsClient().RequestPayment(unreferencedRefundRequest, idempotencyKey); + var response2 = await DefaultApi.PaymentsClient().RequestPayment(unreferencedRefundRequest, idempotencyKey); + + // Assert + response1.ShouldNotBeNull(); + response2.ShouldNotBeNull(); + + // With the same idempotency key, should get the same response + if (response1.Created != null && response2.Created != null) + { + response1.Created.Id.ShouldBe(response2.Created.Id); + } + else if (response1.Accepted != null && response2.Accepted != null) + { + response1.Accepted.Id.ShouldBe(response2.Accepted.Id); + } + } + + private UnreferencedRefundRequest CreateUnreferencedRefundRequest() + { + return new UnreferencedRefundRequest + { + Amount = 1000, + Currency = Currency.USD, + PaymentType = "UnreferencedRefund", + Reference = "REF-FQSGRB", + Source = new Source { Type = "currency_account", Id = "ca_7hdklm89ybnfqqmk8pxrcvfh5t" }, + Destination = new CardDestination + { + Number = "4111111111111111", + ExpiryMonth = 12, + ExpiryYear = 2042, + AccountHolder = new IndividualAccountHolder + { + FirstName = "John", + LastName = "Doe", + DateOfBirth = "2000-01-01", + CountryOfBirth = CountryCode.US, + BillingAddress = new BillingAddress + { + AddressLine1 = "123 Test St", + City = "New York", + State = "NY", + Zip = "10014", + Country = CountryCode.US + } + } + }, + ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"), + Instruction = new Instruction + { + FundsTransferType = "C60", + Purpose = PurposeType.Income + } + }; + } + } +} \ No newline at end of file diff --git a/test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/RequestAPaymentOrPayoutResponseCreatedSerializationTest.cs b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/RequestAPaymentOrPayoutResponseCreatedSerializationTest.cs new file mode 100644 index 00000000..1d0899eb --- /dev/null +++ b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPayments/Responses/RequestAPaymentOrPayoutResponseCreated/RequestAPaymentOrPayoutResponseCreatedSerializationTest.cs @@ -0,0 +1,270 @@ +using Checkout.HandlePaymentsAndPayouts.Payments.Common.Source; +using CardSource = + Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CardSource.CardSource; +using KlarnaSource = + Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.KlarnaSource.KlarnaSource; +using PaypalSource = + Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.PaypalSource.PaypalSource; +using CurrencyAccountSource = + Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.CurrencyAccountSource.CurrencyAccountSource; +using SepaSource = + Checkout.HandlePaymentsAndPayouts.Payments.Common.Source.SepaSource.SepaSource; +using Shouldly; +using Xunit; + +namespace Checkout.HandlePaymentsAndPayouts.Payments.POSTPayments.Responses.RequestAPaymentOrPayoutResponseCreated +{ + public class RequestAPaymentOrPayoutResponseCreatedSerializationTest : JsonTestFixture + { + [Fact] + public void ShouldDeserializeCardSource() + { + const string json = @"{ + ""id"": ""pay_123"", + ""amount"": 1000, + ""currency"": ""USD"", + ""approved"": true, + ""status"": ""Authorized"", + ""response_code"": ""10000"", + ""processed_on"": ""2021-06-08T12:25:01Z"", + ""source"": { + ""type"": ""card"", + ""id"": ""src_123"", + ""last_four"": ""1234"", + ""fingerprint"": ""abc123"", + ""bin"": ""123456"", + ""scheme"": ""Visa"", + ""card_type"": ""Credit"", + ""expiry_month"": 12, + ""expiry_year"": 2025 + } + }"; + + var response = (RequestAPaymentOrPayoutResponseCreated)new JsonSerializer() + .Deserialize(json, typeof(RequestAPaymentOrPayoutResponseCreated)); + + response.ShouldNotBeNull(); + response.Source.ShouldNotBeNull(); + response.Source.ShouldBeOfType(); + response.Source.Type.ShouldBe(SourceType.Card); + + var cardSource = (CardSource)response.Source; + cardSource.LastFour.ShouldBe("1234"); + cardSource.Fingerprint.ShouldBe("abc123"); + cardSource.Bin.ShouldBe("123456"); + cardSource.ExpiryMonth.ShouldBe(12); + cardSource.ExpiryYear.ShouldBe(2025); + } + + [Fact] + public void ShouldDeserializeKlarnaSource() + { + const string json = @"{ + ""id"": ""pay_123"", + ""amount"": 1000, + ""currency"": ""EUR"", + ""approved"": true, + ""status"": ""Authorized"", + ""response_code"": ""10000"", + ""processed_on"": ""2021-06-08T12:25:01Z"", + ""source"": { + ""type"": ""klarna"" + } + }"; + + var response = (RequestAPaymentOrPayoutResponseCreated)new JsonSerializer() + .Deserialize(json, typeof(RequestAPaymentOrPayoutResponseCreated)); + + response.ShouldNotBeNull(); + response.Source.ShouldNotBeNull(); + response.Source.ShouldBeOfType(); + response.Source.Type.ShouldBe(SourceType.Klarna); + } + + [Fact] + public void ShouldDeserializePaypalSource() + { + const string json = @"{ + ""id"": ""pay_123"", + ""amount"": 1000, + ""currency"": ""USD"", + ""approved"": true, + ""status"": ""Authorized"", + ""response_code"": ""10000"", + ""processed_on"": ""2021-06-08T12:25:01Z"", + ""source"": { + ""type"": ""paypal"" + } + }"; + + var response = (RequestAPaymentOrPayoutResponseCreated)new JsonSerializer() + .Deserialize(json, typeof(RequestAPaymentOrPayoutResponseCreated)); + + response.ShouldNotBeNull(); + response.Source.ShouldNotBeNull(); + response.Source.ShouldBeOfType(); + response.Source.Type.ShouldBe(SourceType.Paypal); + } + + [Fact] + public void ShouldDeserializeCurrencyAccountSource() + { + const string json = @"{ + ""id"": ""pay_123"", + ""amount"": 1000, + ""currency"": ""USD"", + ""approved"": true, + ""status"": ""Authorized"", + ""response_code"": ""10000"", + ""processed_on"": ""2021-06-08T12:25:01Z"", + ""source"": { + ""type"": ""currency_account"", + ""id"": ""ca_123"", + ""amount"": 500 + } + }"; + + var response = (RequestAPaymentOrPayoutResponseCreated)new JsonSerializer() + .Deserialize(json, typeof(RequestAPaymentOrPayoutResponseCreated)); + + response.ShouldNotBeNull(); + response.Source.ShouldNotBeNull(); + response.Source.ShouldBeOfType(); + response.Source.Type.ShouldBe(SourceType.CurrencyAccount); + + var currencyAccountSource = (CurrencyAccountSource)response.Source; + currencyAccountSource.Id.ShouldBe("ca_123"); + currencyAccountSource.Amount.ShouldBe(500); + } + + [Fact] + public void ShouldDeserializeSepaSource() + { + const string json = @"{ + ""id"": ""pay_123"", + ""amount"": 1000, + ""currency"": ""EUR"", + ""approved"": true, + ""status"": ""Authorized"", + ""response_code"": ""10000"", + ""processed_on"": ""2021-06-08T12:25:01Z"", + ""source"": { + ""type"": ""sepa"", + ""id"": ""src_sepa_123"" + } + }"; + + var response = (RequestAPaymentOrPayoutResponseCreated)new JsonSerializer() + .Deserialize(json, typeof(RequestAPaymentOrPayoutResponseCreated)); + + response.ShouldNotBeNull(); + response.Source.ShouldNotBeNull(); + response.Source.ShouldBeOfType(); + response.Source.Type.ShouldBe(SourceType.Sepa); + + var sepaSource = (SepaSource)response.Source; + sepaSource.Id.ShouldBe("src_sepa_123"); + } + + [Fact] + public void ShouldThrowExceptionForUnknownSourceType() + { + const string json = @"{ + ""id"": ""pay_123"", + ""amount"": 1000, + ""currency"": ""USD"", + ""approved"": true, + ""status"": ""Authorized"", + ""response_code"": ""10000"", + ""processed_on"": ""2021-06-08T12:25:01Z"", + ""source"": { + ""type"": ""unknown_payment_method"", + ""some_property"": ""some_value"" + } + }"; + + Should.Throw(() => + { + new JsonSerializer().Deserialize(json, typeof(RequestAPaymentOrPayoutResponseCreated)); + }); + } + + [Fact] + public void ShouldDeserializeCompletePaymentResponse() + { + const string json = @"{ + ""id"": ""pay_y3oqhf46pyzuxjbcn2giaqnb44"", + ""action_id"": ""act_y3oqhf46pyzuxjbcn2giaqnb44"", + ""amount"": 6540, + ""currency"": ""USD"", + ""approved"": true, + ""status"": ""Authorized"", + ""auth_code"": ""858188"", + ""response_code"": ""10000"", + ""response_summary"": ""Approved"", + ""processed_on"": ""2019-08-24T14:15:22Z"", + ""reference"": ""ORD-5023-4E89"", + ""source"": { + ""type"": ""card"", + ""id"": ""src_nwd3m4in3hkuddfpjsaevunhdy"", + ""billing_address"": { + ""address_line1"": ""Checkout.com"", + ""address_line2"": ""90 Tottenham Court Road"", + ""city"": ""London"", + ""state"": ""London"", + ""zip"": ""W1T 4TJ"", + ""country"": ""GB"" + }, + ""expiry_month"": 6, + ""expiry_year"": 2025, + ""name"": ""Visa"", + ""scheme"": ""Visa"", + ""last_four"": ""4242"", + ""fingerprint"": ""F639CAB2745BEE4140BF86DF6B6D6"", + ""bin"": ""424242"", + ""card_type"": ""Credit"", + ""card_category"": ""Consumer"", + ""issuer"": ""JPMORGAN CHASE BANK NA"", + ""issuer_country"": ""US"", + ""product_id"": ""A"", + ""product_type"": ""Visa Traditional"", + ""avs_check"": ""S"", + ""cvv_check"": ""Y"" + }, + ""customer"": { + ""id"": ""cus_y3oqhf46pyzuxjbcn2giaqnb44"", + ""email"": ""brucewayne@gmail.com"", + ""name"": ""Bruce Wayne"" + } + }"; + + var response = (RequestAPaymentOrPayoutResponseCreated)new JsonSerializer() + .Deserialize(json, typeof(RequestAPaymentOrPayoutResponseCreated)); + + response.ShouldNotBeNull(); + response.Id.ShouldBe("pay_y3oqhf46pyzuxjbcn2giaqnb44"); + response.Amount.ShouldBe(6540); + response.Currency.ShouldBe("USD"); + response.Approved.ShouldBeTrue(); + response.Status.ShouldBe(StatusType.Authorized); + response.AuthCode.ShouldBe("858188"); + response.ResponseCode.ShouldBe("10000"); + response.ResponseSummary.ShouldBe("Approved"); + response.Reference.ShouldBe("ORD-5023-4E89"); + + response.Source.ShouldNotBeNull(); + response.Source.ShouldBeOfType(); + var cardSource = (CardSource)response.Source; + cardSource.Id.ShouldBe("src_nwd3m4in3hkuddfpjsaevunhdy"); + cardSource.LastFour.ShouldBe("4242"); + cardSource.ExpiryMonth.ShouldBe(6); + cardSource.ExpiryYear.ShouldBe(2025); + cardSource.Scheme.ShouldBe("Visa"); + + response.Customer.ShouldNotBeNull(); + response.Customer.Id.ShouldBe("cus_y3oqhf46pyzuxjbcn2giaqnb44"); + response.Customer.Email.ShouldBe("brucewayne@gmail.com"); + response.Customer.Name.ShouldBe("Bruce Wayne"); + } + } +} \ No newline at end of file