Skip to content

Commit

Permalink
Charge request method (#284)
Browse files Browse the repository at this point in the history
* add new fields y charge requests models

* add new fields y charge requests models
  • Loading branch information
fcarrero authored May 29, 2024
1 parent fcbee8b commit 474b143
Show file tree
Hide file tree
Showing 28 changed files with 1,682 additions and 129 deletions.
4 changes: 4 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ docs/Model/PaymentMethodCardResponse.md
docs/Model/PaymentMethodCash.md
docs/Model/PaymentMethodCashRequest.md
docs/Model/PaymentMethodCashResponse.md
docs/Model/PaymentMethodGeneralRequest.md
docs/Model/PaymentMethodResponse.md
docs/Model/PaymentMethodSpeiRecurrent.md
docs/Model/PaymentMethodSpeiRequest.md
docs/Model/PaymentMethodTokenRequest.md
docs/Model/Payout.md
docs/Model/PayoutMethod.md
docs/Model/PayoutOrder.md
Expand Down Expand Up @@ -352,9 +354,11 @@ lib/Model/PaymentMethodCardResponse.php
lib/Model/PaymentMethodCash.php
lib/Model/PaymentMethodCashRequest.php
lib/Model/PaymentMethodCashResponse.php
lib/Model/PaymentMethodGeneralRequest.php
lib/Model/PaymentMethodResponse.php
lib/Model/PaymentMethodSpeiRecurrent.php
lib/Model/PaymentMethodSpeiRequest.php
lib/Model/PaymentMethodTokenRequest.php
lib/Model/Payout.php
lib/Model/PayoutMethod.php
lib/Model/PayoutOrder.php
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,11 @@ Class | Method | HTTP request | Description
- [PaymentMethodCash](docs/Model/PaymentMethodCash.md)
- [PaymentMethodCashRequest](docs/Model/PaymentMethodCashRequest.md)
- [PaymentMethodCashResponse](docs/Model/PaymentMethodCashResponse.md)
- [PaymentMethodGeneralRequest](docs/Model/PaymentMethodGeneralRequest.md)
- [PaymentMethodResponse](docs/Model/PaymentMethodResponse.md)
- [PaymentMethodSpeiRecurrent](docs/Model/PaymentMethodSpeiRecurrent.md)
- [PaymentMethodSpeiRequest](docs/Model/PaymentMethodSpeiRequest.md)
- [PaymentMethodTokenRequest](docs/Model/PaymentMethodTokenRequest.md)
- [Payout](docs/Model/Payout.md)
- [PayoutMethod](docs/Model/PayoutMethod.md)
- [PayoutOrder](docs/Model/PayoutOrder.md)
Expand Down
16 changes: 8 additions & 8 deletions docs/Model/ChargeOrderResponsePaymentMethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ Name | Type | Description | Notes
**service_name** | **string** | | [optional]
**store** | **string** | | [optional]
**store_name** | **string** | | [optional]
**account_type** | **string** | | [optional]
**brand** | **string** | | [optional]
**account_type** | **string** | Account type of the card | [optional]
**brand** | **string** | Brand of the card | [optional]
**contract_id** | **string** | Id sent for recurrent charges. | [optional]
**country** | **string** | | [optional]
**exp_month** | **string** | | [optional]
**exp_year** | **string** | | [optional]
**country** | **string** | Country of the card | [optional]
**exp_month** | **string** | Expiration month of the card | [optional]
**exp_year** | **string** | Expiration year of the card | [optional]
**fraud_indicators** | **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]
Expand Down
2 changes: 1 addition & 1 deletion docs/Model/ChargeRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**amount** | **int** | | [optional]
**amount** | **int** | Amount to be charged in cents | [optional]
**payment_method** | [**\Conekta\Model\ChargeRequestPaymentMethod**](ChargeRequestPaymentMethod.md) | |
**reference_id** | **string** | Custom reference to add to the charge | [optional]

