conekta 7.0.1 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -8
- data/VERSION +1 -1
- data/config-ruby.json +1 -1
- data/docs/ChargeOrderResponsePaymentMethod.md +5 -2
- data/docs/ChargeRequestPaymentMethod.md +3 -1
- data/docs/ChargeResponsePaymentMethod.md +5 -2
- data/docs/ChargesApi.md +2 -2
- data/docs/CheckoutRequest.md +1 -1
- data/docs/CompaniesApi.md +296 -0
- data/docs/CompanyDocumentRequest.md +26 -0
- data/docs/CompanyDocumentResponse.md +22 -0
- data/docs/CompanyResponse.md +18 -16
- data/docs/CompanyResponseDocumentsInner.md +22 -0
- data/docs/CreateCompanyRequest.md +26 -0
- data/docs/CreateCompanyRequestBankAccountInfo.md +18 -0
- data/docs/CreateCompanyRequestComercialInfo.md +24 -0
- data/docs/CreateCompanyRequestFiscalInfo.md +20 -0
- data/docs/CreateCustomerPaymentMethodsResponse.md +3 -2
- data/docs/CustomerPaymentMethodRequest.md +1 -1
- data/docs/CustomerPaymentMethodsData.md +3 -2
- data/docs/EventsResendResponse.md +1 -1
- data/docs/GetCustomerPaymentMethodDataResponse.md +3 -2
- data/docs/OrderResponseCheckout.md +1 -1
- data/docs/PaymentMethodBnplRequest.md +1 -1
- data/docs/PaymentMethodCardRequest.md +1 -1
- data/docs/PaymentMethodCashRecurrentResponse.md +38 -0
- data/docs/PaymentMethodCashRequest.md +1 -1
- data/docs/PaymentMethodPbbPayment.md +30 -0
- data/docs/PaymentMethodPbbRequest.md +22 -0
- data/docs/PaymentMethodSpeiRecurrent.md +2 -0
- data/docs/PaymentMethodSpeiRequest.md +1 -1
- data/docs/PaymentMethodTokenRequest.md +1 -1
- data/docs/PaymentMethodsApi.md +1 -1
- data/docs/UpdateCustomerPaymentMethodsResponse.md +3 -2
- data/docs/UpdatePaymentMethods.md +4 -2
- data/docs/WebhookLog.md +1 -1
- data/docs/WebhookResponse.md +1 -1
- data/examples/README.md +15 -0
- data/examples/one_time_charge_bnpl.rb +49 -0
- data/examples/one_time_charge_pbb.rb +47 -0
- data/lib/conekta/api/companies_api.rb +300 -0
- data/lib/conekta/models/charge_order_response_payment_method.rb +4 -2
- data/lib/conekta/models/charge_request_payment_method.rb +2 -1
- data/lib/conekta/models/charge_response_payment_method.rb +4 -2
- data/lib/conekta/models/company_document_request.rb +318 -0
- data/lib/conekta/models/company_document_response.rb +291 -0
- data/lib/conekta/models/company_response.rb +110 -74
- data/lib/conekta/models/company_response_documents_inner.rb +270 -0
- data/lib/conekta/models/create_company_request.rb +252 -0
- data/lib/conekta/models/create_company_request_bank_account_info.rb +216 -0
- data/lib/conekta/models/create_company_request_comercial_info.rb +246 -0
- data/lib/conekta/models/create_company_request_fiscal_info.rb +226 -0
- data/lib/conekta/models/create_customer_payment_methods_response.rb +2 -2
- data/lib/conekta/models/customer_payment_methods_data.rb +2 -2
- data/lib/conekta/models/get_customer_payment_method_data_response.rb +2 -2
- data/lib/conekta/models/payment_method_bnpl_request.rb +2 -2
- data/lib/conekta/models/payment_method_cash_recurrent_response.rb +343 -0
- data/lib/conekta/models/payment_method_pbb_payment.rb +341 -0
- data/lib/conekta/models/payment_method_pbb_request.rb +309 -0
- data/lib/conekta/models/payment_method_spei_recurrent.rb +11 -1
- data/lib/conekta/models/update_customer_payment_methods_response.rb +2 -2
- data/lib/conekta/models/update_payment_methods.rb +34 -4
- data/lib/conekta/version.rb +1 -1
- data/lib/conekta.rb +10 -3
- data/spec/api/companies_api_spec.rb +53 -0
- metadata +42 -22
- data/docs/CompanyFiscalInfoAddressResponse.md +0 -34
- data/docs/CompanyFiscalInfoResponse.md +0 -30
- data/docs/CompanyPayoutDestinationResponse.md +0 -28
@@ -0,0 +1,18 @@
|
|
1
|
+
# Conekta::CreateCompanyRequestBankAccountInfo
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **clabe** | **String** | The 18-digit CLABE for the bank account. | [optional] |
|
8
|
+
|
9
|
+
## Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'conekta'
|
13
|
+
|
14
|
+
instance = Conekta::CreateCompanyRequestBankAccountInfo.new(
|
15
|
+
clabe: 002010077777777771
|
16
|
+
)
|
17
|
+
```
|
18
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Conekta::CreateCompanyRequestComercialInfo
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **website** | **String** | The company's website URL. | [optional] |
|
8
|
+
| **mcc** | **String** | The Merchant Category Code (MCC) for the company. | [optional] |
|
9
|
+
| **merchant_support_email** | **String** | Email address for merchant support. | [optional] |
|
10
|
+
| **merchant_support_phone** | **String** | Phone number for merchant support. | [optional] |
|
11
|
+
|
12
|
+
## Example
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'conekta'
|
16
|
+
|
17
|
+
instance = Conekta::CreateCompanyRequestComercialInfo.new(
|
18
|
+
website: http://www.test.com,
|
19
|
+
mcc: 5812,
|
20
|
+
merchant_support_email: test@test.com,
|
21
|
+
merchant_support_phone: 5300000000
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Conekta::CreateCompanyRequestFiscalInfo
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **business_phone** | **String** | The business phone number for fiscal purposes. | [optional] |
|
8
|
+
| **fiscal_type** | **String** | The fiscal type of the company (e.g., 'moral', 'persona_fisica'). | [optional] |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'conekta'
|
14
|
+
|
15
|
+
instance = Conekta::CreateCompanyRequestFiscalInfo.new(
|
16
|
+
business_phone: 5300000000,
|
17
|
+
fiscal_type: moral
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
@@ -15,6 +15,7 @@ Conekta::CreateCustomerPaymentMethodsResponse.openapi_one_of
|
|
15
15
|
# =>
|
16
16
|
# [
|
17
17
|
# :'PaymentMethodCardResponse',
|
18
|
+
# :'PaymentMethodCashRecurrentResponse',
|
18
19
|
# :'PaymentMethodCashResponse',
|
19
20
|
# :'PaymentMethodSpeiRecurrent'
|
20
21
|
# ]
|
@@ -47,8 +48,7 @@ Conekta::CreateCustomerPaymentMethodsResponse.openapi_discriminator_mapping
|
|
47
48
|
# {
|
48
49
|
# :'card' => :'PaymentMethodCardResponse',
|
49
50
|
# :'cash' => :'PaymentMethodCashResponse',
|
50
|
-
# :'cash_recurrent' => :'
|
51
|
-
# :'oxxo_recurrent' => :'PaymentMethodCashResponse',
|
51
|
+
# :'cash_recurrent' => :'PaymentMethodCashRecurrentResponse',
|
52
52
|
# :'spei_recurrent' => :'PaymentMethodSpeiRecurrent'
|
53
53
|
# }
|
54
54
|
```
|
@@ -78,6 +78,7 @@ Conekta::CreateCustomerPaymentMethodsResponse.build(data_that_doesnt_match)
|
|
78
78
|
#### Return type
|
79
79
|
|
80
80
|
- `PaymentMethodCardResponse`
|
81
|
+
- `PaymentMethodCashRecurrentResponse`
|
81
82
|
- `PaymentMethodCashResponse`
|
82
83
|
- `PaymentMethodSpeiRecurrent`
|
83
84
|
- `nil` (if no type matches)
|
@@ -15,6 +15,7 @@ Conekta::CustomerPaymentMethodsData.openapi_one_of
|
|
15
15
|
# =>
|
16
16
|
# [
|
17
17
|
# :'PaymentMethodCardResponse',
|
18
|
+
# :'PaymentMethodCashRecurrentResponse',
|
18
19
|
# :'PaymentMethodCashResponse',
|
19
20
|
# :'PaymentMethodSpeiRecurrent'
|
20
21
|
# ]
|
@@ -47,8 +48,7 @@ Conekta::CustomerPaymentMethodsData.openapi_discriminator_mapping
|
|
47
48
|
# {
|
48
49
|
# :'card' => :'PaymentMethodCardResponse',
|
49
50
|
# :'cash' => :'PaymentMethodCashResponse',
|
50
|
-
# :'cash_recurrent' => :'
|
51
|
-
# :'oxxo_recurrent' => :'PaymentMethodCashResponse',
|
51
|
+
# :'cash_recurrent' => :'PaymentMethodCashRecurrentResponse',
|
52
52
|
# :'spei_recurrent' => :'PaymentMethodSpeiRecurrent'
|
53
53
|
# }
|
54
54
|
```
|
@@ -78,6 +78,7 @@ Conekta::CustomerPaymentMethodsData.build(data_that_doesnt_match)
|
|
78
78
|
#### Return type
|
79
79
|
|
80
80
|
- `PaymentMethodCardResponse`
|
81
|
+
- `PaymentMethodCashRecurrentResponse`
|
81
82
|
- `PaymentMethodCashResponse`
|
82
83
|
- `PaymentMethodSpeiRecurrent`
|
83
84
|
- `nil` (if no type matches)
|
@@ -22,7 +22,7 @@ instance = Conekta::EventsResendResponse.new(
|
|
22
22
|
last_attempted_at: 1684265970,
|
23
23
|
last_http_response_status: 405,
|
24
24
|
response_data: {},
|
25
|
-
url: https://username:password@mockoon.
|
25
|
+
url: https://username:password@mockoon.conekta.io/payments-api/cash/merchant_approval
|
26
26
|
)
|
27
27
|
```
|
28
28
|
|
@@ -15,6 +15,7 @@ Conekta::GetCustomerPaymentMethodDataResponse.openapi_one_of
|
|
15
15
|
# =>
|
16
16
|
# [
|
17
17
|
# :'PaymentMethodCardResponse',
|
18
|
+
# :'PaymentMethodCashRecurrentResponse',
|
18
19
|
# :'PaymentMethodCashResponse',
|
19
20
|
# :'PaymentMethodSpeiRecurrent'
|
20
21
|
# ]
|
@@ -47,8 +48,7 @@ Conekta::GetCustomerPaymentMethodDataResponse.openapi_discriminator_mapping
|
|
47
48
|
# {
|
48
49
|
# :'card' => :'PaymentMethodCardResponse',
|
49
50
|
# :'cash' => :'PaymentMethodCashResponse',
|
50
|
-
# :'cash_recurrent' => :'
|
51
|
-
# :'oxxo_recurrent' => :'PaymentMethodCashResponse',
|
51
|
+
# :'cash_recurrent' => :'PaymentMethodCashRecurrentResponse',
|
52
52
|
# :'spei_recurrent' => :'PaymentMethodSpeiRecurrent'
|
53
53
|
# }
|
54
54
|
```
|
@@ -78,6 +78,7 @@ Conekta::GetCustomerPaymentMethodDataResponse.build(data_that_doesnt_match)
|
|
78
78
|
#### Return type
|
79
79
|
|
80
80
|
- `PaymentMethodCardResponse`
|
81
|
+
- `PaymentMethodCashRecurrentResponse`
|
81
82
|
- `PaymentMethodCashResponse`
|
82
83
|
- `PaymentMethodSpeiRecurrent`
|
83
84
|
- `nil` (if no type matches)
|
@@ -66,7 +66,7 @@ instance = Conekta::OrderResponseCheckout.new(
|
|
66
66
|
starts_at: 1676354400,
|
67
67
|
status: Issued,
|
68
68
|
type: HostedPayment,
|
69
|
-
url: https://pay.
|
69
|
+
url: https://pay.conekta.io/checkout/6fca054a85194c43971ecea35cc519bb
|
70
70
|
)
|
71
71
|
```
|
72
72
|
|
@@ -21,7 +21,7 @@ instance = Conekta::PaymentMethodBnplRequest.new(
|
|
21
21
|
cancel_url: https://example.com/cancel,
|
22
22
|
can_not_expire: true,
|
23
23
|
failure_url: https://example.com/failure,
|
24
|
-
product_type:
|
24
|
+
product_type: aplazo_bnpl,
|
25
25
|
success_url: https://example.com/success
|
26
26
|
)
|
27
27
|
```
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Conekta::PaymentMethodCashRecurrentResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **type** | **String** | | |
|
8
|
+
| **id** | **String** | | |
|
9
|
+
| **object** | **String** | | |
|
10
|
+
| **created_at** | **Integer** | | |
|
11
|
+
| **parent_id** | **String** | | [optional] |
|
12
|
+
| **agreements** | [**Array<PaymentMethodCashResponseAllOfAgreements>**](PaymentMethodCashResponseAllOfAgreements.md) | | [optional] |
|
13
|
+
| **reference** | **String** | | [optional] |
|
14
|
+
| **barcode** | **String** | | [optional] |
|
15
|
+
| **barcode_url** | **String** | URL to the barcode image, reference is the same as barcode | [optional] |
|
16
|
+
| **expires_at** | **Integer** | | [optional] |
|
17
|
+
| **provider** | **String** | | [optional] |
|
18
|
+
|
19
|
+
## Example
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'conekta'
|
23
|
+
|
24
|
+
instance = Conekta::PaymentMethodCashRecurrentResponse.new(
|
25
|
+
type: null,
|
26
|
+
id: src_2s8K1B3PBKDontpi9,
|
27
|
+
object: payment_source,
|
28
|
+
created_at: 1675715413,
|
29
|
+
parent_id: cus_2s8K1B3PBKDontpi8,
|
30
|
+
agreements: null,
|
31
|
+
reference: 93000262276908,
|
32
|
+
barcode: 93000262276908,
|
33
|
+
barcode_url: https://barcodes.conekta.com/644ebf80f2243197aad6cd8810375b905b613dbe.png,
|
34
|
+
expires_at: 1742483424,
|
35
|
+
provider: Cash
|
36
|
+
)
|
37
|
+
```
|
38
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Conekta::PaymentMethodPbbPayment
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **type** | **String** | | [optional] |
|
8
|
+
| **object** | **String** | | |
|
9
|
+
| **deep_link** | **String** | Deep link for the payment, use for mobile apps/flows | |
|
10
|
+
| **expires_at** | **Integer** | Expiration date of the charge | |
|
11
|
+
| **product_type** | **String** | Product type of the charge | |
|
12
|
+
| **redirect_url** | **String** | URL to redirect the customer to complete the payment | |
|
13
|
+
| **reference** | **String** | Reference for the payment | |
|
14
|
+
|
15
|
+
## Example
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'conekta'
|
19
|
+
|
20
|
+
instance = Conekta::PaymentMethodPbbPayment.new(
|
21
|
+
type: null,
|
22
|
+
object: payment_source,
|
23
|
+
deep_link: https://mgm.bbva.mx/WA3b/pbb?AGREEMENT=002484374&AMOUNT=1&CONCEPT=PagoDirecto&CURRENCY=MXN&REFERENCE=22277523174328893295,
|
24
|
+
expires_at: 1683053729,
|
25
|
+
product_type: null,
|
26
|
+
redirect_url: https://example.com/redirect,
|
27
|
+
reference: 22277523174328893295
|
28
|
+
)
|
29
|
+
```
|
30
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Conekta::PaymentMethodPbbRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **type** | **String** | Type of the payment method | |
|
8
|
+
| **expires_at** | **Integer** | Expiration date of the payment method, in Unix timestamp format | [optional] |
|
9
|
+
| **product_type** | **String** | Product type of the payment method, use for the payment method to know the product type | |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'conekta'
|
15
|
+
|
16
|
+
instance = Conekta::PaymentMethodPbbRequest.new(
|
17
|
+
type: pay_by_bank,
|
18
|
+
expires_at: 1680397724,
|
19
|
+
product_type: bbva_pay_by_bank
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -9,6 +9,7 @@
|
|
9
9
|
| **object** | **String** | | |
|
10
10
|
| **created_at** | **Integer** | | |
|
11
11
|
| **parent_id** | **String** | | [optional] |
|
12
|
+
| **bank** | **String** | Bank name for the SPEI payment method | [optional] |
|
12
13
|
| **reference** | **String** | | [optional] |
|
13
14
|
| **expires_at** | **String** | | [optional] |
|
14
15
|
|
@@ -23,6 +24,7 @@ instance = Conekta::PaymentMethodSpeiRecurrent.new(
|
|
23
24
|
object: payment_source,
|
24
25
|
created_at: 1675715413,
|
25
26
|
parent_id: cus_2s8K1B3PBKDontpi8,
|
27
|
+
bank: STP,
|
26
28
|
reference: 93000262276908,
|
27
29
|
expires_at: none
|
28
30
|
)
|
data/docs/PaymentMethodsApi.md
CHANGED
@@ -31,7 +31,7 @@ end
|
|
31
31
|
|
32
32
|
api_instance = Conekta::PaymentMethodsApi.new
|
33
33
|
id = '6307a60c41de27127515a575' # String | Identifier of the resource
|
34
|
-
create_customer_payment_methods_request = Conekta::PaymentMethodCashRequest.new({type: 'card | cash | spei | bnpl'}) # CreateCustomerPaymentMethodsRequest | requested field for customer payment methods
|
34
|
+
create_customer_payment_methods_request = Conekta::PaymentMethodCashRequest.new({type: 'card | cash | spei | bnpl | pay_by_bank'}) # CreateCustomerPaymentMethodsRequest | requested field for customer payment methods
|
35
35
|
opts = {
|
36
36
|
accept_language: 'es', # String | Use for knowing which language to use
|
37
37
|
x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request.
|
@@ -15,6 +15,7 @@ Conekta::UpdateCustomerPaymentMethodsResponse.openapi_one_of
|
|
15
15
|
# =>
|
16
16
|
# [
|
17
17
|
# :'PaymentMethodCardResponse',
|
18
|
+
# :'PaymentMethodCashRecurrentResponse',
|
18
19
|
# :'PaymentMethodCashResponse',
|
19
20
|
# :'PaymentMethodSpeiRecurrent'
|
20
21
|
# ]
|
@@ -47,8 +48,7 @@ Conekta::UpdateCustomerPaymentMethodsResponse.openapi_discriminator_mapping
|
|
47
48
|
# {
|
48
49
|
# :'card' => :'PaymentMethodCardResponse',
|
49
50
|
# :'cash' => :'PaymentMethodCashResponse',
|
50
|
-
# :'cash_recurrent' => :'
|
51
|
-
# :'oxxo_recurrent' => :'PaymentMethodCashResponse',
|
51
|
+
# :'cash_recurrent' => :'PaymentMethodCashRecurrentResponse',
|
52
52
|
# :'spei_recurrent' => :'PaymentMethodSpeiRecurrent'
|
53
53
|
# }
|
54
54
|
```
|
@@ -78,6 +78,7 @@ Conekta::UpdateCustomerPaymentMethodsResponse.build(data_that_doesnt_match)
|
|
78
78
|
#### Return type
|
79
79
|
|
80
80
|
- `PaymentMethodCardResponse`
|
81
|
+
- `PaymentMethodCashRecurrentResponse`
|
81
82
|
- `PaymentMethodCashResponse`
|
82
83
|
- `PaymentMethodSpeiRecurrent`
|
83
84
|
- `nil` (if no type matches)
|
@@ -4,7 +4,8 @@
|
|
4
4
|
|
5
5
|
| Name | Type | Description | Notes |
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
7
|
-
| **name** | **String** |
|
7
|
+
| **name** | **String** | The name of the payment method holder | [optional] |
|
8
|
+
| **expires_at** | **Integer** | The expiration date of the payment method in Unix timestamp format | [optional] |
|
8
9
|
|
9
10
|
## Example
|
10
11
|
|
@@ -12,7 +13,8 @@
|
|
12
13
|
require 'conekta'
|
13
14
|
|
14
15
|
instance = Conekta::UpdatePaymentMethods.new(
|
15
|
-
name:
|
16
|
+
name: Payment recurrent,
|
17
|
+
expires_at: 1760457350
|
16
18
|
)
|
17
19
|
```
|
18
20
|
|
data/docs/WebhookLog.md
CHANGED
@@ -24,7 +24,7 @@ instance = Conekta::WebhookLog.new(
|
|
24
24
|
last_http_response_status: 200,
|
25
25
|
object: webhook_log,
|
26
26
|
response_data: {"amount":3000,"payable":true},
|
27
|
-
url: https://username:password@mockoon.
|
27
|
+
url: https://username:password@mockoon.conekta.io/payments-api/cash/merchant_approval
|
28
28
|
)
|
29
29
|
```
|
30
30
|
|
data/docs/WebhookResponse.md
CHANGED
@@ -26,7 +26,7 @@ instance = Conekta::WebhookResponse.new(
|
|
26
26
|
object: event,
|
27
27
|
status: listening,
|
28
28
|
subscribed_events: ["charge.created","charge.paid","charge.under_fraud_review","charge.fraudulent","charge.refunded","charge.preauthorized","charge.declined","charge.canceled","charge.reversed","charge.pending_confirmation"],
|
29
|
-
url: https://username:password@mockoon.
|
29
|
+
url: https://username:password@mockoon.conekta.io/payments-api/cash/merchant_approval
|
30
30
|
)
|
31
31
|
```
|
32
32
|
|
data/examples/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
## Running an example
|
2
|
+
|
3
|
+
From the examples folder, run:
|
4
|
+
`RUBYLIB=../lib ruby your_example.rb`
|
5
|
+
|
6
|
+
e.g.
|
7
|
+
|
8
|
+
`RUBYLIB=../lib ruby example.rb`
|
9
|
+
|
10
|
+
## Adding a new example
|
11
|
+
|
12
|
+
1. Implement your example
|
13
|
+
2. Fill out the file comment. Include a description and key steps that are being demonstrated.
|
14
|
+
3. Run it (as per above)
|
15
|
+
4. 👍
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Load the gem
|
2
|
+
require 'conekta'
|
3
|
+
class OneTimeChargeBnpl
|
4
|
+
Conekta.configure do |config|
|
5
|
+
config.access_token = ENV['CONEKTA_API_KEY']
|
6
|
+
end
|
7
|
+
|
8
|
+
api_instance = Conekta::OrdersApi.new
|
9
|
+
order_request = Conekta::OrderRequest.new(
|
10
|
+
:currency => 'MXN',
|
11
|
+
:line_items => [
|
12
|
+
{
|
13
|
+
:name => 'Box of Cohiba S1s',
|
14
|
+
:unit_price => 35000,
|
15
|
+
:quantity => 1
|
16
|
+
}
|
17
|
+
],
|
18
|
+
:customer_info => {
|
19
|
+
:name => 'Mario Hernandez',
|
20
|
+
:email => 'mm@gmail.com',
|
21
|
+
:phone => '5555555555'
|
22
|
+
},
|
23
|
+
:charges => [
|
24
|
+
{
|
25
|
+
:payment_method => Conekta::PaymentMethodBnplRequest.new(
|
26
|
+
:expires_at => Time.now.advance(days: 30).to_i,
|
27
|
+
:product_type => 'creditea_bnpl',
|
28
|
+
:type => 'bnpl',
|
29
|
+
:success_url => 'https://www.example.com/success',
|
30
|
+
:failure_url => 'https://www.example.com/failure',
|
31
|
+
:cancel_url => 'https://www.example.com/cancel'
|
32
|
+
)
|
33
|
+
}
|
34
|
+
]
|
35
|
+
)
|
36
|
+
opts = {
|
37
|
+
accept_language: 'es' # String | Use for knowing which language to use
|
38
|
+
}
|
39
|
+
|
40
|
+
begin
|
41
|
+
result = api_instance.create_order(order_request, opts)
|
42
|
+
p result
|
43
|
+
p result.id
|
44
|
+
p result.charges.data[0].payment_method.bnpl_payment.redirect_url
|
45
|
+
p result.charges.data[0].payment_method.bnpl_payment.type
|
46
|
+
rescue Conekta::ApiError => e
|
47
|
+
puts "Exception when calling create order #{e}"
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Load the gem
|
2
|
+
require 'conekta'
|
3
|
+
class OneTimeChargePbb
|
4
|
+
Conekta.configure do |config|
|
5
|
+
config.access_token = ENV['CONEKTA_API_KEY']
|
6
|
+
end
|
7
|
+
|
8
|
+
api_instance = Conekta::OrdersApi.new
|
9
|
+
order_request = Conekta::OrderRequest.new(
|
10
|
+
:currency => 'MXN',
|
11
|
+
:line_items => [
|
12
|
+
{
|
13
|
+
:name => 'Box of Cohiba S1s',
|
14
|
+
:unit_price => 35000,
|
15
|
+
:quantity => 1
|
16
|
+
}
|
17
|
+
],
|
18
|
+
:customer_info => {
|
19
|
+
:name => 'Mario Hernandez',
|
20
|
+
:email => 'mm@gmail.com',
|
21
|
+
:phone => '5555555555'
|
22
|
+
},
|
23
|
+
:charges => [
|
24
|
+
{
|
25
|
+
:payment_method => Conekta::PaymentMethodPbbRequest.new(
|
26
|
+
:expires_at => Time.now.advance(days: 30).to_i,
|
27
|
+
:product_type => 'bbva_pay_by_bank',
|
28
|
+
:type => 'pay_by_bank',
|
29
|
+
)
|
30
|
+
}
|
31
|
+
]
|
32
|
+
)
|
33
|
+
opts = {
|
34
|
+
accept_language: 'es' # String | Use for knowing which language to use
|
35
|
+
}
|
36
|
+
|
37
|
+
begin
|
38
|
+
result = api_instance.create_order(order_request, opts)
|
39
|
+
p result
|
40
|
+
p result.id
|
41
|
+
p result.charges.data[0].payment_method.pay_by_bank_payment.redirect_url
|
42
|
+
p result.charges.data[0].payment_method.pay_by_bank_payment.deep_link
|
43
|
+
p result.charges.data[0].payment_method.pay_by_bank_payment.type
|
44
|
+
rescue Conekta::ApiError => e
|
45
|
+
puts "Exception when calling create order #{e}"
|
46
|
+
end
|
47
|
+
end
|