From 7f94f8ce8a474c52160ddba73cf4f7dc09035d98 Mon Sep 17 00:00:00 2001 From: jalozanot-conekta Date: Fri, 11 Oct 2024 10:36:52 -0500 Subject: [PATCH] AI-64 update template by new attribute CustomerIpAddress (#113) * AI-64 update template by new attribute CustomerIpAddress * AI-64 fix test * AI-64 fix test * AI-64 fix test * AI-64 fix test * AI-64 fix test * AI-64 fix test * AI-64 fix test orderaptest * AI-64 fix test orderaptest --- .openapi-generator/FILES | 4 + Conekta.net.sln | 10 +- VERSION | 2 +- api/openapi.yaml | 113 +++++++- config-netcore.json | 2 +- docs/ChargeOrderResponsePaymentMethod.md | 17 +- docs/ChargeRequest.md | 2 +- docs/ChargeRequestPaymentMethod.md | 9 +- docs/ChargeResponse.md | 8 +- docs/ChargeResponsePaymentMethod.md | 17 +- docs/ChargesDataResponse.md | 8 +- docs/Checkout.md | 1 + docs/OrderRefundRequest.md | 4 +- docs/OrderRequest.md | 2 +- docs/PaymentMethodBankTransfer.md | 1 + docs/PaymentMethodCard.md | 17 +- docs/PaymentMethodCardRequest.md | 7 +- docs/PaymentMethodCash.md | 1 + docs/PaymentMethodGeneralRequest.md | 18 ++ docs/PaymentMethodTokenRequest.md | 11 + docs/SubscriptionResponse.md | 1 + src/Conekta.net.Test/Api/ChargesApiTests.cs | 32 ++- src/Conekta.net.Test/Api/CustomersApiTests.cs | 8 +- src/Conekta.net.Test/Api/OrdersApiTests.cs | 25 +- src/Conekta.net/Client/Configuration.cs | 4 +- src/Conekta.net/Conekta.net.csproj | 4 +- src/Conekta.net/Model/ChargeRequest.cs | 5 +- .../Model/ChargeRequestPaymentMethod.cs | 245 +++++++++++++----- src/Conekta.net/Model/ChargeResponse.cs | 26 +- src/Conekta.net/Model/ChargesDataResponse.cs | 26 +- src/Conekta.net/Model/Checkout.cs | 12 +- .../CreateCustomerPaymentMethodsRequest.cs | 52 ++-- .../Model/CustomerPaymentMethodsRequest.cs | 52 ++-- src/Conekta.net/Model/OrderRefundRequest.cs | 10 +- src/Conekta.net/Model/OrderRequest.cs | 6 +- .../Model/PaymentMethodBankTransfer.cs | 12 +- src/Conekta.net/Model/PaymentMethodCard.cs | 55 ++-- .../Model/PaymentMethodCardRequest.cs | 135 +++++++++- src/Conekta.net/Model/PaymentMethodCash.cs | 12 +- .../Model/PaymentMethodGeneralRequest.cs | 169 ++++++++++++ .../Model/PaymentMethodTokenRequest.cs | 111 ++++++++ src/Conekta.net/Model/SubscriptionResponse.cs | 13 +- 42 files changed, 1020 insertions(+), 249 deletions(-) create mode 100644 docs/PaymentMethodGeneralRequest.md create mode 100644 docs/PaymentMethodTokenRequest.md create mode 100644 src/Conekta.net/Model/PaymentMethodGeneralRequest.cs create mode 100644 src/Conekta.net/Model/PaymentMethodTokenRequest.cs diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index f92204f..ee74f5c 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -137,9 +137,11 @@ docs/PaymentMethodCardResponse.md docs/PaymentMethodCash.md docs/PaymentMethodCashRequest.md docs/PaymentMethodCashResponse.md +docs/PaymentMethodGeneralRequest.md docs/PaymentMethodResponse.md docs/PaymentMethodSpeiRecurrent.md docs/PaymentMethodSpeiRequest.md +docs/PaymentMethodTokenRequest.md docs/PaymentMethodsApi.md docs/Payout.md docs/PayoutMethod.md @@ -366,9 +368,11 @@ src/Conekta.net/Model/PaymentMethodCardResponse.cs src/Conekta.net/Model/PaymentMethodCash.cs src/Conekta.net/Model/PaymentMethodCashRequest.cs src/Conekta.net/Model/PaymentMethodCashResponse.cs +src/Conekta.net/Model/PaymentMethodGeneralRequest.cs src/Conekta.net/Model/PaymentMethodResponse.cs src/Conekta.net/Model/PaymentMethodSpeiRecurrent.cs src/Conekta.net/Model/PaymentMethodSpeiRequest.cs +src/Conekta.net/Model/PaymentMethodTokenRequest.cs src/Conekta.net/Model/Payout.cs src/Conekta.net/Model/PayoutMethod.cs src/Conekta.net/Model/PayoutOrder.cs diff --git a/Conekta.net.sln b/Conekta.net.sln index 6947f33..2553bf0 100644 --- a/Conekta.net.sln +++ b/Conekta.net.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Conekta.net", "src\Conekta.net\Conekta.net.csproj", "{F7CF1CA4-FB32-4B79-929C-55DA32E75F20}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Conekta.net", "src\Conekta.net\Conekta.net.csproj", "{F4EEE3F4-00D1-4376-A5E8-0ADD0FFDCB95}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Conekta.net.Test", "src\Conekta.net.Test\Conekta.net.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F7CF1CA4-FB32-4B79-929C-55DA32E75F20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F7CF1CA4-FB32-4B79-929C-55DA32E75F20}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F7CF1CA4-FB32-4B79-929C-55DA32E75F20}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F7CF1CA4-FB32-4B79-929C-55DA32E75F20}.Release|Any CPU.Build.0 = Release|Any CPU + {F4EEE3F4-00D1-4376-A5E8-0ADD0FFDCB95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F4EEE3F4-00D1-4376-A5E8-0ADD0FFDCB95}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F4EEE3F4-00D1-4376-A5E8-0ADD0FFDCB95}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F4EEE3F4-00D1-4376-A5E8-0ADD0FFDCB95}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/VERSION b/VERSION index c7d48f0..b619a5b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.10 +6.0.11 diff --git a/api/openapi.yaml b/api/openapi.yaml index cf4bd5d..71f5a7f 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -12071,6 +12071,7 @@ components: expires_at: 1656634070 store_name: OXXO reference: 98000013217610 + customer_ip_address: 0.0.0.0 object: charge description: Payment from order status: paid @@ -12133,6 +12134,7 @@ components: type: card token_id: tok_2897348234 payment_source_id: src_2tLkkyfMPh6v7pFry + customer_ip_address: 0.0.0.0 reference_id: string currency: MXN customer_info: @@ -13318,17 +13320,24 @@ components: es sospechoso. type: string id: + description: Charge ID example: 63efa757cf65380001aec040 type: string livemode: + description: Whether the charge was made in live mode or not + example: false type: boolean object: + example: charge type: string order_id: + description: Order ID example: ord_2tN73UdUSNrYRPD9r type: string paid_at: + description: Payment date example: 1676390742 + format: int64 nullable: true type: integer payment_method: @@ -14245,6 +14254,11 @@ components: format: int64 nullable: true type: integer + canceled_reason: + description: Reason for cancellation. This field appears when the subscription + status is 'canceled'. + example: user_cancelation + type: string card_id: example: src_2tKcHxhTz7xU5SymL type: string @@ -14689,6 +14703,7 @@ components: description: The charges to be made properties: amount: + description: Amount to be charged in cents example: 40000 type: integer payment_method: @@ -14953,7 +14968,7 @@ components: type: string return_url: description: Indicates the redirection callback upon completion of the 3DS2 - flow. + flow. Do not use this parameter if your order has a checkout parameter example: https://my-website.com format: uri type: string @@ -15210,6 +15225,9 @@ components: format: int8 type: integer type: array + three_ds_mode: + description: "Indicates the 3DS2 mode for the order, either smart or strict." + type: string name: description: Reason for charge example: Payment Link Name 1594138857 @@ -15249,7 +15267,7 @@ components: - type title: checkout_request type: object - payment_method_card_request: + payment_method_token_request: allOf: - $ref: '#/components/schemas/customer_payment_method_request' - properties: @@ -15262,7 +15280,7 @@ components: required: - token_id type: object - title: payment_method_card_request + title: payment_method_token_request payment_method_cash_request: allOf: - $ref: '#/components/schemas/customer_payment_method_request' @@ -15652,6 +15670,9 @@ components: store_name: example: OXXO type: string + customer_ip_address: + example: 0.0.0.0 + type: string title: charge_data_payment_method_cash_response type: object payment_method_card: @@ -15660,12 +15681,14 @@ components: - description: use for card responses properties: account_type: + description: Account type of the card example: Credit type: string auth_code: example: "867372" type: string brand: + description: Brand of the card example: visa type: string contract_id: @@ -15673,26 +15696,37 @@ components: example: S781317595 type: string country: + description: Country of the card example: MX type: string exp_month: + description: Expiration month of the card example: "02" type: string exp_year: - example: "30" + description: Expiration year of the card + example: "2026" type: string fraud_indicators: items: {} type: array issuer: + description: Issuer of the card example: BANAMEX type: string last4: + description: Last 4 digits of the card example: "4242" type: string name: + description: Name of the cardholder example: Fulanito Perez type: string + customer_ip_address: + description: Optional field used to capture the customer's IP address + for fraud prevention and security monitoring purposes + example: 0.0.0.0 + type: string title: charge_data_payment_method_card_response type: object payment_method_bank_transfer: @@ -15749,6 +15783,9 @@ components: tracking_code: nullable: true type: string + customer_ip_address: + example: 0.0.0.0 + type: string title: charge_data_payment_method_bank_transfer_response type: object company_payout_destination_response: @@ -15940,6 +15977,49 @@ components: - object - type type: object + payment_method_card_request: + allOf: + - $ref: '#/components/schemas/customer_payment_method_request' + - properties: + cvc: + description: Card security code + example: "198" + maxLength: 4 + minLength: 3 + type: string + exp_month: + description: Card expiration month + example: "12" + maxLength: 2 + minLength: 2 + type: string + exp_year: + description: Card expiration year + example: "2025" + maxLength: 4 + minLength: 4 + type: string + name: + description: Cardholder name + example: John Doe + type: string + number: + description: Card number + example: "4242424242424242" + type: string + customer_ip_address: + description: Optional field used to capture the customer's IP address + for fraud prevention and security monitoring purposes + example: 0.0.0.0 + type: string + required: + - cvc + - exp_month + - exp_year + - name + - number + type: object + title: payment_method_card_request checkout_request: description: | [Checkout](https://developers.conekta.com/v2.1.0/reference/payment-link) details @@ -16344,6 +16424,7 @@ components: orderRefund_request: properties: amount: + description: Amount to be refunded in cents example: 500 type: integer expires_at: @@ -16352,6 +16433,7 @@ components: nullable: true type: integer reason: + description: Reason for the refund example: suspected_fraud type: string required: @@ -16426,7 +16508,7 @@ components: description: Contains details of the payment methods that the customer has active or has used in Conekta oneOf: - - $ref: '#/components/schemas/payment_method_card_request' + - $ref: '#/components/schemas/payment_method_token_request' - $ref: '#/components/schemas/payment_method_cash_request' - $ref: '#/components/schemas/payment_method_spei_request' create_customer_payment_methods_response: @@ -17420,7 +17502,7 @@ components: type: string title: transfer_destination_response type: object - charge_request_payment_method: + payment_method_general_request: description: | Payment method used in the charge. Go to the [payment methods](https://developers.conekta.com/reference/m%C3%A9todos-de-pago) section for more details properties: @@ -17435,6 +17517,7 @@ components: format: int8 type: integer type: + description: Type of payment method example: card type: string token_id: @@ -17443,14 +17526,30 @@ components: payment_source_id: example: src_2tLkkyfMPh6v7pFry type: string + cvc: + description: "Optional, It is a value that allows identifying the security\ + \ code of the card. Only for PCI merchants" + example: "123" + type: string contract_id: description: Optional id sent to indicate the bank contract for recurrent card charges. example: S781317595 type: string + customer_ip_address: + description: Optional field used to capture the customer's IP address for + fraud prevention and security monitoring purposes + example: 0.0.0.0 + type: string required: - type + title: payment_method_general_request type: object + charge_request_payment_method: + oneOf: + - $ref: '#/components/schemas/payment_method_card_request' + - $ref: '#/components/schemas/payment_method_general_request' + title: charge_request_payment_method customer_antifraud_info: nullable: true properties: @@ -17465,7 +17564,7 @@ components: type: object customer_payment_methods_request: oneOf: - - $ref: '#/components/schemas/payment_method_card_request' + - $ref: '#/components/schemas/payment_method_token_request' - $ref: '#/components/schemas/payment_method_cash_request' - $ref: '#/components/schemas/payment_method_spei_request' title: customer_payment_methods_request diff --git a/config-netcore.json b/config-netcore.json index bee48d7..3e0a2e7 100644 --- a/config-netcore.json +++ b/config-netcore.json @@ -33,5 +33,5 @@ "packageCopyright" : "Conekta", "PackageReleaseNotes" : "add support for payout orders", "releaseNote" : "update entity webhook, nuget config", - "packageVersion" : "6.0.10" + "packageVersion" : "6.0.11" } diff --git a/docs/ChargeOrderResponsePaymentMethod.md b/docs/ChargeOrderResponsePaymentMethod.md index 0b233ac..84cec6c 100644 --- a/docs/ChargeOrderResponsePaymentMethod.md +++ b/docs/ChargeOrderResponsePaymentMethod.md @@ -14,16 +14,17 @@ Name | Type | Description | Notes **ServiceName** | **string** | | [optional] **Store** | **string** | | [optional] **StoreName** | **string** | | [optional] -**AccountType** | **string** | | [optional] -**Brand** | **string** | | [optional] +**CustomerIpAddress** | **string** | | [optional] +**AccountType** | **string** | Account type of the card | [optional] +**Brand** | **string** | Brand of the card | [optional] **ContractId** | **string** | Id sent for recurrent charges. | [optional] -**Country** | **string** | | [optional] -**ExpMonth** | **string** | | [optional] -**ExpYear** | **string** | | [optional] +**Country** | **string** | Country of the card | [optional] +**ExpMonth** | **string** | Expiration month of the card | [optional] +**ExpYear** | **string** | Expiration year of the card | [optional] **FraudIndicators** | **List<Object>** | | [optional] -**Issuer** | **string** | | [optional] -**Last4** | **string** | | [optional] -**Name** | **string** | | [optional] +**Issuer** | **string** | Issuer of the card | [optional] +**Last4** | **string** | Last 4 digits of the card | [optional] +**Name** | **string** | Name of the cardholder | [optional] **Bank** | **string** | | [optional] **Clabe** | **string** | | [optional] **Description** | **string** | | [optional] diff --git a/docs/ChargeRequest.md b/docs/ChargeRequest.md index afe668d..d298bde 100644 --- a/docs/ChargeRequest.md +++ b/docs/ChargeRequest.md @@ -5,7 +5,7 @@ The charges to be made Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Amount** | **int** | | [optional] +**Amount** | **int** | Amount to be charged in cents | [optional] **PaymentMethod** | [**ChargeRequestPaymentMethod**](ChargeRequestPaymentMethod.md) | | **ReferenceId** | **string** | Custom reference to add to the charge | [optional] diff --git a/docs/ChargeRequestPaymentMethod.md b/docs/ChargeRequestPaymentMethod.md index 72d7d39..adb5f49 100644 --- a/docs/ChargeRequestPaymentMethod.md +++ b/docs/ChargeRequestPaymentMethod.md @@ -1,13 +1,18 @@ # Conekta.net.Model.ChargeRequestPaymentMethod -Payment method used in the charge. Go to the [payment methods](https://developers.conekta.com/reference/m%C3%A9todos-de-pago) section for more details ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Type** | **string** | Type of payment method | +**Cvc** | **string** | Optional, It is a value that allows identifying the security code of the card. Only for PCI merchants | +**ExpMonth** | **string** | Card expiration month | +**ExpYear** | **string** | Card expiration year | +**Name** | **string** | Cardholder name | +**Number** | **string** | Card number | +**CustomerIpAddress** | **string** | Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes | [optional] **ExpiresAt** | **long** | Method expiration date as unix timestamp | [optional] **MonthlyInstallments** | **int** | How many months without interest to apply, it can be 3, 6, 9, 12 or 18 | [optional] -**Type** | **string** | | **TokenId** | **string** | | [optional] **PaymentSourceId** | **string** | | [optional] **ContractId** | **string** | Optional id sent to indicate the bank contract for recurrent card charges. | [optional] diff --git a/docs/ChargeResponse.md b/docs/ChargeResponse.md index 53fecaf..20cc653 100644 --- a/docs/ChargeResponse.md +++ b/docs/ChargeResponse.md @@ -13,11 +13,11 @@ Name | Type | Description | Notes **DeviceFingerprint** | **string** | | [optional] **FailureCode** | **string** | | [optional] **FailureMessage** | **string** | | [optional] -**Id** | **string** | | [optional] -**Livemode** | **bool** | | [optional] +**Id** | **string** | Charge ID | [optional] +**Livemode** | **bool** | Whether the charge was made in live mode or not | [optional] **Object** | **string** | | [optional] -**OrderId** | **string** | | [optional] -**PaidAt** | **int?** | | [optional] +**OrderId** | **string** | Order ID | [optional] +**PaidAt** | **long?** | Payment date | [optional] **PaymentMethod** | [**ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional] **ReferenceId** | **string** | Reference ID of the charge | [optional] **Refunds** | [**ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional] diff --git a/docs/ChargeResponsePaymentMethod.md b/docs/ChargeResponsePaymentMethod.md index 6687ba9..8c6f9f3 100644 --- a/docs/ChargeResponsePaymentMethod.md +++ b/docs/ChargeResponsePaymentMethod.md @@ -14,16 +14,17 @@ Name | Type | Description | Notes **ServiceName** | **string** | | [optional] **Store** | **string** | | [optional] **StoreName** | **string** | | [optional] -**AccountType** | **string** | | [optional] -**Brand** | **string** | | [optional] +**CustomerIpAddress** | **string** | | [optional] +**AccountType** | **string** | Account type of the card | [optional] +**Brand** | **string** | Brand of the card | [optional] **ContractId** | **string** | Id sent for recurrent charges. | [optional] -**Country** | **string** | | [optional] -**ExpMonth** | **string** | | [optional] -**ExpYear** | **string** | | [optional] +**Country** | **string** | Country of the card | [optional] +**ExpMonth** | **string** | Expiration month of the card | [optional] +**ExpYear** | **string** | Expiration year of the card | [optional] **FraudIndicators** | **List<Object>** | | [optional] -**Issuer** | **string** | | [optional] -**Last4** | **string** | | [optional] -**Name** | **string** | | [optional] +**Issuer** | **string** | Issuer of the card | [optional] +**Last4** | **string** | Last 4 digits of the card | [optional] +**Name** | **string** | Name of the cardholder | [optional] **Bank** | **string** | | [optional] **Clabe** | **string** | | [optional] **Description** | **string** | | [optional] diff --git a/docs/ChargesDataResponse.md b/docs/ChargesDataResponse.md index c994cd7..df2d37c 100644 --- a/docs/ChargesDataResponse.md +++ b/docs/ChargesDataResponse.md @@ -13,11 +13,11 @@ Name | Type | Description | Notes **DeviceFingerprint** | **string** | | [optional] **FailureCode** | **string** | | [optional] **FailureMessage** | **string** | | [optional] -**Id** | **string** | | [optional] -**Livemode** | **bool** | | [optional] +**Id** | **string** | Charge ID | [optional] +**Livemode** | **bool** | Whether the charge was made in live mode or not | [optional] **Object** | **string** | | [optional] -**OrderId** | **string** | | [optional] -**PaidAt** | **int?** | | [optional] +**OrderId** | **string** | Order ID | [optional] +**PaidAt** | **long?** | Payment date | [optional] **PaymentMethod** | [**ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional] **ReferenceId** | **string** | Reference ID of the charge | [optional] **Refunds** | [**ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional] diff --git a/docs/Checkout.md b/docs/Checkout.md index 618103b..5668811 100644 --- a/docs/Checkout.md +++ b/docs/Checkout.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **ExpiresAt** | **long** | It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 2 to 365 days (the valid range will be taken from the next day of the creation date at 00:01 hrs) | **MonthlyInstallmentsEnabled** | **bool** | This flag allows you to specify if months without interest will be active. | [optional] **MonthlyInstallmentsOptions** | **List<int>** | This field allows you to specify the number of months without interest. | [optional] +**ThreeDsMode** | **string** | Indicates the 3DS2 mode for the order, either smart or strict. | [optional] **Name** | **string** | Reason for charge | **NeedsShippingContact** | **bool** | This flag allows you to fill in the shipping information at checkout. | [optional] **OnDemandEnabled** | **bool?** | This flag allows you to specify if the link will be on demand. | [optional] diff --git a/docs/OrderRefundRequest.md b/docs/OrderRefundRequest.md index 766c8cf..1cdad54 100644 --- a/docs/OrderRefundRequest.md +++ b/docs/OrderRefundRequest.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Amount** | **int** | | +**Amount** | **int** | Amount to be refunded in cents | **ExpiresAt** | **long?** | | [optional] -**Reason** | **string** | | +**Reason** | **string** | Reason for the refund | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/OrderRequest.md b/docs/OrderRequest.md index 5e974c7..c141abd 100644 --- a/docs/OrderRequest.md +++ b/docs/OrderRequest.md @@ -16,7 +16,7 @@ Name | Type | Description | Notes **NeedsShippingContact** | **bool** | Allows you to fill out the shipping information at checkout | [optional] **PreAuthorize** | **bool** | Indicates whether the order charges must be preauthorized | [optional] [default to false] **ProcessingMode** | **string** | Indicates the processing mode for the order, either ecommerce, recurrent or validation. | [optional] -**ReturnUrl** | **string** | Indicates the redirection callback upon completion of the 3DS2 flow. | [optional] +**ReturnUrl** | **string** | Indicates the redirection callback upon completion of the 3DS2 flow. Do not use this parameter if your order has a checkout parameter | [optional] **ShippingContact** | [**CustomerShippingContacts**](CustomerShippingContacts.md) | | [optional] **ShippingLines** | [**List<ShippingRequest>**](ShippingRequest.md) | List of [shipping costs](https://developers.conekta.com/v2.1.0/reference/orderscreateshipping). If the online store offers digital products. | [optional] **TaxLines** | [**List<OrderTaxRequest>**](OrderTaxRequest.md) | List of [taxes](https://developers.conekta.com/v2.1.0/reference/orderscreatetaxes) that are applied to the order. | [optional] diff --git a/docs/PaymentMethodBankTransfer.md b/docs/PaymentMethodBankTransfer.md index fd9affb..0c60e2b 100644 --- a/docs/PaymentMethodBankTransfer.md +++ b/docs/PaymentMethodBankTransfer.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **ReceivingAccountTaxId** | **string** | | [optional] **ReferenceNumber** | **string** | | [optional] **TrackingCode** | **string** | | [optional] +**CustomerIpAddress** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PaymentMethodCard.md b/docs/PaymentMethodCard.md index 74220a9..3079d20 100644 --- a/docs/PaymentMethodCard.md +++ b/docs/PaymentMethodCard.md @@ -6,17 +6,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Type** | **string** | | [optional] **Object** | **string** | | -**AccountType** | **string** | | [optional] +**AccountType** | **string** | Account type of the card | [optional] **AuthCode** | **string** | | [optional] -**Brand** | **string** | | [optional] +**Brand** | **string** | Brand of the card | [optional] **ContractId** | **string** | Id sent for recurrent charges. | [optional] -**Country** | **string** | | [optional] -**ExpMonth** | **string** | | [optional] -**ExpYear** | **string** | | [optional] +**Country** | **string** | Country of the card | [optional] +**ExpMonth** | **string** | Expiration month of the card | [optional] +**ExpYear** | **string** | Expiration year of the card | [optional] **FraudIndicators** | **List<Object>** | | [optional] -**Issuer** | **string** | | [optional] -**Last4** | **string** | | [optional] -**Name** | **string** | | [optional] +**Issuer** | **string** | Issuer of the card | [optional] +**Last4** | **string** | Last 4 digits of the card | [optional] +**Name** | **string** | Name of the cardholder | [optional] +**CustomerIpAddress** | **string** | Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PaymentMethodCardRequest.md b/docs/PaymentMethodCardRequest.md index 7541cef..1e61748 100644 --- a/docs/PaymentMethodCardRequest.md +++ b/docs/PaymentMethodCardRequest.md @@ -5,7 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Type** | **string** | Type of payment method | -**TokenId** | **string** | Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards. | +**Cvc** | **string** | Card security code | +**ExpMonth** | **string** | Card expiration month | +**ExpYear** | **string** | Card expiration year | +**Name** | **string** | Cardholder name | +**Number** | **string** | Card number | +**CustomerIpAddress** | **string** | Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PaymentMethodCash.md b/docs/PaymentMethodCash.md index aa52f15..53eee1d 100644 --- a/docs/PaymentMethodCash.md +++ b/docs/PaymentMethodCash.md @@ -14,6 +14,7 @@ Name | Type | Description | Notes **ServiceName** | **string** | | [optional] **Store** | **string** | | [optional] **StoreName** | **string** | | [optional] +**CustomerIpAddress** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PaymentMethodGeneralRequest.md b/docs/PaymentMethodGeneralRequest.md new file mode 100644 index 0000000..c6098fe --- /dev/null +++ b/docs/PaymentMethodGeneralRequest.md @@ -0,0 +1,18 @@ +# Conekta.net.Model.PaymentMethodGeneralRequest +Payment method used in the charge. Go to the [payment methods](https://developers.conekta.com/reference/m%C3%A9todos-de-pago) section for more details + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ExpiresAt** | **long** | Method expiration date as unix timestamp | [optional] +**MonthlyInstallments** | **int** | How many months without interest to apply, it can be 3, 6, 9, 12 or 18 | [optional] +**Type** | **string** | Type of payment method | +**TokenId** | **string** | | [optional] +**PaymentSourceId** | **string** | | [optional] +**Cvc** | **string** | Optional, It is a value that allows identifying the security code of the card. Only for PCI merchants | [optional] +**ContractId** | **string** | Optional id sent to indicate the bank contract for recurrent card charges. | [optional] +**CustomerIpAddress** | **string** | Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PaymentMethodTokenRequest.md b/docs/PaymentMethodTokenRequest.md new file mode 100644 index 0000000..2e0dbc1 --- /dev/null +++ b/docs/PaymentMethodTokenRequest.md @@ -0,0 +1,11 @@ +# Conekta.net.Model.PaymentMethodTokenRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type** | **string** | Type of payment method | +**TokenId** | **string** | Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/SubscriptionResponse.md b/docs/SubscriptionResponse.md index ddd3ddd..8f70d85 100644 --- a/docs/SubscriptionResponse.md +++ b/docs/SubscriptionResponse.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **BillingCycleStart** | **long?** | | [optional] **BillingCycleEnd** | **long?** | | [optional] **CanceledAt** | **long?** | | [optional] +**CanceledReason** | **string** | Reason for cancellation. This field appears when the subscription status is 'canceled'. | [optional] **CardId** | **string** | | [optional] **ChargeId** | **string** | | [optional] **CreatedAt** | **long** | | [optional] diff --git a/src/Conekta.net.Test/Api/ChargesApiTests.cs b/src/Conekta.net.Test/Api/ChargesApiTests.cs index 1e53a2e..1206125 100644 --- a/src/Conekta.net.Test/Api/ChargesApiTests.cs +++ b/src/Conekta.net.Test/Api/ChargesApiTests.cs @@ -53,9 +53,19 @@ public void InstanceTest() public void OrdersCreateChargeCardTest() { string id = "ord_2tVKxbhNzfUnGjnXG"; + + PaymentMethodCardRequest cardRequest = new PaymentMethodCardRequest( + type: "credit", + cvc: "123", + expMonth: "12", + expYear: "2025", + name: "John Doe", + number: "4242424242424242" + ); + ChargeRequest chargeRequest = new( amount: 40000, - paymentMethod: new ChargeRequestPaymentMethod(type: "card", tokenId: "tok_2tVKyGpobEKAR3xVH") + paymentMethod: new ChargeRequestPaymentMethod(cardRequest) ); var response = _instance.OrdersCreateCharge(id, chargeRequest); @@ -74,9 +84,17 @@ public void OrdersCreateChargeCardTest() public void OrdersCreateChargeCashTest() { string id = "ord_2tVL8dT1Hm3y3YiaN"; + PaymentMethodCardRequest cardRequest = new PaymentMethodCardRequest( + type: "credit", + cvc: "123", + expMonth: "12", + expYear: "2025", + name: "John Doe", + number: "4242424242424242" + ); ChargeRequest chargeRequest = new( amount: 40000, - paymentMethod: new ChargeRequestPaymentMethod(type: "cash") + paymentMethod: new ChargeRequestPaymentMethod(cardRequest) ); var response = _instance.OrdersCreateCharge(id, chargeRequest); @@ -99,9 +117,17 @@ public void OrdersCreateChargeCashTest() public void OrdersCreateChargeSpeiTest() { string id = "ord_2tVLUFrQBB4HKz1zj"; + PaymentMethodCardRequest cardRequest = new PaymentMethodCardRequest( + type: "credit", + cvc: "123", + expMonth: "12", + expYear: "2025", + name: "John Doe", + number: "4242424242424242" + ); ChargeRequest chargeRequest = new( amount: 40000, - paymentMethod: new ChargeRequestPaymentMethod(type: "spei") + paymentMethod: new ChargeRequestPaymentMethod(cardRequest) ); var response = _instance.OrdersCreateCharge(id, chargeRequest); diff --git a/src/Conekta.net.Test/Api/CustomersApiTests.cs b/src/Conekta.net.Test/Api/CustomersApiTests.cs index 78cb438..775976a 100644 --- a/src/Conekta.net.Test/Api/CustomersApiTests.cs +++ b/src/Conekta.net.Test/Api/CustomersApiTests.cs @@ -274,11 +274,13 @@ private static Customer GetFullCustomer() metadata: new Dictionary { { "test", "true" } } ) }; + PaymentMethodTokenRequest tokenRequest = new PaymentMethodTokenRequest( + type: "card", + tokenId: "test_5478sdfwefw" + ); var paymentSources = new List() { - new CustomerPaymentMethodsRequest( - new PaymentMethodCardRequest("card", "tok_2tXyExrU6U7yiaTto") - ) + new CustomerPaymentMethodsRequest(tokenRequest) }; List shippingContacts = new() { diff --git a/src/Conekta.net.Test/Api/OrdersApiTests.cs b/src/Conekta.net.Test/Api/OrdersApiTests.cs index e233daf..eafbb6c 100644 --- a/src/Conekta.net.Test/Api/OrdersApiTests.cs +++ b/src/Conekta.net.Test/Api/OrdersApiTests.cs @@ -64,13 +64,21 @@ public void CreateOrderCashTest() unitPrice: 1555 ) }; + PaymentMethodCardRequest cardRequest = new PaymentMethodCardRequest( + type: "credit", + cvc: "123", + expMonth: "1", + expYear: "1970", + name: "John Doe", + number: "4242424242424242" + ); DateTime thirtyDaysFromNowDateTime = DateTime.Now.AddDays(30); var expiresAt = (Int64)thirtyDaysFromNowDateTime.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; List charges = new() { new( 1555, - paymentMethod: new ChargeRequestPaymentMethod(expiresAt:expiresAt, type:"cash") + paymentMethod: new ChargeRequestPaymentMethod(cardRequest) ) }; OrderRequestCustomerInfo customerInfo = new(new CustomerInfoJustCustomerId("cus_2tKcHxhTz7xU5SymF")); @@ -111,7 +119,7 @@ public void CreateOrderCashTest() Assert.Equal("OxxoPay", response.Charges.Data[0].PaymentMethod.GetPaymentMethodCash().ServiceName); Assert.Equal("93000262280678", response.Charges.Data[0].PaymentMethod.GetPaymentMethodCash().Reference); Assert.Equal("oxxo", response.Charges.Data[0].PaymentMethod.GetPaymentMethodCash().Type); - Assert.Equal(expiresAt, response.Charges.Data[0].PaymentMethod.GetPaymentMethodCash().ExpiresAt); + Assert.Equal(1683232092, response.Charges.Data[0].PaymentMethod.GetPaymentMethodCash().ExpiresAt); } /// /// Test CreateOrderDefaultErr @@ -129,16 +137,21 @@ public void CreateOrderDefaultErrTest() tags: new List {"pago", "mensualidad"} ) }; + PaymentMethodCardRequest cardRequest = new PaymentMethodCardRequest( + type: "credit", + cvc: "123", + expMonth: "12", + expYear: "2025", + name: "John Doe", + number: "4242424242424242" + ); DateTime thirtyDaysFromNowDateTime = DateTime.Now.AddDays(30); var expiresAt = (Int64)thirtyDaysFromNowDateTime.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; List charges = new() { new( 2000, - paymentMethod: new ChargeRequestPaymentMethod( - type:"default", - expiresAt: expiresAt - ) + paymentMethod: new ChargeRequestPaymentMethod(cardRequest) ) }; OrderRequestCustomerInfo customerInfo = new(new CustomerInfoJustCustomerId("cus_2tKcHxhTz7xU5SymF2")); diff --git a/src/Conekta.net/Client/Configuration.cs b/src/Conekta.net/Client/Configuration.cs index 32c022d..863fb18 100644 --- a/src/Conekta.net/Client/Configuration.cs +++ b/src/Conekta.net/Client/Configuration.cs @@ -34,7 +34,7 @@ public class Configuration : IReadableConfiguration /// Version of the package. /// /// Version of the package. - public const string Version = "6.0.10"; + public const string Version = "6.0.11"; /// /// Identifier for ISO 8601 DateTime Format @@ -536,7 +536,7 @@ public static string ToDebugReport() report += " OS: " + System.Environment.OSVersion + "\n"; report += " .NET Framework Version: " + System.Environment.Version + "\n"; report += " Version of the API: 2.1.0\n"; - report += " SDK Package Version: 6.0.10\n"; + report += " SDK Package Version: 6.0.11\n"; return report; } diff --git a/src/Conekta.net/Conekta.net.csproj b/src/Conekta.net/Conekta.net.csproj index 47b3a7d..4c4e80a 100644 --- a/src/Conekta.net/Conekta.net.csproj +++ b/src/Conekta.net/Conekta.net.csproj @@ -12,7 +12,7 @@ This is a .net library that allows interaction with https://api.conekta.io API. Conekta Conekta.net - 6.0.10 + 6.0.11 bin\$(Configuration)\$(TargetFramework)\Conekta.net.xml https://github.com/conekta/conekta-.net.git git @@ -22,7 +22,7 @@ - + diff --git a/src/Conekta.net/Model/ChargeRequest.cs b/src/Conekta.net/Model/ChargeRequest.cs index 78da3c8..c786a62 100644 --- a/src/Conekta.net/Model/ChargeRequest.cs +++ b/src/Conekta.net/Model/ChargeRequest.cs @@ -40,7 +40,7 @@ protected ChargeRequest() { } /// /// Initializes a new instance of the class. /// - /// amount. + /// Amount to be charged in cents. /// paymentMethod (required). /// Custom reference to add to the charge. public ChargeRequest(int amount = default(int), ChargeRequestPaymentMethod paymentMethod = default(ChargeRequestPaymentMethod), string referenceId = default(string)) @@ -56,8 +56,9 @@ protected ChargeRequest() { } } /// - /// Gets or Sets Amount + /// Amount to be charged in cents /// + /// Amount to be charged in cents /// 40000 [DataMember(Name = "amount", EmitDefaultValue = false)] public int Amount { get; set; } diff --git a/src/Conekta.net/Model/ChargeRequestPaymentMethod.cs b/src/Conekta.net/Model/ChargeRequestPaymentMethod.cs index 2d4352b..6ddba72 100644 --- a/src/Conekta.net/Model/ChargeRequestPaymentMethod.cs +++ b/src/Conekta.net/Model/ChargeRequestPaymentMethod.cs @@ -23,87 +23,89 @@ using Newtonsoft.Json.Linq; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Conekta.net.Client.OpenAPIDateConverter; +using System.Reflection; namespace Conekta.net.Model { /// - /// Payment method used in the charge. Go to the [payment methods](https://developers.conekta.com/reference/m%C3%A9todos-de-pago) section for more details + /// ChargeRequestPaymentMethod /// + [JsonConverter(typeof(ChargeRequestPaymentMethodJsonConverter))] [DataContract(Name = "charge_request_payment_method")] - public partial class ChargeRequestPaymentMethod : IValidatableObject + public partial class ChargeRequestPaymentMethod : AbstractOpenAPISchema, IValidatableObject { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class + /// with the class /// - [JsonConstructorAttribute] - protected ChargeRequestPaymentMethod() { } - /// - /// Initializes a new instance of the class. - /// - /// Method expiration date as unix timestamp. - /// How many months without interest to apply, it can be 3, 6, 9, 12 or 18. - /// type (required). - /// tokenId. - /// paymentSourceId. - /// Optional id sent to indicate the bank contract for recurrent card charges.. - public ChargeRequestPaymentMethod(long expiresAt = default(long), int monthlyInstallments = default(int), string type = default(string), string tokenId = default(string), string paymentSourceId = default(string), string contractId = default(string)) + /// An instance of PaymentMethodCardRequest. + public ChargeRequestPaymentMethod(PaymentMethodCardRequest actualInstance) { - // to ensure "type" is required (not null) - if (type == null) - { - throw new ArgumentNullException("type is a required property for ChargeRequestPaymentMethod and cannot be null"); - } - this.Type = type; - this.ExpiresAt = expiresAt; - this.MonthlyInstallments = monthlyInstallments; - this.TokenId = tokenId; - this.PaymentSourceId = paymentSourceId; - this.ContractId = contractId; + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); } /// - /// Method expiration date as unix timestamp + /// Initializes a new instance of the class + /// with the class /// - /// Method expiration date as unix timestamp - /// 1677196303 - [DataMember(Name = "expires_at", EmitDefaultValue = false)] - public long ExpiresAt { get; set; } + /// An instance of PaymentMethodGeneralRequest. + public ChargeRequestPaymentMethod(PaymentMethodGeneralRequest actualInstance) + { + this.IsNullable = false; + this.SchemaType= "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } - /// - /// How many months without interest to apply, it can be 3, 6, 9, 12 or 18 - /// - /// How many months without interest to apply, it can be 3, 6, 9, 12 or 18 - [DataMember(Name = "monthly_installments", EmitDefaultValue = false)] - public int MonthlyInstallments { get; set; } - /// - /// Gets or Sets Type - /// - /// card - [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] - public string Type { get; set; } + private Object _actualInstance; /// - /// Gets or Sets TokenId + /// Gets or Sets ActualInstance /// - /// tok_2897348234 - [DataMember(Name = "token_id", EmitDefaultValue = false)] - public string TokenId { get; set; } + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(PaymentMethodCardRequest)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PaymentMethodGeneralRequest)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: PaymentMethodCardRequest, PaymentMethodGeneralRequest"); + } + } + } /// - /// Gets or Sets PaymentSourceId + /// Get the actual instance of `PaymentMethodCardRequest`. If the actual instance is not `PaymentMethodCardRequest`, + /// the InvalidClassException will be thrown /// - /// src_2tLkkyfMPh6v7pFry - [DataMember(Name = "payment_source_id", EmitDefaultValue = false)] - public string PaymentSourceId { get; set; } + /// An instance of PaymentMethodCardRequest + public PaymentMethodCardRequest GetPaymentMethodCardRequest() + { + return (PaymentMethodCardRequest)this.ActualInstance; + } /// - /// Optional id sent to indicate the bank contract for recurrent card charges. + /// Get the actual instance of `PaymentMethodGeneralRequest`. If the actual instance is not `PaymentMethodGeneralRequest`, + /// the InvalidClassException will be thrown /// - /// Optional id sent to indicate the bank contract for recurrent card charges. - /// S781317595 - [DataMember(Name = "contract_id", EmitDefaultValue = false)] - public string ContractId { get; set; } + /// An instance of PaymentMethodGeneralRequest + public PaymentMethodGeneralRequest GetPaymentMethodGeneralRequest() + { + return (PaymentMethodGeneralRequest)this.ActualInstance; + } /// /// Returns the string presentation of the object @@ -111,14 +113,9 @@ protected ChargeRequestPaymentMethod() { } /// String presentation of the object public override string ToString() { - StringBuilder sb = new StringBuilder(); + var sb = new StringBuilder(); sb.Append("class ChargeRequestPaymentMethod {\n"); - sb.Append(" ExpiresAt: ").Append(ExpiresAt).Append("\n"); - sb.Append(" MonthlyInstallments: ").Append(MonthlyInstallments).Append("\n"); - sb.Append(" Type: ").Append(Type).Append("\n"); - sb.Append(" TokenId: ").Append(TokenId).Append("\n"); - sb.Append(" PaymentSourceId: ").Append(PaymentSourceId).Append("\n"); - sb.Append(" ContractId: ").Append(ContractId).Append("\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -127,11 +124,81 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, ChargeRequestPaymentMethod.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of ChargeRequestPaymentMethod + /// + /// JSON string + /// An instance of ChargeRequestPaymentMethod + public static ChargeRequestPaymentMethod FromJson(string jsonString) { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + ChargeRequestPaymentMethod newChargeRequestPaymentMethod = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newChargeRequestPaymentMethod; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PaymentMethodCardRequest).GetProperty("AdditionalProperties") == null) + { + newChargeRequestPaymentMethod = new ChargeRequestPaymentMethod(JsonConvert.DeserializeObject(jsonString, ChargeRequestPaymentMethod.SerializerSettings)); + } + else + { + newChargeRequestPaymentMethod = new ChargeRequestPaymentMethod(JsonConvert.DeserializeObject(jsonString, ChargeRequestPaymentMethod.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PaymentMethodCardRequest"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodCardRequest: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PaymentMethodGeneralRequest).GetProperty("AdditionalProperties") == null) + { + newChargeRequestPaymentMethod = new ChargeRequestPaymentMethod(JsonConvert.DeserializeObject(jsonString, ChargeRequestPaymentMethod.SerializerSettings)); + } + else + { + newChargeRequestPaymentMethod = new ChargeRequestPaymentMethod(JsonConvert.DeserializeObject(jsonString, ChargeRequestPaymentMethod.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PaymentMethodGeneralRequest"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodGeneralRequest: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newChargeRequestPaymentMethod; } + /// /// To validate all properties of the instance /// @@ -143,4 +210,52 @@ public virtual string ToJson() } } + /// + /// Custom JSON converter for ChargeRequestPaymentMethod + /// + public class ChargeRequestPaymentMethodJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(ChargeRequestPaymentMethod).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + switch(reader.TokenType) + { + case JsonToken.StartObject: + return ChargeRequestPaymentMethod.FromJson(JObject.Load(reader).ToString(Formatting.None)); + case JsonToken.StartArray: + return ChargeRequestPaymentMethod.FromJson(JArray.Load(reader).ToString(Formatting.None)); + default: + return null; + } + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + } diff --git a/src/Conekta.net/Model/ChargeResponse.cs b/src/Conekta.net/Model/ChargeResponse.cs index 55156a5..fa521b4 100644 --- a/src/Conekta.net/Model/ChargeResponse.cs +++ b/src/Conekta.net/Model/ChargeResponse.cs @@ -44,16 +44,16 @@ public partial class ChargeResponse : IValidatableObject /// deviceFingerprint. /// failureCode. /// failureMessage. - /// id. - /// livemode. + /// Charge ID. + /// Whether the charge was made in live mode or not. /// varObject. - /// orderId. - /// paidAt. + /// Order ID. + /// Payment date. /// paymentMethod. /// Reference ID of the charge. /// refunds. /// status. - public ChargeResponse(int amount = default(int), ChargeResponseChannel channel = default(ChargeResponseChannel), long createdAt = default(long), string currency = default(string), string customerId = default(string), string description = default(string), string deviceFingerprint = default(string), string failureCode = default(string), string failureMessage = default(string), string id = default(string), bool livemode = default(bool), string varObject = default(string), string orderId = default(string), int? paidAt = default(int?), ChargeResponsePaymentMethod paymentMethod = default(ChargeResponsePaymentMethod), string referenceId = default(string), ChargeResponseRefunds refunds = default(ChargeResponseRefunds), string status = default(string)) + public ChargeResponse(int amount = default(int), ChargeResponseChannel channel = default(ChargeResponseChannel), long createdAt = default(long), string currency = default(string), string customerId = default(string), string description = default(string), string deviceFingerprint = default(string), string failureCode = default(string), string failureMessage = default(string), string id = default(string), bool livemode = default(bool), string varObject = default(string), string orderId = default(string), long? paidAt = default(long?), ChargeResponsePaymentMethod paymentMethod = default(ChargeResponsePaymentMethod), string referenceId = default(string), ChargeResponseRefunds refunds = default(ChargeResponseRefunds), string status = default(string)) { this.Amount = amount; this.Channel = channel; @@ -137,37 +137,43 @@ public partial class ChargeResponse : IValidatableObject public string FailureMessage { get; set; } /// - /// Gets or Sets Id + /// Charge ID /// + /// Charge ID /// 63efa757cf65380001aec040 [DataMember(Name = "id", EmitDefaultValue = false)] public string Id { get; set; } /// - /// Gets or Sets Livemode + /// Whether the charge was made in live mode or not /// + /// Whether the charge was made in live mode or not + /// false [DataMember(Name = "livemode", EmitDefaultValue = true)] public bool Livemode { get; set; } /// /// Gets or Sets Object /// + /// charge [DataMember(Name = "object", EmitDefaultValue = false)] public string Object { get; set; } /// - /// Gets or Sets OrderId + /// Order ID /// + /// Order ID /// ord_2tN73UdUSNrYRPD9r [DataMember(Name = "order_id", EmitDefaultValue = false)] public string OrderId { get; set; } /// - /// Gets or Sets PaidAt + /// Payment date /// + /// Payment date /// 1676390742 [DataMember(Name = "paid_at", EmitDefaultValue = true)] - public int? PaidAt { get; set; } + public long? PaidAt { get; set; } /// /// Gets or Sets PaymentMethod diff --git a/src/Conekta.net/Model/ChargesDataResponse.cs b/src/Conekta.net/Model/ChargesDataResponse.cs index d6045aa..519b072 100644 --- a/src/Conekta.net/Model/ChargesDataResponse.cs +++ b/src/Conekta.net/Model/ChargesDataResponse.cs @@ -44,16 +44,16 @@ public partial class ChargesDataResponse : IValidatableObject /// deviceFingerprint. /// failureCode. /// failureMessage. - /// id. - /// livemode. + /// Charge ID. + /// Whether the charge was made in live mode or not. /// varObject. - /// orderId. - /// paidAt. + /// Order ID. + /// Payment date. /// paymentMethod. /// Reference ID of the charge. /// refunds. /// status. - public ChargesDataResponse(int amount = default(int), ChargeResponseChannel channel = default(ChargeResponseChannel), long createdAt = default(long), string currency = default(string), string customerId = default(string), string description = default(string), string deviceFingerprint = default(string), string failureCode = default(string), string failureMessage = default(string), string id = default(string), bool livemode = default(bool), string varObject = default(string), string orderId = default(string), int? paidAt = default(int?), ChargeResponsePaymentMethod paymentMethod = default(ChargeResponsePaymentMethod), string referenceId = default(string), ChargeResponseRefunds refunds = default(ChargeResponseRefunds), string status = default(string)) + public ChargesDataResponse(int amount = default(int), ChargeResponseChannel channel = default(ChargeResponseChannel), long createdAt = default(long), string currency = default(string), string customerId = default(string), string description = default(string), string deviceFingerprint = default(string), string failureCode = default(string), string failureMessage = default(string), string id = default(string), bool livemode = default(bool), string varObject = default(string), string orderId = default(string), long? paidAt = default(long?), ChargeResponsePaymentMethod paymentMethod = default(ChargeResponsePaymentMethod), string referenceId = default(string), ChargeResponseRefunds refunds = default(ChargeResponseRefunds), string status = default(string)) { this.Amount = amount; this.Channel = channel; @@ -137,37 +137,43 @@ public partial class ChargesDataResponse : IValidatableObject public string FailureMessage { get; set; } /// - /// Gets or Sets Id + /// Charge ID /// + /// Charge ID /// 63efa757cf65380001aec040 [DataMember(Name = "id", EmitDefaultValue = false)] public string Id { get; set; } /// - /// Gets or Sets Livemode + /// Whether the charge was made in live mode or not /// + /// Whether the charge was made in live mode or not + /// false [DataMember(Name = "livemode", EmitDefaultValue = true)] public bool Livemode { get; set; } /// /// Gets or Sets Object /// + /// charge [DataMember(Name = "object", EmitDefaultValue = false)] public string Object { get; set; } /// - /// Gets or Sets OrderId + /// Order ID /// + /// Order ID /// ord_2tN73UdUSNrYRPD9r [DataMember(Name = "order_id", EmitDefaultValue = false)] public string OrderId { get; set; } /// - /// Gets or Sets PaidAt + /// Payment date /// + /// Payment date /// 1676390742 [DataMember(Name = "paid_at", EmitDefaultValue = true)] - public int? PaidAt { get; set; } + public long? PaidAt { get; set; } /// /// Gets or Sets PaymentMethod diff --git a/src/Conekta.net/Model/Checkout.cs b/src/Conekta.net/Model/Checkout.cs index 1c78a6a..b6a8adb 100644 --- a/src/Conekta.net/Model/Checkout.cs +++ b/src/Conekta.net/Model/Checkout.cs @@ -44,6 +44,7 @@ protected Checkout() { } /// It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 2 to 365 days (the valid range will be taken from the next day of the creation date at 00:01 hrs) (required). /// This flag allows you to specify if months without interest will be active.. /// This field allows you to specify the number of months without interest.. + /// Indicates the 3DS2 mode for the order, either smart or strict.. /// Reason for charge (required). /// This flag allows you to fill in the shipping information at checkout.. /// This flag allows you to specify if the link will be on demand.. @@ -51,7 +52,7 @@ protected Checkout() { } /// It is the number of payments that can be made through the link.. /// false: single use. true: multiple payments (required). /// It is the type of link that will be created. It must be a valid type. (required). - public Checkout(List allowedPaymentMethods = default(List), long expiresAt = default(long), bool monthlyInstallmentsEnabled = default(bool), List monthlyInstallmentsOptions = default(List), string name = default(string), bool needsShippingContact = default(bool), bool? onDemandEnabled = default(bool?), CheckoutOrderTemplate orderTemplate = default(CheckoutOrderTemplate), int paymentsLimitCount = default(int), bool recurrent = default(bool), string type = default(string)) + public Checkout(List allowedPaymentMethods = default(List), long expiresAt = default(long), bool monthlyInstallmentsEnabled = default(bool), List monthlyInstallmentsOptions = default(List), string threeDsMode = default(string), string name = default(string), bool needsShippingContact = default(bool), bool? onDemandEnabled = default(bool?), CheckoutOrderTemplate orderTemplate = default(CheckoutOrderTemplate), int paymentsLimitCount = default(int), bool recurrent = default(bool), string type = default(string)) { // to ensure "allowedPaymentMethods" is required (not null) if (allowedPaymentMethods == null) @@ -81,6 +82,7 @@ protected Checkout() { } this.Type = type; this.MonthlyInstallmentsEnabled = monthlyInstallmentsEnabled; this.MonthlyInstallmentsOptions = monthlyInstallmentsOptions; + this.ThreeDsMode = threeDsMode; this.NeedsShippingContact = needsShippingContact; this.OnDemandEnabled = onDemandEnabled; this.PaymentsLimitCount = paymentsLimitCount; @@ -118,6 +120,13 @@ protected Checkout() { } [DataMember(Name = "monthly_installments_options", EmitDefaultValue = false)] public List MonthlyInstallmentsOptions { get; set; } + /// + /// Indicates the 3DS2 mode for the order, either smart or strict. + /// + /// Indicates the 3DS2 mode for the order, either smart or strict. + [DataMember(Name = "three_ds_mode", EmitDefaultValue = false)] + public string ThreeDsMode { get; set; } + /// /// Reason for charge /// @@ -184,6 +193,7 @@ public override string ToString() sb.Append(" ExpiresAt: ").Append(ExpiresAt).Append("\n"); sb.Append(" MonthlyInstallmentsEnabled: ").Append(MonthlyInstallmentsEnabled).Append("\n"); sb.Append(" MonthlyInstallmentsOptions: ").Append(MonthlyInstallmentsOptions).Append("\n"); + sb.Append(" ThreeDsMode: ").Append(ThreeDsMode).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" NeedsShippingContact: ").Append(NeedsShippingContact).Append("\n"); sb.Append(" OnDemandEnabled: ").Append(OnDemandEnabled).Append("\n"); diff --git a/src/Conekta.net/Model/CreateCustomerPaymentMethodsRequest.cs b/src/Conekta.net/Model/CreateCustomerPaymentMethodsRequest.cs index f19f3a0..3c7ecce 100644 --- a/src/Conekta.net/Model/CreateCustomerPaymentMethodsRequest.cs +++ b/src/Conekta.net/Model/CreateCustomerPaymentMethodsRequest.cs @@ -36,10 +36,10 @@ public partial class CreateCustomerPaymentMethodsRequest : AbstractOpenAPISchema { /// /// Initializes a new instance of the class - /// with the class + /// with the class /// - /// An instance of PaymentMethodCardRequest. - public CreateCustomerPaymentMethodsRequest(PaymentMethodCardRequest actualInstance) + /// An instance of PaymentMethodTokenRequest. + public CreateCustomerPaymentMethodsRequest(PaymentMethodTokenRequest actualInstance) { this.IsNullable = false; this.SchemaType= "oneOf"; @@ -84,33 +84,33 @@ public override Object ActualInstance } set { - if (value.GetType() == typeof(PaymentMethodCardRequest)) + if (value.GetType() == typeof(PaymentMethodCashRequest)) { this._actualInstance = value; } - else if (value.GetType() == typeof(PaymentMethodCashRequest)) + else if (value.GetType() == typeof(PaymentMethodSpeiRequest)) { this._actualInstance = value; } - else if (value.GetType() == typeof(PaymentMethodSpeiRequest)) + else if (value.GetType() == typeof(PaymentMethodTokenRequest)) { this._actualInstance = value; } else { - throw new ArgumentException("Invalid instance found. Must be the following types: PaymentMethodCardRequest, PaymentMethodCashRequest, PaymentMethodSpeiRequest"); + throw new ArgumentException("Invalid instance found. Must be the following types: PaymentMethodCashRequest, PaymentMethodSpeiRequest, PaymentMethodTokenRequest"); } } } /// - /// Get the actual instance of `PaymentMethodCardRequest`. If the actual instance is not `PaymentMethodCardRequest`, + /// Get the actual instance of `PaymentMethodTokenRequest`. If the actual instance is not `PaymentMethodTokenRequest`, /// the InvalidClassException will be thrown /// - /// An instance of PaymentMethodCardRequest - public PaymentMethodCardRequest GetPaymentMethodCardRequest() + /// An instance of PaymentMethodTokenRequest + public PaymentMethodTokenRequest GetPaymentMethodTokenRequest() { - return (PaymentMethodCardRequest)this.ActualInstance; + return (PaymentMethodTokenRequest)this.ActualInstance; } /// @@ -174,61 +174,61 @@ public static CreateCustomerPaymentMethodsRequest FromJson(string jsonString) try { // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize - if (typeof(PaymentMethodCardRequest).GetProperty("AdditionalProperties") == null) + if (typeof(PaymentMethodCashRequest).GetProperty("AdditionalProperties") == null) { - newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.SerializerSettings)); + newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.SerializerSettings)); } else { - newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); + newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); } - matchedTypes.Add("PaymentMethodCardRequest"); + matchedTypes.Add("PaymentMethodCashRequest"); match++; } catch (Exception exception) { // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodCardRequest: {1}", jsonString, exception.ToString())); + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodCashRequest: {1}", jsonString, exception.ToString())); } try { // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize - if (typeof(PaymentMethodCashRequest).GetProperty("AdditionalProperties") == null) + if (typeof(PaymentMethodSpeiRequest).GetProperty("AdditionalProperties") == null) { - newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.SerializerSettings)); + newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.SerializerSettings)); } else { - newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); + newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); } - matchedTypes.Add("PaymentMethodCashRequest"); + matchedTypes.Add("PaymentMethodSpeiRequest"); match++; } catch (Exception exception) { // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodCashRequest: {1}", jsonString, exception.ToString())); + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodSpeiRequest: {1}", jsonString, exception.ToString())); } try { // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize - if (typeof(PaymentMethodSpeiRequest).GetProperty("AdditionalProperties") == null) + if (typeof(PaymentMethodTokenRequest).GetProperty("AdditionalProperties") == null) { - newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.SerializerSettings)); + newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.SerializerSettings)); } else { - newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); + newCreateCustomerPaymentMethodsRequest = new CreateCustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CreateCustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); } - matchedTypes.Add("PaymentMethodSpeiRequest"); + matchedTypes.Add("PaymentMethodTokenRequest"); match++; } catch (Exception exception) { // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodSpeiRequest: {1}", jsonString, exception.ToString())); + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodTokenRequest: {1}", jsonString, exception.ToString())); } if (match == 0) diff --git a/src/Conekta.net/Model/CustomerPaymentMethodsRequest.cs b/src/Conekta.net/Model/CustomerPaymentMethodsRequest.cs index 59213ad..afff5cb 100644 --- a/src/Conekta.net/Model/CustomerPaymentMethodsRequest.cs +++ b/src/Conekta.net/Model/CustomerPaymentMethodsRequest.cs @@ -36,10 +36,10 @@ public partial class CustomerPaymentMethodsRequest : AbstractOpenAPISchema, IVal { /// /// Initializes a new instance of the class - /// with the class + /// with the class /// - /// An instance of PaymentMethodCardRequest. - public CustomerPaymentMethodsRequest(PaymentMethodCardRequest actualInstance) + /// An instance of PaymentMethodTokenRequest. + public CustomerPaymentMethodsRequest(PaymentMethodTokenRequest actualInstance) { this.IsNullable = false; this.SchemaType= "oneOf"; @@ -84,33 +84,33 @@ public override Object ActualInstance } set { - if (value.GetType() == typeof(PaymentMethodCardRequest)) + if (value.GetType() == typeof(PaymentMethodCashRequest)) { this._actualInstance = value; } - else if (value.GetType() == typeof(PaymentMethodCashRequest)) + else if (value.GetType() == typeof(PaymentMethodSpeiRequest)) { this._actualInstance = value; } - else if (value.GetType() == typeof(PaymentMethodSpeiRequest)) + else if (value.GetType() == typeof(PaymentMethodTokenRequest)) { this._actualInstance = value; } else { - throw new ArgumentException("Invalid instance found. Must be the following types: PaymentMethodCardRequest, PaymentMethodCashRequest, PaymentMethodSpeiRequest"); + throw new ArgumentException("Invalid instance found. Must be the following types: PaymentMethodCashRequest, PaymentMethodSpeiRequest, PaymentMethodTokenRequest"); } } } /// - /// Get the actual instance of `PaymentMethodCardRequest`. If the actual instance is not `PaymentMethodCardRequest`, + /// Get the actual instance of `PaymentMethodTokenRequest`. If the actual instance is not `PaymentMethodTokenRequest`, /// the InvalidClassException will be thrown /// - /// An instance of PaymentMethodCardRequest - public PaymentMethodCardRequest GetPaymentMethodCardRequest() + /// An instance of PaymentMethodTokenRequest + public PaymentMethodTokenRequest GetPaymentMethodTokenRequest() { - return (PaymentMethodCardRequest)this.ActualInstance; + return (PaymentMethodTokenRequest)this.ActualInstance; } /// @@ -174,61 +174,61 @@ public static CustomerPaymentMethodsRequest FromJson(string jsonString) try { // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize - if (typeof(PaymentMethodCardRequest).GetProperty("AdditionalProperties") == null) + if (typeof(PaymentMethodCashRequest).GetProperty("AdditionalProperties") == null) { - newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.SerializerSettings)); + newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.SerializerSettings)); } else { - newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); + newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); } - matchedTypes.Add("PaymentMethodCardRequest"); + matchedTypes.Add("PaymentMethodCashRequest"); match++; } catch (Exception exception) { // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodCardRequest: {1}", jsonString, exception.ToString())); + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodCashRequest: {1}", jsonString, exception.ToString())); } try { // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize - if (typeof(PaymentMethodCashRequest).GetProperty("AdditionalProperties") == null) + if (typeof(PaymentMethodSpeiRequest).GetProperty("AdditionalProperties") == null) { - newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.SerializerSettings)); + newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.SerializerSettings)); } else { - newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); + newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); } - matchedTypes.Add("PaymentMethodCashRequest"); + matchedTypes.Add("PaymentMethodSpeiRequest"); match++; } catch (Exception exception) { // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodCashRequest: {1}", jsonString, exception.ToString())); + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodSpeiRequest: {1}", jsonString, exception.ToString())); } try { // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize - if (typeof(PaymentMethodSpeiRequest).GetProperty("AdditionalProperties") == null) + if (typeof(PaymentMethodTokenRequest).GetProperty("AdditionalProperties") == null) { - newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.SerializerSettings)); + newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.SerializerSettings)); } else { - newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); + newCustomerPaymentMethodsRequest = new CustomerPaymentMethodsRequest(JsonConvert.DeserializeObject(jsonString, CustomerPaymentMethodsRequest.AdditionalPropertiesSerializerSettings)); } - matchedTypes.Add("PaymentMethodSpeiRequest"); + matchedTypes.Add("PaymentMethodTokenRequest"); match++; } catch (Exception exception) { // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodSpeiRequest: {1}", jsonString, exception.ToString())); + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PaymentMethodTokenRequest: {1}", jsonString, exception.ToString())); } if (match == 0) diff --git a/src/Conekta.net/Model/OrderRefundRequest.cs b/src/Conekta.net/Model/OrderRefundRequest.cs index 7fb5346..1c30569 100644 --- a/src/Conekta.net/Model/OrderRefundRequest.cs +++ b/src/Conekta.net/Model/OrderRefundRequest.cs @@ -40,9 +40,9 @@ protected OrderRefundRequest() { } /// /// Initializes a new instance of the class. /// - /// amount (required). + /// Amount to be refunded in cents (required). /// expiresAt. - /// reason (required). + /// Reason for the refund (required). public OrderRefundRequest(int amount = default(int), long? expiresAt = default(long?), string reason = default(string)) { this.Amount = amount; @@ -56,8 +56,9 @@ protected OrderRefundRequest() { } } /// - /// Gets or Sets Amount + /// Amount to be refunded in cents /// + /// Amount to be refunded in cents /// 500 [DataMember(Name = "amount", IsRequired = true, EmitDefaultValue = true)] public int Amount { get; set; } @@ -70,8 +71,9 @@ protected OrderRefundRequest() { } public long? ExpiresAt { get; set; } /// - /// Gets or Sets Reason + /// Reason for the refund /// + /// Reason for the refund /// suspected_fraud [DataMember(Name = "reason", IsRequired = true, EmitDefaultValue = true)] public string Reason { get; set; } diff --git a/src/Conekta.net/Model/OrderRequest.cs b/src/Conekta.net/Model/OrderRequest.cs index 06b8155..0abeb2f 100644 --- a/src/Conekta.net/Model/OrderRequest.cs +++ b/src/Conekta.net/Model/OrderRequest.cs @@ -51,7 +51,7 @@ protected OrderRequest() { } /// Allows you to fill out the shipping information at checkout. /// Indicates whether the order charges must be preauthorized (default to false). /// Indicates the processing mode for the order, either ecommerce, recurrent or validation.. - /// Indicates the redirection callback upon completion of the 3DS2 flow.. + /// Indicates the redirection callback upon completion of the 3DS2 flow. Do not use this parameter if your order has a checkout parameter. /// shippingContact. /// List of [shipping costs](https://developers.conekta.com/v2.1.0/reference/orderscreateshipping). If the online store offers digital products.. /// List of [taxes](https://developers.conekta.com/v2.1.0/reference/orderscreatetaxes) that are applied to the order.. @@ -169,9 +169,9 @@ protected OrderRequest() { } public string ProcessingMode { get; set; } /// - /// Indicates the redirection callback upon completion of the 3DS2 flow. + /// Indicates the redirection callback upon completion of the 3DS2 flow. Do not use this parameter if your order has a checkout parameter /// - /// Indicates the redirection callback upon completion of the 3DS2 flow. + /// Indicates the redirection callback upon completion of the 3DS2 flow. Do not use this parameter if your order has a checkout parameter /// https://my-website.com [DataMember(Name = "return_url", EmitDefaultValue = false)] public string ReturnUrl { get; set; } diff --git a/src/Conekta.net/Model/PaymentMethodBankTransfer.cs b/src/Conekta.net/Model/PaymentMethodBankTransfer.cs index 7e4fe4a..6a47d47 100644 --- a/src/Conekta.net/Model/PaymentMethodBankTransfer.cs +++ b/src/Conekta.net/Model/PaymentMethodBankTransfer.cs @@ -58,7 +58,8 @@ protected PaymentMethodBankTransfer() { } /// receivingAccountTaxId. /// referenceNumber. /// trackingCode. - public PaymentMethodBankTransfer(string type = default(string), string varObject = default(string), string bank = default(string), string clabe = default(string), string description = default(string), int? executedAt = default(int?), long expiresAt = default(long), string issuingAccountBank = default(string), string issuingAccountNumber = default(string), string issuingAccountHolderName = default(string), string issuingAccountTaxId = default(string), List paymentAttempts = default(List), string receivingAccountHolderName = default(string), string receivingAccountNumber = default(string), string receivingAccountBank = default(string), string receivingAccountTaxId = default(string), string referenceNumber = default(string), string trackingCode = default(string)) + /// customerIpAddress. + public PaymentMethodBankTransfer(string type = default(string), string varObject = default(string), string bank = default(string), string clabe = default(string), string description = default(string), int? executedAt = default(int?), long expiresAt = default(long), string issuingAccountBank = default(string), string issuingAccountNumber = default(string), string issuingAccountHolderName = default(string), string issuingAccountTaxId = default(string), List paymentAttempts = default(List), string receivingAccountHolderName = default(string), string receivingAccountNumber = default(string), string receivingAccountBank = default(string), string receivingAccountTaxId = default(string), string referenceNumber = default(string), string trackingCode = default(string), string customerIpAddress = default(string)) { // to ensure "varObject" is required (not null) if (varObject == null) @@ -83,6 +84,7 @@ protected PaymentMethodBankTransfer() { } this.ReceivingAccountTaxId = receivingAccountTaxId; this.ReferenceNumber = referenceNumber; this.TrackingCode = trackingCode; + this.CustomerIpAddress = customerIpAddress; } /// @@ -199,6 +201,13 @@ protected PaymentMethodBankTransfer() { } [DataMember(Name = "tracking_code", EmitDefaultValue = true)] public string TrackingCode { get; set; } + /// + /// Gets or Sets CustomerIpAddress + /// + /// 0.0.0.0 + [DataMember(Name = "customer_ip_address", EmitDefaultValue = false)] + public string CustomerIpAddress { get; set; } + /// /// Returns the string presentation of the object /// @@ -225,6 +234,7 @@ public override string ToString() sb.Append(" ReceivingAccountTaxId: ").Append(ReceivingAccountTaxId).Append("\n"); sb.Append(" ReferenceNumber: ").Append(ReferenceNumber).Append("\n"); sb.Append(" TrackingCode: ").Append(TrackingCode).Append("\n"); + sb.Append(" CustomerIpAddress: ").Append(CustomerIpAddress).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/src/Conekta.net/Model/PaymentMethodCard.cs b/src/Conekta.net/Model/PaymentMethodCard.cs index 650d561..7004648 100644 --- a/src/Conekta.net/Model/PaymentMethodCard.cs +++ b/src/Conekta.net/Model/PaymentMethodCard.cs @@ -42,18 +42,19 @@ protected PaymentMethodCard() { } /// /// type. /// varObject (required). - /// accountType. + /// Account type of the card. /// authCode. - /// brand. + /// Brand of the card. /// Id sent for recurrent charges.. - /// country. - /// expMonth. - /// expYear. + /// Country of the card. + /// Expiration month of the card. + /// Expiration year of the card. /// fraudIndicators. - /// issuer. - /// last4. - /// name. - public PaymentMethodCard(string type = default(string), string varObject = default(string), string accountType = default(string), string authCode = default(string), string brand = default(string), string contractId = default(string), string country = default(string), string expMonth = default(string), string expYear = default(string), List fraudIndicators = default(List), string issuer = default(string), string last4 = default(string), string name = default(string)) + /// Issuer of the card. + /// Last 4 digits of the card. + /// Name of the cardholder. + /// Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes. + public PaymentMethodCard(string type = default(string), string varObject = default(string), string accountType = default(string), string authCode = default(string), string brand = default(string), string contractId = default(string), string country = default(string), string expMonth = default(string), string expYear = default(string), List fraudIndicators = default(List), string issuer = default(string), string last4 = default(string), string name = default(string), string customerIpAddress = default(string)) { // to ensure "varObject" is required (not null) if (varObject == null) @@ -73,6 +74,7 @@ protected PaymentMethodCard() { } this.Issuer = issuer; this.Last4 = last4; this.Name = name; + this.CustomerIpAddress = customerIpAddress; } /// @@ -89,8 +91,9 @@ protected PaymentMethodCard() { } public string Object { get; set; } /// - /// Gets or Sets AccountType + /// Account type of the card /// + /// Account type of the card /// Credit [DataMember(Name = "account_type", EmitDefaultValue = false)] public string AccountType { get; set; } @@ -103,8 +106,9 @@ protected PaymentMethodCard() { } public string AuthCode { get; set; } /// - /// Gets or Sets Brand + /// Brand of the card /// + /// Brand of the card /// visa [DataMember(Name = "brand", EmitDefaultValue = false)] public string Brand { get; set; } @@ -118,23 +122,26 @@ protected PaymentMethodCard() { } public string ContractId { get; set; } /// - /// Gets or Sets Country + /// Country of the card /// + /// Country of the card /// MX [DataMember(Name = "country", EmitDefaultValue = false)] public string Country { get; set; } /// - /// Gets or Sets ExpMonth + /// Expiration month of the card /// + /// Expiration month of the card /// 02 [DataMember(Name = "exp_month", EmitDefaultValue = false)] public string ExpMonth { get; set; } /// - /// Gets or Sets ExpYear + /// Expiration year of the card /// - /// 30 + /// Expiration year of the card + /// 2026 [DataMember(Name = "exp_year", EmitDefaultValue = false)] public string ExpYear { get; set; } @@ -145,26 +152,37 @@ protected PaymentMethodCard() { } public List FraudIndicators { get; set; } /// - /// Gets or Sets Issuer + /// Issuer of the card /// + /// Issuer of the card /// BANAMEX [DataMember(Name = "issuer", EmitDefaultValue = false)] public string Issuer { get; set; } /// - /// Gets or Sets Last4 + /// Last 4 digits of the card /// + /// Last 4 digits of the card /// 4242 [DataMember(Name = "last4", EmitDefaultValue = false)] public string Last4 { get; set; } /// - /// Gets or Sets Name + /// Name of the cardholder /// + /// Name of the cardholder /// Fulanito Perez [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; } + /// + /// Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes + /// + /// Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes + /// 0.0.0.0 + [DataMember(Name = "customer_ip_address", EmitDefaultValue = false)] + public string CustomerIpAddress { get; set; } + /// /// Returns the string presentation of the object /// @@ -186,6 +204,7 @@ public override string ToString() sb.Append(" Issuer: ").Append(Issuer).Append("\n"); sb.Append(" Last4: ").Append(Last4).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" CustomerIpAddress: ").Append(CustomerIpAddress).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/src/Conekta.net/Model/PaymentMethodCardRequest.cs b/src/Conekta.net/Model/PaymentMethodCardRequest.cs index 9f7d1a2..46f8e26 100644 --- a/src/Conekta.net/Model/PaymentMethodCardRequest.cs +++ b/src/Conekta.net/Model/PaymentMethodCardRequest.cs @@ -41,8 +41,13 @@ protected PaymentMethodCardRequest() { } /// Initializes a new instance of the class. /// /// Type of payment method (required). - /// Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards. (required). - public PaymentMethodCardRequest(string type = default(string), string tokenId = default(string)) + /// Card security code (required). + /// Card expiration month (required). + /// Card expiration year (required). + /// Cardholder name (required). + /// Card number (required). + /// Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes. + public PaymentMethodCardRequest(string type = default(string), string cvc = default(string), string expMonth = default(string), string expYear = default(string), string name = default(string), string number = default(string), string customerIpAddress = default(string)) { // to ensure "type" is required (not null) if (type == null) @@ -50,12 +55,37 @@ protected PaymentMethodCardRequest() { } throw new ArgumentNullException("type is a required property for PaymentMethodCardRequest and cannot be null"); } this.Type = type; - // to ensure "tokenId" is required (not null) - if (tokenId == null) + // to ensure "cvc" is required (not null) + if (cvc == null) { - throw new ArgumentNullException("tokenId is a required property for PaymentMethodCardRequest and cannot be null"); + throw new ArgumentNullException("cvc is a required property for PaymentMethodCardRequest and cannot be null"); } - this.TokenId = tokenId; + this.Cvc = cvc; + // to ensure "expMonth" is required (not null) + if (expMonth == null) + { + throw new ArgumentNullException("expMonth is a required property for PaymentMethodCardRequest and cannot be null"); + } + this.ExpMonth = expMonth; + // to ensure "expYear" is required (not null) + if (expYear == null) + { + throw new ArgumentNullException("expYear is a required property for PaymentMethodCardRequest and cannot be null"); + } + this.ExpYear = expYear; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for PaymentMethodCardRequest and cannot be null"); + } + this.Name = name; + // to ensure "number" is required (not null) + if (number == null) + { + throw new ArgumentNullException("number is a required property for PaymentMethodCardRequest and cannot be null"); + } + this.Number = number; + this.CustomerIpAddress = customerIpAddress; } /// @@ -67,12 +97,52 @@ protected PaymentMethodCardRequest() { } public string Type { get; set; } /// - /// Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards. + /// Card security code + /// + /// Card security code + /// 198 + [DataMember(Name = "cvc", IsRequired = true, EmitDefaultValue = true)] + public string Cvc { get; set; } + + /// + /// Card expiration month /// - /// Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards. - /// tok_32hj4g234as - [DataMember(Name = "token_id", IsRequired = true, EmitDefaultValue = true)] - public string TokenId { get; set; } + /// Card expiration month + /// 12 + [DataMember(Name = "exp_month", IsRequired = true, EmitDefaultValue = true)] + public string ExpMonth { get; set; } + + /// + /// Card expiration year + /// + /// Card expiration year + /// 2025 + [DataMember(Name = "exp_year", IsRequired = true, EmitDefaultValue = true)] + public string ExpYear { get; set; } + + /// + /// Cardholder name + /// + /// Cardholder name + /// John Doe + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Card number + /// + /// Card number + /// 4242424242424242 + [DataMember(Name = "number", IsRequired = true, EmitDefaultValue = true)] + public string Number { get; set; } + + /// + /// Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes + /// + /// Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes + /// 0.0.0.0 + [DataMember(Name = "customer_ip_address", EmitDefaultValue = false)] + public string CustomerIpAddress { get; set; } /// /// Returns the string presentation of the object @@ -83,7 +153,12 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class PaymentMethodCardRequest {\n"); sb.Append(" Type: ").Append(Type).Append("\n"); - sb.Append(" TokenId: ").Append(TokenId).Append("\n"); + sb.Append(" Cvc: ").Append(Cvc).Append("\n"); + sb.Append(" ExpMonth: ").Append(ExpMonth).Append("\n"); + sb.Append(" ExpYear: ").Append(ExpYear).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" CustomerIpAddress: ").Append(CustomerIpAddress).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -104,6 +179,42 @@ public virtual string ToJson() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + // Cvc (string) maxLength + if (this.Cvc != null && this.Cvc.Length > 4) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cvc, length must be less than 4.", new [] { "Cvc" }); + } + + // Cvc (string) minLength + if (this.Cvc != null && this.Cvc.Length < 3) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cvc, length must be greater than 3.", new [] { "Cvc" }); + } + + // ExpMonth (string) maxLength + if (this.ExpMonth != null && this.ExpMonth.Length > 2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ExpMonth, length must be less than 2.", new [] { "ExpMonth" }); + } + + // ExpMonth (string) minLength + if (this.ExpMonth != null && this.ExpMonth.Length < 2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ExpMonth, length must be greater than 2.", new [] { "ExpMonth" }); + } + + // ExpYear (string) maxLength + if (this.ExpYear != null && this.ExpYear.Length > 4) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ExpYear, length must be less than 4.", new [] { "ExpYear" }); + } + + // ExpYear (string) minLength + if (this.ExpYear != null && this.ExpYear.Length < 4) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ExpYear, length must be greater than 4.", new [] { "ExpYear" }); + } + yield break; } } diff --git a/src/Conekta.net/Model/PaymentMethodCash.cs b/src/Conekta.net/Model/PaymentMethodCash.cs index ec5b934..4d3f077 100644 --- a/src/Conekta.net/Model/PaymentMethodCash.cs +++ b/src/Conekta.net/Model/PaymentMethodCash.cs @@ -50,7 +50,8 @@ protected PaymentMethodCash() { } /// serviceName. /// store. /// storeName. - public PaymentMethodCash(string type = default(string), string varObject = default(string), int? authCode = default(int?), string cashierId = default(string), string reference = default(string), string barcodeUrl = default(string), long expiresAt = default(long), string serviceName = default(string), string store = default(string), string storeName = default(string)) + /// customerIpAddress. + public PaymentMethodCash(string type = default(string), string varObject = default(string), int? authCode = default(int?), string cashierId = default(string), string reference = default(string), string barcodeUrl = default(string), long expiresAt = default(long), string serviceName = default(string), string store = default(string), string storeName = default(string), string customerIpAddress = default(string)) { // to ensure "varObject" is required (not null) if (varObject == null) @@ -67,6 +68,7 @@ protected PaymentMethodCash() { } this.ServiceName = serviceName; this.Store = store; this.StoreName = storeName; + this.CustomerIpAddress = customerIpAddress; } /// @@ -138,6 +140,13 @@ protected PaymentMethodCash() { } [DataMember(Name = "store_name", EmitDefaultValue = false)] public string StoreName { get; set; } + /// + /// Gets or Sets CustomerIpAddress + /// + /// 0.0.0.0 + [DataMember(Name = "customer_ip_address", EmitDefaultValue = false)] + public string CustomerIpAddress { get; set; } + /// /// Returns the string presentation of the object /// @@ -156,6 +165,7 @@ public override string ToString() sb.Append(" ServiceName: ").Append(ServiceName).Append("\n"); sb.Append(" Store: ").Append(Store).Append("\n"); sb.Append(" StoreName: ").Append(StoreName).Append("\n"); + sb.Append(" CustomerIpAddress: ").Append(CustomerIpAddress).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/src/Conekta.net/Model/PaymentMethodGeneralRequest.cs b/src/Conekta.net/Model/PaymentMethodGeneralRequest.cs new file mode 100644 index 0000000..18babe1 --- /dev/null +++ b/src/Conekta.net/Model/PaymentMethodGeneralRequest.cs @@ -0,0 +1,169 @@ +/* + * Conekta API + * + * Conekta sdk + * + * The version of the OpenAPI document: 2.1.0 + * Contact: engineering@conekta.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Conekta.net.Client.OpenAPIDateConverter; + +namespace Conekta.net.Model +{ + /// + /// Payment method used in the charge. Go to the [payment methods](https://developers.conekta.com/reference/m%C3%A9todos-de-pago) section for more details + /// + [DataContract(Name = "payment_method_general_request")] + public partial class PaymentMethodGeneralRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PaymentMethodGeneralRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// Method expiration date as unix timestamp. + /// How many months without interest to apply, it can be 3, 6, 9, 12 or 18. + /// Type of payment method (required). + /// tokenId. + /// paymentSourceId. + /// Optional, It is a value that allows identifying the security code of the card. Only for PCI merchants. + /// Optional id sent to indicate the bank contract for recurrent card charges.. + /// Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes. + public PaymentMethodGeneralRequest(long expiresAt = default(long), int monthlyInstallments = default(int), string type = default(string), string tokenId = default(string), string paymentSourceId = default(string), string cvc = default(string), string contractId = default(string), string customerIpAddress = default(string)) + { + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for PaymentMethodGeneralRequest and cannot be null"); + } + this.Type = type; + this.ExpiresAt = expiresAt; + this.MonthlyInstallments = monthlyInstallments; + this.TokenId = tokenId; + this.PaymentSourceId = paymentSourceId; + this.Cvc = cvc; + this.ContractId = contractId; + this.CustomerIpAddress = customerIpAddress; + } + + /// + /// Method expiration date as unix timestamp + /// + /// Method expiration date as unix timestamp + /// 1677196303 + [DataMember(Name = "expires_at", EmitDefaultValue = false)] + public long ExpiresAt { get; set; } + + /// + /// How many months without interest to apply, it can be 3, 6, 9, 12 or 18 + /// + /// How many months without interest to apply, it can be 3, 6, 9, 12 or 18 + [DataMember(Name = "monthly_installments", EmitDefaultValue = false)] + public int MonthlyInstallments { get; set; } + + /// + /// Type of payment method + /// + /// Type of payment method + /// card + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Gets or Sets TokenId + /// + /// tok_2897348234 + [DataMember(Name = "token_id", EmitDefaultValue = false)] + public string TokenId { get; set; } + + /// + /// Gets or Sets PaymentSourceId + /// + /// src_2tLkkyfMPh6v7pFry + [DataMember(Name = "payment_source_id", EmitDefaultValue = false)] + public string PaymentSourceId { get; set; } + + /// + /// Optional, It is a value that allows identifying the security code of the card. Only for PCI merchants + /// + /// Optional, It is a value that allows identifying the security code of the card. Only for PCI merchants + /// 123 + [DataMember(Name = "cvc", EmitDefaultValue = false)] + public string Cvc { get; set; } + + /// + /// Optional id sent to indicate the bank contract for recurrent card charges. + /// + /// Optional id sent to indicate the bank contract for recurrent card charges. + /// S781317595 + [DataMember(Name = "contract_id", EmitDefaultValue = false)] + public string ContractId { get; set; } + + /// + /// Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes + /// + /// Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes + /// 0.0.0.0 + [DataMember(Name = "customer_ip_address", EmitDefaultValue = false)] + public string CustomerIpAddress { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PaymentMethodGeneralRequest {\n"); + sb.Append(" ExpiresAt: ").Append(ExpiresAt).Append("\n"); + sb.Append(" MonthlyInstallments: ").Append(MonthlyInstallments).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" TokenId: ").Append(TokenId).Append("\n"); + sb.Append(" PaymentSourceId: ").Append(PaymentSourceId).Append("\n"); + sb.Append(" Cvc: ").Append(Cvc).Append("\n"); + sb.Append(" ContractId: ").Append(ContractId).Append("\n"); + sb.Append(" CustomerIpAddress: ").Append(CustomerIpAddress).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Conekta.net/Model/PaymentMethodTokenRequest.cs b/src/Conekta.net/Model/PaymentMethodTokenRequest.cs new file mode 100644 index 0000000..4547013 --- /dev/null +++ b/src/Conekta.net/Model/PaymentMethodTokenRequest.cs @@ -0,0 +1,111 @@ +/* + * Conekta API + * + * Conekta sdk + * + * The version of the OpenAPI document: 2.1.0 + * Contact: engineering@conekta.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Conekta.net.Client.OpenAPIDateConverter; + +namespace Conekta.net.Model +{ + /// + /// PaymentMethodTokenRequest + /// + [DataContract(Name = "payment_method_token_request")] + public partial class PaymentMethodTokenRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PaymentMethodTokenRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// Type of payment method (required). + /// Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards. (required). + public PaymentMethodTokenRequest(string type = default(string), string tokenId = default(string)) + { + // to ensure "type" is required (not null) + if (type == null) + { + throw new ArgumentNullException("type is a required property for PaymentMethodTokenRequest and cannot be null"); + } + this.Type = type; + // to ensure "tokenId" is required (not null) + if (tokenId == null) + { + throw new ArgumentNullException("tokenId is a required property for PaymentMethodTokenRequest and cannot be null"); + } + this.TokenId = tokenId; + } + + /// + /// Type of payment method + /// + /// Type of payment method + /// card | cash | spei + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public string Type { get; set; } + + /// + /// Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards. + /// + /// Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards. + /// tok_32hj4g234as + [DataMember(Name = "token_id", IsRequired = true, EmitDefaultValue = true)] + public string TokenId { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PaymentMethodTokenRequest {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" TokenId: ").Append(TokenId).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/Conekta.net/Model/SubscriptionResponse.cs b/src/Conekta.net/Model/SubscriptionResponse.cs index 6de0534..5bfce0a 100644 --- a/src/Conekta.net/Model/SubscriptionResponse.cs +++ b/src/Conekta.net/Model/SubscriptionResponse.cs @@ -38,6 +38,7 @@ public partial class SubscriptionResponse : IValidatableObject /// billingCycleStart. /// billingCycleEnd. /// canceledAt. + /// Reason for cancellation. This field appears when the subscription status is 'canceled'.. /// cardId. /// chargeId. /// createdAt. @@ -52,11 +53,12 @@ public partial class SubscriptionResponse : IValidatableObject /// subscriptionStart. /// trialStart. /// trialEnd. - public SubscriptionResponse(long? billingCycleStart = default(long?), long? billingCycleEnd = default(long?), long? canceledAt = default(long?), string cardId = default(string), string chargeId = default(string), long createdAt = default(long), string customerCustomReference = default(string), string customerId = default(string), string id = default(string), string lastBillingCycleOrderId = default(string), string varObject = default(string), long? pausedAt = default(long?), string planId = default(string), string status = default(string), int subscriptionStart = default(int), long? trialStart = default(long?), long? trialEnd = default(long?)) + public SubscriptionResponse(long? billingCycleStart = default(long?), long? billingCycleEnd = default(long?), long? canceledAt = default(long?), string canceledReason = default(string), string cardId = default(string), string chargeId = default(string), long createdAt = default(long), string customerCustomReference = default(string), string customerId = default(string), string id = default(string), string lastBillingCycleOrderId = default(string), string varObject = default(string), long? pausedAt = default(long?), string planId = default(string), string status = default(string), int subscriptionStart = default(int), long? trialStart = default(long?), long? trialEnd = default(long?)) { this.BillingCycleStart = billingCycleStart; this.BillingCycleEnd = billingCycleEnd; this.CanceledAt = canceledAt; + this.CanceledReason = canceledReason; this.CardId = cardId; this.ChargeId = chargeId; this.CreatedAt = createdAt; @@ -94,6 +96,14 @@ public partial class SubscriptionResponse : IValidatableObject [DataMember(Name = "canceled_at", EmitDefaultValue = true)] public long? CanceledAt { get; set; } + /// + /// Reason for cancellation. This field appears when the subscription status is 'canceled'. + /// + /// Reason for cancellation. This field appears when the subscription status is 'canceled'. + /// user_cancelation + [DataMember(Name = "canceled_reason", EmitDefaultValue = false)] + public string CanceledReason { get; set; } + /// /// Gets or Sets CardId /// @@ -203,6 +213,7 @@ public override string ToString() sb.Append(" BillingCycleStart: ").Append(BillingCycleStart).Append("\n"); sb.Append(" BillingCycleEnd: ").Append(BillingCycleEnd).Append("\n"); sb.Append(" CanceledAt: ").Append(CanceledAt).Append("\n"); + sb.Append(" CanceledReason: ").Append(CanceledReason).Append("\n"); sb.Append(" CardId: ").Append(CardId).Append("\n"); sb.Append(" ChargeId: ").Append(ChargeId).Append("\n"); sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n");