Expand Down
7 changes: 6 additions & 1 deletion docs/Model/ChargeRequestPaymentMethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **string** | Type of payment method |
**cvc** | **string** | Card security code |
**exp_month** | **string** | Card expiration month |
**exp_year** | **string** | Card expiration year |
**name** | **string** | Cardholder name |
**number** | **string** | Card number |
**expires_at** | **int** | Method expiration date as unix timestamp | [optional]
**monthly_installments** | **int** | How many months without interest to apply, it can be 3, 6, 9, 12 or 18 | [optional]
**type** | **string** | |
**token_id** | **string** | | [optional]
**payment_source_id** | **string** | | [optional]
**contract_id** | **string** | Optional id sent to indicate the bank contract for recurrent card charges. | [optional]
Expand Down
8 changes: 4 additions & 4 deletions docs/Model/ChargeResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Name | Type | Description | Notes
**device_fingerprint** | **string** | | [optional]
**failure_code** | **string** | | [optional]
**failure_message** | **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]
**order_id** | **string** | | [optional]
**paid_at** | **int** | | [optional]
**order_id** | **string** | Order ID | [optional]
**paid_at** | **int** | Payment date | [optional]
**payment_method** | [**\Conekta\Model\ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional]
**reference_id** | **string** | Reference ID of the charge | [optional]
**refunds** | [**\Conekta\Model\ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional]
Expand Down
16 changes: 8 additions & 8 deletions docs/Model/ChargeResponsePaymentMethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ Name | Type | Description | Notes
**service_name** | **string** | | [optional]
**store** | **string** | | [optional]
**store_name** | **string** | | [optional]
**account_type** | **string** | | [optional]
**brand** | **string** | | [optional]
**account_type** | **string** | Account type of the card | [optional]
**brand** | **string** | Brand of the card | [optional]
**contract_id** | **string** | Id sent for recurrent charges. | [optional]
**country** | **string** | | [optional]
**exp_month** | **string** | | [optional]
**exp_year** | **string** | | [optional]
**country** | **string** | Country of the card | [optional]
**exp_month** | **string** | Expiration month of the card | [optional]
**exp_year** | **string** | Expiration year of the card | [optional]
**fraud_indicators** | **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]
Expand Down
8 changes: 4 additions & 4 deletions docs/Model/ChargesDataResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Name | Type | Description | Notes
**device_fingerprint** | **string** | | [optional]
**failure_code** | **string** | | [optional]
**failure_message** | **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]
**order_id** | **string** | | [optional]
**paid_at** | **int** | | [optional]
**order_id** | **string** | Order ID | [optional]
**paid_at** | **int** | Payment date | [optional]
**payment_method** | [**\Conekta\Model\ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional]
**reference_id** | **string** | Reference ID of the charge | [optional]
**refunds** | [**\Conekta\Model\ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional]
Expand Down
4 changes: 2 additions & 2 deletions docs/Model/OrderRefundRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**amount** | **int** | |
**amount** | **int** | Amount to be refunded in cents |
**expires_at** | **int** | | [optional]
**reason** | **string** | |
**reason** | **string** | Reason for the refund |

[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
16 changes: 8 additions & 8 deletions docs/Model/PaymentMethodCard.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **string** | | [optional]
**object** | **string** | |
**account_type** | **string** | | [optional]
**account_type** | **string** | Account type of the card | [optional]
**auth_code** | **string** | | [optional]
**brand** | **string** | | [optional]
**brand** | **string** | Brand of the card | [optional]
**contract_id** | **string** | Id sent for recurrent charges. | [optional]
**country** | **string** | | [optional]
**exp_month** | **string** | | [optional]
**exp_year** | **string** | | [optional]
**country** | **string** | Country of the card | [optional]
**exp_month** | **string** | Expiration month of the card | [optional]
**exp_year** | **string** | Expiration year of the card | [optional]
**fraud_indicators** | **mixed[]** | | [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]

[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
6 changes: 5 additions & 1 deletion docs/Model/PaymentMethodCardRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **string** | Type of payment method |
**token_id** | **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 |
**exp_month** | **string** | Card expiration month |
**exp_year** | **string** | Card expiration year |
**name** | **string** | Cardholder name |
**number** | **string** | Card number |

[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
14 changes: 14 additions & 0 deletions docs/Model/PaymentMethodGeneralRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# # PaymentMethodGeneralRequest

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**expires_at** | **int** | Method expiration date as unix timestamp | [optional]
**monthly_installments** | **int** | How many months without interest to apply, it can be 3, 6, 9, 12 or 18 | [optional]
**type** | **string** | Type of payment method |
**token_id** | **string** | | [optional]
**payment_source_id** | **string** | | [optional]
**contract_id** | **string** | Optional id sent to indicate the bank contract for recurrent card charges. | [optional]

[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
10 changes: 10 additions & 0 deletions docs/Model/PaymentMethodTokenRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# # PaymentMethodTokenRequest

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **string** | Type of payment method |
**token_id** | **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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
49 changes: 49 additions & 0 deletions examples/direct_api/cargo_unico.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
require __DIR__ . '/../../vendor/autoload.php';
use Conekta\Api\OrdersApi;
use Conekta\Configuration;
use Conekta\Model\OrderRequest;

$config = Configuration::getDefaultConfiguration()->setAccessToken(getenv("CONEKTA_API_KEY"));
$apiInstance = new OrdersApi(null, $config);


$rq = new OrderRequest([
'line_items' => [
[
'name' => 'Nombre del Producto o Servicio',
'unit_price' => 23000,
'quantity' => 1
]
],
'currency' => 'MXN',
'customer_info' => [
'name' => 'Jorge Martinez',
'email' => 'jorge.martinez@conekta.com',
'phone' => '+5218181818181'
],
'metadata' => [
'datos_extra' => '12334'
],
'charges' => [
[
'payment_method' => [
'type' => 'card',
'number' => '4242424242424242',
'name' => 'Jorge Martinez',
'exp_month' => '12',
'exp_year' => '2025',
'cvc' => '198'
]
]
]
]);

try {
$result = $apiInstance->createOrder($rq);
$json_string = json_encode($result, JSON_PRETTY_PRINT);
print_r($json_string);
} catch (Exception $e) {
echo 'Exception when calling OrdersApi->createOrder: ', $e->getMessage(), PHP_EOL;

}
Empty file added gitleaks.toml
Empty file.
16 changes: 8 additions & 8 deletions lib/Model/ChargeOrderResponsePaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ public function getAccountType()
/**
* Sets account_type
*
* @param string|null $account_type account_type
* @param string|null $account_type Account type of the card
*
* @return self
*/
Expand All @@ -858,7 +858,7 @@ public function getBrand()
/**
* Sets brand
*
* @param string|null $brand brand
* @param string|null $brand Brand of the card
*
* @return self
*/
Expand Down Expand Up @@ -912,7 +912,7 @@ public function getCountry()
/**
* Sets country
*
* @param string|null $country country
* @param string|null $country Country of the card
*
* @return self
*/
Expand All @@ -939,7 +939,7 @@ public function getExpMonth()
/**
* Sets exp_month
*
* @param string|null $exp_month exp_month
* @param string|null $exp_month Expiration month of the card
*
* @return self
*/
Expand All @@ -966,7 +966,7 @@ public function getExpYear()
/**
* Sets exp_year
*
* @param string|null $exp_year exp_year
* @param string|null $exp_year Expiration year of the card
*
* @return self
*/
Expand Down Expand Up @@ -1020,7 +1020,7 @@ public function getIssuer()
/**
* Sets issuer
*
* @param string|null $issuer issuer
* @param string|null $issuer Issuer of the card
*
* @return self
*/
Expand All @@ -1047,7 +1047,7 @@ public function getLast4()
/**
* Sets last4
*
* @param string|null $last4 last4
* @param string|null $last4 Last 4 digits of the card
*
* @return self
*/
Expand All @@ -1074,7 +1074,7 @@ public function getName()
/**
* Sets name
*
* @param string|null $name name
* @param string|null $name Name of the cardholder
*
* @return self
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Model/ChargeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public function getAmount()
/**
* Sets amount
*
* @param int|null $amount amount
* @param int|null $amount Amount to be charged in cents
*
* @return self
*/
Expand Down
Loading

0 comments on commit 474b143

Please sign in to comment.