devdraft 1.0.2 → 1.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 +155 -253
- data/Rakefile +2 -0
- data/devdraft-1.0.0.gem +0 -0
- data/{devdraft_ai_sdk.gemspec → devdraft.gemspec} +15 -11
- data/docs/APIHealthApi.md +82 -30
- data/docs/AggregatedBalanceResponse.md +19 -6
- data/docs/AllBalancesResponse.md +19 -6
- data/docs/AppBalancesApi.md +125 -65
- data/docs/BridgeFiatPaymentRail.md +15 -0
- data/docs/BridgePaymentRail.md +12 -3
- data/docs/CreateBankPaymentIntentDto.md +49 -21
- data/docs/CreateCustomerDto.md +25 -9
- data/docs/CreateDirectBankTransferDto.md +29 -11
- data/docs/CreateDirectWalletTransferDto.md +21 -7
- data/docs/CreateExternalBankTransferDto.md +40 -0
- data/docs/CreateExternalStablecoinTransferDto.md +28 -0
- data/docs/CreateInvoiceDto.md +45 -19
- data/docs/CreateLiquidationAddressDto.md +43 -18
- data/docs/CreatePaymentLinkDto.md +53 -28
- data/docs/CreateStablePaymentIntentDto.md +43 -18
- data/docs/CreateStablecoinConversionDto.md +23 -8
- data/docs/CreateTaxDto.md +26 -0
- data/docs/CreateWebhookDto.md +23 -8
- data/docs/CustomerStatus.md +12 -3
- data/docs/CustomerType.md +15 -0
- data/docs/CustomersApi.md +187 -114
- data/docs/DestinationCurrency.md +12 -3
- data/docs/ExchangeRateResponseDto.md +25 -9
- data/docs/ExchangeRatesApi.md +130 -72
- data/docs/FiatCurrency.md +12 -3
- data/docs/HealthResponseDto.md +25 -9
- data/docs/InvoiceProductDto.md +17 -5
- data/docs/InvoicesApi.md +177 -104
- data/docs/LiquidationAddressResponseDto.md +41 -17
- data/docs/LiquidationAddressesApi.md +115 -61
- data/docs/PaymentIntentsApi.md +93 -57
- data/docs/PaymentLinkProductDto.md +17 -5
- data/docs/PaymentLinksApi.md +175 -102
- data/docs/PaymentRequestDto.md +21 -7
- data/docs/PaymentResponseDto.md +23 -8
- data/docs/ProductsApi.md +307 -194
- data/docs/PublicHealthResponseDto.md +19 -6
- data/docs/RefundResponseDto.md +23 -8
- data/docs/StableCoinCurrency.md +12 -3
- data/docs/TaxControllerCreate201Response.md +30 -0
- data/docs/TaxControllerDeleteWithoutId400Response.md +22 -0
- data/docs/TaxControllerUpdateWithoutId400Response.md +22 -0
- data/docs/TaxesApi.md +374 -122
- data/docs/TestPaymentsApi.md +150 -60
- data/docs/TransfersApi.md +274 -72
- data/docs/UpdateCustomerDto.md +25 -9
- data/docs/UpdateTaxDto.md +26 -0
- data/docs/UpdateWebhookDto.md +23 -8
- data/docs/WalletsApi.md +44 -24
- data/docs/WebhookResponseDto.md +29 -11
- data/docs/WebhooksApi.md +225 -134
- data/git_push.sh +41 -28
- data/lib/devdraft/api/api_health_api.rb +32 -16
- data/lib/devdraft/api/app_balances_api.rb +45 -22
- data/lib/devdraft/api/customers_api.rb +124 -71
- data/lib/devdraft/api/exchange_rates_api.rb +49 -26
- data/lib/devdraft/api/invoices_api.rb +89 -53
- data/lib/devdraft/api/liquidation_addresses_api.rb +70 -44
- data/lib/devdraft/api/payment_intents_api.rb +62 -40
- data/lib/devdraft/api/payment_links_api.rb +85 -49
- data/lib/devdraft/api/products_api.rb +214 -216
- data/lib/devdraft/api/taxes_api.rb +257 -66
- data/lib/devdraft/api/test_payments_api.rb +70 -44
- data/lib/devdraft/api/transfers_api.rb +206 -46
- data/lib/devdraft/api/wallets_api.rb +18 -9
- data/lib/devdraft/api/webhooks_api.rb +109 -66
- data/lib/devdraft/api_client.rb +76 -71
- data/lib/devdraft/api_error.rb +5 -4
- data/lib/devdraft/api_model_base.rb +88 -0
- data/lib/devdraft/configuration.rb +121 -18
- data/lib/devdraft/models/aggregated_balance_response.rb +68 -101
- data/lib/devdraft/models/all_balances_response.rb +76 -99
- data/lib/devdraft/models/bridge_fiat_payment_rail.rb +45 -0
- data/lib/devdraft/models/bridge_payment_rail.rb +36 -24
- data/lib/devdraft/models/create_bank_payment_intent_dto.rb +191 -114
- data/lib/devdraft/models/create_customer_dto.rb +123 -113
- data/lib/devdraft/models/create_direct_bank_transfer_dto.rb +105 -104
- data/lib/devdraft/models/create_direct_wallet_transfer_dto.rb +89 -100
- data/lib/devdraft/models/create_external_bank_transfer_dto.rb +505 -0
- data/lib/devdraft/models/create_external_stablecoin_transfer_dto.rb +266 -0
- data/lib/devdraft/models/create_invoice_dto.rb +151 -121
- data/lib/devdraft/models/create_liquidation_address_dto.rb +195 -115
- data/lib/devdraft/models/create_payment_link_dto.rb +192 -214
- data/lib/devdraft/models/create_stable_payment_intent_dto.rb +324 -111
- data/lib/devdraft/models/create_stablecoin_conversion_dto.rb +102 -101
- data/lib/devdraft/models/create_tax_dto.rb +281 -0
- data/lib/devdraft/models/create_webhook_dto.rb +104 -101
- data/lib/devdraft/models/customer_status.rb +23 -10
- data/lib/devdraft/models/customer_type.rb +45 -0
- data/lib/devdraft/models/destination_currency.rb +27 -15
- data/lib/devdraft/models/exchange_rate_response_dto.rb +103 -102
- data/lib/devdraft/models/fiat_currency.rb +22 -10
- data/lib/devdraft/models/health_response_dto.rb +99 -106
- data/lib/devdraft/models/invoice_product_dto.rb +63 -98
- data/lib/devdraft/models/liquidation_address_response_dto.rb +147 -110
- data/lib/devdraft/models/payment_link_product_dto.rb +70 -98
- data/lib/devdraft/models/payment_request_dto.rb +77 -100
- data/lib/devdraft/models/payment_response_dto.rb +102 -101
- data/lib/devdraft/models/public_health_response_dto.rb +68 -101
- data/lib/devdraft/models/refund_response_dto.rb +102 -101
- data/lib/devdraft/models/stable_coin_currency.rb +21 -9
- data/lib/devdraft/models/tax_controller_create201_response.rb +201 -0
- data/lib/devdraft/models/tax_controller_delete_without_id400_response.rb +165 -0
- data/lib/devdraft/models/tax_controller_update_without_id400_response.rb +165 -0
- data/lib/devdraft/models/update_customer_dto.rb +117 -113
- data/lib/devdraft/models/update_tax_dto.rb +256 -0
- data/lib/devdraft/models/update_webhook_dto.rb +70 -101
- data/lib/devdraft/models/webhook_response_dto.rb +140 -103
- data/lib/devdraft/version.rb +6 -5
- data/lib/devdraft.rb +18 -27
- data/spec/api/api_health_api_spec.rb +10 -9
- data/spec/api/app_balances_api_spec.rb +11 -10
- data/spec/api/customers_api_spec.rb +25 -24
- data/spec/api/exchange_rates_api_spec.rb +11 -10
- data/spec/api/invoices_api_spec.rb +16 -15
- data/spec/api/liquidation_addresses_api_spec.rb +13 -12
- data/spec/api/payment_intents_api_spec.rb +12 -11
- data/spec/api/payment_links_api_spec.rb +14 -13
- data/spec/api/products_api_spec.rb +41 -40
- data/spec/api/taxes_api_spec.rb +51 -21
- data/spec/api/test_payments_api_spec.rb +14 -13
- data/spec/api/transfers_api_spec.rb +36 -13
- data/spec/api/wallets_api_spec.rb +9 -8
- data/spec/api/webhooks_api_spec.rb +20 -19
- data/spec/models/aggregated_balance_response_spec.rb +15 -19
- data/spec/models/all_balances_response_spec.rb +14 -18
- data/spec/models/bridge_fiat_payment_rail_spec.rb +30 -0
- data/spec/models/bridge_payment_rail_spec.rb +11 -15
- data/spec/models/create_bank_payment_intent_dto_spec.rb +29 -33
- data/spec/models/create_customer_dto_spec.rb +17 -25
- data/spec/models/create_direct_bank_transfer_dto_spec.rb +19 -23
- data/spec/models/create_direct_wallet_transfer_dto_spec.rb +15 -19
- data/spec/models/create_external_bank_transfer_dto_spec.rb +102 -0
- data/spec/models/create_external_stablecoin_transfer_dto_spec.rb +66 -0
- data/spec/models/create_invoice_dto_spec.rb +31 -35
- data/spec/models/create_liquidation_address_dto_spec.rb +28 -32
- data/spec/models/create_payment_link_dto_spec.rb +34 -76
- data/spec/models/create_stable_payment_intent_dto_spec.rb +26 -30
- data/spec/models/create_stablecoin_conversion_dto_spec.rb +16 -20
- data/spec/models/create_tax_dto_spec.rb +60 -0
- data/spec/models/create_webhook_dto_spec.rb +16 -20
- data/spec/models/customer_status_spec.rb +11 -15
- data/spec/models/customer_type_spec.rb +30 -0
- data/spec/models/destination_currency_spec.rb +11 -15
- data/spec/models/exchange_rate_response_dto_spec.rb +17 -21
- data/spec/models/fiat_currency_spec.rb +11 -15
- data/spec/models/health_response_dto_spec.rb +19 -23
- data/spec/models/invoice_product_dto_spec.rb +13 -17
- data/spec/models/liquidation_address_response_dto_spec.rb +25 -29
- data/spec/models/payment_link_product_dto_spec.rb +13 -17
- data/spec/models/payment_request_dto_spec.rb +15 -19
- data/spec/models/payment_response_dto_spec.rb +16 -20
- data/spec/models/public_health_response_dto_spec.rb +15 -19
- data/spec/models/refund_response_dto_spec.rb +16 -20
- data/spec/models/stable_coin_currency_spec.rb +11 -15
- data/spec/models/tax_controller_create201_response_spec.rb +72 -0
- data/spec/models/tax_controller_delete_without_id400_response_spec.rb +48 -0
- data/spec/models/tax_controller_update_without_id400_response_spec.rb +48 -0
- data/spec/models/update_customer_dto_spec.rb +17 -25
- data/spec/models/update_tax_dto_spec.rb +60 -0
- data/spec/models/update_webhook_dto_spec.rb +16 -20
- data/spec/models/webhook_response_dto_spec.rb +19 -23
- data/spec/spec_helper.rb +5 -4
- metadata +49 -116
- data/docs/AllOfAllBalancesResponseEurc.md +0 -9
- data/docs/AllOfAllBalancesResponseUsdc.md +0 -9
- data/docs/AllOfCreateBankPaymentIntentDtoDestinationCurrency.md +0 -6
- data/docs/AllOfCreateBankPaymentIntentDtoDestinationNetwork.md +0 -6
- data/docs/AllOfCreateBankPaymentIntentDtoSourceCurrency.md +0 -6
- data/docs/AllOfCreateBankPaymentIntentDtoSourcePaymentRail.md +0 -6
- data/docs/AllOfCreateCustomerDtoStatus.md +0 -6
- data/docs/AllOfCreateLiquidationAddressDtoDestinationCurrency.md +0 -6
- data/docs/AllOfCreateLiquidationAddressDtoDestinationPaymentRail.md +0 -6
- data/docs/AllOfCreateStablePaymentIntentDtoDestinationCurrency.md +0 -6
- data/docs/AllOfCreateStablePaymentIntentDtoDestinationNetwork.md +0 -6
- data/docs/AllOfCreateStablePaymentIntentDtoSourceCurrency.md +0 -6
- data/docs/AllOfCreateStablePaymentIntentDtoSourceNetwork.md +0 -6
- data/docs/AllOfUpdateCustomerDtoStatus.md +0 -6
- data/docs/CreateProductDto.md +0 -18
- data/docs/CreateTaxInput.md +0 -6
- data/docs/UpdatePaymentLinkDto.md +0 -6
- data/docs/UpdatePreferenceInput.md +0 -6
- data/docs/UpdateProductDto.md +0 -18
- data/docs/UpdateTaxInput.md +0 -6
- data/example.rb +0 -129
- data/lib/devdraft/models/all_of_all_balances_response_eurc.rb +0 -283
- data/lib/devdraft/models/all_of_all_balances_response_usdc.rb +0 -283
- data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_destination_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_destination_network.rb +0 -202
- data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_source_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_source_payment_rail.rb +0 -202
- data/lib/devdraft/models/all_of_create_customer_dto_status.rb +0 -202
- data/lib/devdraft/models/all_of_create_liquidation_address_dto_destination_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_liquidation_address_dto_destination_payment_rail.rb +0 -202
- data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_destination_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_destination_network.rb +0 -202
- data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_source_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_source_network.rb +0 -202
- data/lib/devdraft/models/all_of_update_customer_dto_status.rb +0 -202
- data/lib/devdraft/models/create_product_dto.rb +0 -370
- data/lib/devdraft/models/create_tax_input.rb +0 -197
- data/lib/devdraft/models/update_payment_link_dto.rb +0 -197
- data/lib/devdraft/models/update_preference_input.rb +0 -197
- data/lib/devdraft/models/update_product_dto.rb +0 -355
- data/lib/devdraft/models/update_tax_input.rb +0 -197
- data/spec/api_client_spec.rb +0 -225
- data/spec/base_object_spec.rb +0 -109
- data/spec/configuration_spec.rb +0 -41
- data/spec/models/all_of_all_balances_response_eurc_spec.rb +0 -56
- data/spec/models/all_of_all_balances_response_usdc_spec.rb +0 -56
- data/spec/models/all_of_create_bank_payment_intent_dto_destination_currency_spec.rb +0 -34
- data/spec/models/all_of_create_bank_payment_intent_dto_destination_network_spec.rb +0 -34
- data/spec/models/all_of_create_bank_payment_intent_dto_source_currency_spec.rb +0 -34
- data/spec/models/all_of_create_bank_payment_intent_dto_source_payment_rail_spec.rb +0 -34
- data/spec/models/all_of_create_customer_dto_status_spec.rb +0 -34
- data/spec/models/all_of_create_liquidation_address_dto_destination_currency_spec.rb +0 -34
- data/spec/models/all_of_create_liquidation_address_dto_destination_payment_rail_spec.rb +0 -34
- data/spec/models/all_of_create_stable_payment_intent_dto_destination_currency_spec.rb +0 -34
- data/spec/models/all_of_create_stable_payment_intent_dto_destination_network_spec.rb +0 -34
- data/spec/models/all_of_create_stable_payment_intent_dto_source_currency_spec.rb +0 -34
- data/spec/models/all_of_create_stable_payment_intent_dto_source_network_spec.rb +0 -34
- data/spec/models/all_of_update_customer_dto_status_spec.rb +0 -34
- data/spec/models/create_product_dto_spec.rb +0 -110
- data/spec/models/create_tax_input_spec.rb +0 -34
- data/spec/models/update_payment_link_dto_spec.rb +0 -34
- data/spec/models/update_preference_input_spec.rb +0 -34
- data/spec/models/update_product_dto_spec.rb +0 -110
- data/spec/models/update_tax_input_spec.rb +0 -34
data/docs/TestPaymentsApi.md
CHANGED
|
@@ -1,45 +1,77 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Devdraft::TestPaymentsApi
|
|
2
2
|
|
|
3
3
|
All URIs are relative to *https://api.devdraft.ai*
|
|
4
4
|
|
|
5
|
-
Method | HTTP request | Description
|
|
6
|
-
|
|
7
|
-
[**test_payment_controller_create_payment_v0**](TestPaymentsApi.md#test_payment_controller_create_payment_v0) | **POST** /api/v0/test-payment | Process a test payment
|
|
8
|
-
[**test_payment_controller_get_payment_v0**](TestPaymentsApi.md#test_payment_controller_get_payment_v0) | **GET** /api/v0/test-payment/{id} | Get payment details by ID
|
|
9
|
-
[**test_payment_controller_refund_payment_v0**](TestPaymentsApi.md#test_payment_controller_refund_payment_v0) | **POST** /api/v0/test-payment/{id}/refund | Refund a payment
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
| ------ | ------------ | ----------- |
|
|
7
|
+
| [**test_payment_controller_create_payment_v0**](TestPaymentsApi.md#test_payment_controller_create_payment_v0) | **POST** /api/v0/test-payment | Process a test payment |
|
|
8
|
+
| [**test_payment_controller_get_payment_v0**](TestPaymentsApi.md#test_payment_controller_get_payment_v0) | **GET** /api/v0/test-payment/{id} | Get payment details by ID |
|
|
9
|
+
| [**test_payment_controller_refund_payment_v0**](TestPaymentsApi.md#test_payment_controller_refund_payment_v0) | **POST** /api/v0/test-payment/{id}/refund | Refund a payment |
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
## test_payment_controller_create_payment_v0
|
|
13
|
+
|
|
14
|
+
> <PaymentResponseDto> test_payment_controller_create_payment_v0(idempotency_key, payment_request_dto)
|
|
13
15
|
|
|
14
16
|
Process a test payment
|
|
15
17
|
|
|
16
18
|
Creates a new payment. Requires an idempotency key to prevent duplicate payments on retry. ## Idempotency Key Best Practices 1. **Generate unique keys**: Use UUIDs or similar unique identifiers, prefixed with a descriptive operation name 2. **Store keys client-side**: Save the key with the original request so you can retry with the same key 3. **Key format**: Between 6-64 alphanumeric characters 4. **Expiration**: Keys expire after 24 hours by default 5. **Use case**: Perfect for ensuring payment operations are never processed twice, even during network failures ## Example Request (curl) ```bash curl -X POST \\ https://api.example.com/rest-api/v0/test-payment \\ -H 'Content-Type: application/json' \\ -H 'Client-Key: your-api-key' \\ -H 'Client-Secret: your-api-secret' \\ -H 'Idempotency-Key: payment_123456_unique_key' \\ -d '{ \"amount\": 100.00, \"currency\": \"USD\", \"description\": \"Test payment for order #12345\", \"customerId\": \"cus_12345\" }' ``` ## Example Response (First Request) ```json { \"id\": \"pay_abc123xyz456\", \"amount\": 100.00, \"currency\": \"USD\", \"status\": \"succeeded\", \"timestamp\": \"2023-07-01T12:00:00.000Z\" } ``` ## Example Response (Duplicate Request) The exact same response will be returned for any duplicate request with the same idempotency key, without creating a new payment. ## Retry Scenario Example Network failure during payment submission: 1. Client creates payment request with idempotency key: \"payment_123456_unique_key\" 2. Request begins processing, but network connection fails before response received 3. Client retries the exact same request with the same idempotency key 4. Server detects duplicate idempotency key and returns the result of the first request 5. No duplicate payment is created If you retry with same key but different parameters (e.g., different amount), you'll receive a 409 Conflict error.
|
|
17
19
|
|
|
18
|
-
###
|
|
20
|
+
### Examples
|
|
21
|
+
|
|
19
22
|
```ruby
|
|
20
|
-
|
|
21
|
-
require '
|
|
23
|
+
require 'time'
|
|
24
|
+
require 'devdraft'
|
|
25
|
+
# setup authorization
|
|
26
|
+
Devdraft.configure do |config|
|
|
27
|
+
# Configure API key authorization: x-client-secret
|
|
28
|
+
config.api_key['x-client-secret'] = 'YOUR API KEY'
|
|
29
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
30
|
+
# config.api_key_prefix['x-client-secret'] = 'Bearer'
|
|
31
|
+
|
|
32
|
+
# Configure API key authorization: x-client-key
|
|
33
|
+
config.api_key['x-client-key'] = 'YOUR API KEY'
|
|
34
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
35
|
+
# config.api_key_prefix['x-client-key'] = 'Bearer'
|
|
36
|
+
end
|
|
22
37
|
|
|
23
|
-
api_instance =
|
|
24
|
-
body = DevDraftAI::PaymentRequestDto.new # PaymentRequestDto |
|
|
38
|
+
api_instance = Devdraft::TestPaymentsApi.new
|
|
25
39
|
idempotency_key = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # String | Unique key to ensure the request is idempotent. If a request with the same key is sent multiple times, only the first will be processed, and subsequent requests will return the same response.
|
|
26
|
-
|
|
40
|
+
payment_request_dto = Devdraft::PaymentRequestDto.new({amount: 100.5, currency: 'USD', description: 'Test payment for API'}) # PaymentRequestDto |
|
|
27
41
|
|
|
28
42
|
begin
|
|
29
|
-
#Process a test payment
|
|
30
|
-
result = api_instance.test_payment_controller_create_payment_v0(
|
|
43
|
+
# Process a test payment
|
|
44
|
+
result = api_instance.test_payment_controller_create_payment_v0(idempotency_key, payment_request_dto)
|
|
31
45
|
p result
|
|
32
|
-
rescue
|
|
33
|
-
puts "
|
|
46
|
+
rescue Devdraft::ApiError => e
|
|
47
|
+
puts "Error when calling TestPaymentsApi->test_payment_controller_create_payment_v0: #{e}"
|
|
48
|
+
end
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### Using the test_payment_controller_create_payment_v0_with_http_info variant
|
|
52
|
+
|
|
53
|
+
This returns an Array which contains the response data, status code and headers.
|
|
54
|
+
|
|
55
|
+
> <Array(<PaymentResponseDto>, Integer, Hash)> test_payment_controller_create_payment_v0_with_http_info(idempotency_key, payment_request_dto)
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
begin
|
|
59
|
+
# Process a test payment
|
|
60
|
+
data, status_code, headers = api_instance.test_payment_controller_create_payment_v0_with_http_info(idempotency_key, payment_request_dto)
|
|
61
|
+
p status_code # => 2xx
|
|
62
|
+
p headers # => { ... }
|
|
63
|
+
p data # => <PaymentResponseDto>
|
|
64
|
+
rescue Devdraft::ApiError => e
|
|
65
|
+
puts "Error when calling TestPaymentsApi->test_payment_controller_create_payment_v0_with_http_info: #{e}"
|
|
34
66
|
end
|
|
35
67
|
```
|
|
36
68
|
|
|
37
69
|
### Parameters
|
|
38
70
|
|
|
39
|
-
Name | Type | Description
|
|
40
|
-
|
|
41
|
-
**
|
|
42
|
-
**
|
|
71
|
+
| Name | Type | Description | Notes |
|
|
72
|
+
| ---- | ---- | ----------- | ----- |
|
|
73
|
+
| **idempotency_key** | **String** | Unique key to ensure the request is idempotent. If a request with the same key is sent multiple times, only the first will be processed, and subsequent requests will return the same response. | |
|
|
74
|
+
| **payment_request_dto** | [**PaymentRequestDto**](PaymentRequestDto.md) | | |
|
|
43
75
|
|
|
44
76
|
### Return type
|
|
45
77
|
|
|
@@ -47,43 +79,73 @@ Name | Type | Description | Notes
|
|
|
47
79
|
|
|
48
80
|
### Authorization
|
|
49
81
|
|
|
50
|
-
|
|
82
|
+
[x-client-secret](../README.md#x-client-secret), [x-client-key](../README.md#x-client-key)
|
|
51
83
|
|
|
52
84
|
### HTTP request headers
|
|
53
85
|
|
|
54
|
-
|
|
55
|
-
|
|
86
|
+
- **Content-Type**: application/json
|
|
87
|
+
- **Accept**: application/json
|
|
56
88
|
|
|
57
89
|
|
|
90
|
+
## test_payment_controller_get_payment_v0
|
|
58
91
|
|
|
59
|
-
|
|
60
|
-
> PaymentResponseDto test_payment_controller_get_payment_v0(id)
|
|
92
|
+
> <PaymentResponseDto> test_payment_controller_get_payment_v0(id)
|
|
61
93
|
|
|
62
94
|
Get payment details by ID
|
|
63
95
|
|
|
64
|
-
###
|
|
96
|
+
### Examples
|
|
97
|
+
|
|
65
98
|
```ruby
|
|
66
|
-
|
|
67
|
-
require '
|
|
99
|
+
require 'time'
|
|
100
|
+
require 'devdraft'
|
|
101
|
+
# setup authorization
|
|
102
|
+
Devdraft.configure do |config|
|
|
103
|
+
# Configure API key authorization: x-client-secret
|
|
104
|
+
config.api_key['x-client-secret'] = 'YOUR API KEY'
|
|
105
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
106
|
+
# config.api_key_prefix['x-client-secret'] = 'Bearer'
|
|
107
|
+
|
|
108
|
+
# Configure API key authorization: x-client-key
|
|
109
|
+
config.api_key['x-client-key'] = 'YOUR API KEY'
|
|
110
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
111
|
+
# config.api_key_prefix['x-client-key'] = 'Bearer'
|
|
112
|
+
end
|
|
68
113
|
|
|
69
|
-
api_instance =
|
|
114
|
+
api_instance = Devdraft::TestPaymentsApi.new
|
|
70
115
|
id = 'id_example' # String | Payment ID
|
|
71
116
|
|
|
72
|
-
|
|
73
117
|
begin
|
|
74
|
-
#Get payment details by ID
|
|
118
|
+
# Get payment details by ID
|
|
75
119
|
result = api_instance.test_payment_controller_get_payment_v0(id)
|
|
76
120
|
p result
|
|
77
|
-
rescue
|
|
78
|
-
puts "
|
|
121
|
+
rescue Devdraft::ApiError => e
|
|
122
|
+
puts "Error when calling TestPaymentsApi->test_payment_controller_get_payment_v0: #{e}"
|
|
123
|
+
end
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### Using the test_payment_controller_get_payment_v0_with_http_info variant
|
|
127
|
+
|
|
128
|
+
This returns an Array which contains the response data, status code and headers.
|
|
129
|
+
|
|
130
|
+
> <Array(<PaymentResponseDto>, Integer, Hash)> test_payment_controller_get_payment_v0_with_http_info(id)
|
|
131
|
+
|
|
132
|
+
```ruby
|
|
133
|
+
begin
|
|
134
|
+
# Get payment details by ID
|
|
135
|
+
data, status_code, headers = api_instance.test_payment_controller_get_payment_v0_with_http_info(id)
|
|
136
|
+
p status_code # => 2xx
|
|
137
|
+
p headers # => { ... }
|
|
138
|
+
p data # => <PaymentResponseDto>
|
|
139
|
+
rescue Devdraft::ApiError => e
|
|
140
|
+
puts "Error when calling TestPaymentsApi->test_payment_controller_get_payment_v0_with_http_info: #{e}"
|
|
79
141
|
end
|
|
80
142
|
```
|
|
81
143
|
|
|
82
144
|
### Parameters
|
|
83
145
|
|
|
84
|
-
Name | Type | Description
|
|
85
|
-
|
|
86
|
-
**id** | **String
|
|
146
|
+
| Name | Type | Description | Notes |
|
|
147
|
+
| ---- | ---- | ----------- | ----- |
|
|
148
|
+
| **id** | **String** | Payment ID | |
|
|
87
149
|
|
|
88
150
|
### Return type
|
|
89
151
|
|
|
@@ -91,47 +153,77 @@ Name | Type | Description | Notes
|
|
|
91
153
|
|
|
92
154
|
### Authorization
|
|
93
155
|
|
|
94
|
-
|
|
156
|
+
[x-client-secret](../README.md#x-client-secret), [x-client-key](../README.md#x-client-key)
|
|
95
157
|
|
|
96
158
|
### HTTP request headers
|
|
97
159
|
|
|
98
|
-
|
|
99
|
-
|
|
160
|
+
- **Content-Type**: Not defined
|
|
161
|
+
- **Accept**: application/json
|
|
100
162
|
|
|
101
163
|
|
|
164
|
+
## test_payment_controller_refund_payment_v0
|
|
102
165
|
|
|
103
|
-
|
|
104
|
-
> RefundResponseDto test_payment_controller_refund_payment_v0(id, idempotency_key)
|
|
166
|
+
> <RefundResponseDto> test_payment_controller_refund_payment_v0(id, idempotency_key)
|
|
105
167
|
|
|
106
168
|
Refund a payment
|
|
107
169
|
|
|
108
170
|
Refunds an existing payment. Requires an idempotency key to prevent duplicate refunds on retry. ## Idempotency Key Benefits for Refunds Refunds are critical financial operations where duplicates can cause serious issues. Using idempotency keys ensures: 1. **Prevent duplicate refunds**: Even if a request times out or fails, retrying with the same key won't issue multiple refunds 2. **Safe retries**: Network failures or timeouts won't risk creating multiple refunds 3. **Consistent response**: Always get the same response for the same operation ## Example Request (curl) ```bash curl -X POST \\ https://api.example.com/rest-api/v0/test-payment/pay_abc123xyz456/refund \\ -H 'Content-Type: application/json' \\ -H 'Client-Key: your-api-key' \\ -H 'Client-Secret: your-api-secret' \\ -H 'Idempotency-Key: refund_123456_unique_key' ``` ## Example Response (First Request) ```json { \"id\": \"ref_xyz789\", \"paymentId\": \"pay_abc123xyz456\", \"amount\": 100.00, \"status\": \"succeeded\", \"timestamp\": \"2023-07-01T14:30:00.000Z\" } ``` ## Example Response (Duplicate Request) The exact same response will be returned for any duplicate request with the same idempotency key, without creating a new refund. ## Idempotency Key Guidelines - Use a unique key for each distinct refund operation - Store keys client-side to ensure you can retry with the same key if needed - Keys expire after 24 hours by default
|
|
109
171
|
|
|
110
|
-
###
|
|
172
|
+
### Examples
|
|
173
|
+
|
|
111
174
|
```ruby
|
|
112
|
-
|
|
113
|
-
require '
|
|
175
|
+
require 'time'
|
|
176
|
+
require 'devdraft'
|
|
177
|
+
# setup authorization
|
|
178
|
+
Devdraft.configure do |config|
|
|
179
|
+
# Configure API key authorization: x-client-secret
|
|
180
|
+
config.api_key['x-client-secret'] = 'YOUR API KEY'
|
|
181
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
182
|
+
# config.api_key_prefix['x-client-secret'] = 'Bearer'
|
|
183
|
+
|
|
184
|
+
# Configure API key authorization: x-client-key
|
|
185
|
+
config.api_key['x-client-key'] = 'YOUR API KEY'
|
|
186
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
187
|
+
# config.api_key_prefix['x-client-key'] = 'Bearer'
|
|
188
|
+
end
|
|
114
189
|
|
|
115
|
-
api_instance =
|
|
190
|
+
api_instance = Devdraft::TestPaymentsApi.new
|
|
116
191
|
id = 'id_example' # String | Payment ID to refund
|
|
117
192
|
idempotency_key = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # String | Unique key to ensure the refund request is idempotent. If a request with the same key is sent multiple times, only the first will be processed, and subsequent requests will return the same response.
|
|
118
193
|
|
|
119
|
-
|
|
120
194
|
begin
|
|
121
|
-
#Refund a payment
|
|
195
|
+
# Refund a payment
|
|
122
196
|
result = api_instance.test_payment_controller_refund_payment_v0(id, idempotency_key)
|
|
123
197
|
p result
|
|
124
|
-
rescue
|
|
125
|
-
puts "
|
|
198
|
+
rescue Devdraft::ApiError => e
|
|
199
|
+
puts "Error when calling TestPaymentsApi->test_payment_controller_refund_payment_v0: #{e}"
|
|
200
|
+
end
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Using the test_payment_controller_refund_payment_v0_with_http_info variant
|
|
204
|
+
|
|
205
|
+
This returns an Array which contains the response data, status code and headers.
|
|
206
|
+
|
|
207
|
+
> <Array(<RefundResponseDto>, Integer, Hash)> test_payment_controller_refund_payment_v0_with_http_info(id, idempotency_key)
|
|
208
|
+
|
|
209
|
+
```ruby
|
|
210
|
+
begin
|
|
211
|
+
# Refund a payment
|
|
212
|
+
data, status_code, headers = api_instance.test_payment_controller_refund_payment_v0_with_http_info(id, idempotency_key)
|
|
213
|
+
p status_code # => 2xx
|
|
214
|
+
p headers # => { ... }
|
|
215
|
+
p data # => <RefundResponseDto>
|
|
216
|
+
rescue Devdraft::ApiError => e
|
|
217
|
+
puts "Error when calling TestPaymentsApi->test_payment_controller_refund_payment_v0_with_http_info: #{e}"
|
|
126
218
|
end
|
|
127
219
|
```
|
|
128
220
|
|
|
129
221
|
### Parameters
|
|
130
222
|
|
|
131
|
-
Name | Type | Description
|
|
132
|
-
|
|
133
|
-
**id** | **String
|
|
134
|
-
**idempotency_key** |
|
|
223
|
+
| Name | Type | Description | Notes |
|
|
224
|
+
| ---- | ---- | ----------- | ----- |
|
|
225
|
+
| **id** | **String** | Payment ID to refund | |
|
|
226
|
+
| **idempotency_key** | **String** | Unique key to ensure the refund request is idempotent. If a request with the same key is sent multiple times, only the first will be processed, and subsequent requests will return the same response. | |
|
|
135
227
|
|
|
136
228
|
### Return type
|
|
137
229
|
|
|
@@ -139,12 +231,10 @@ Name | Type | Description | Notes
|
|
|
139
231
|
|
|
140
232
|
### Authorization
|
|
141
233
|
|
|
142
|
-
|
|
234
|
+
[x-client-secret](../README.md#x-client-secret), [x-client-key](../README.md#x-client-key)
|
|
143
235
|
|
|
144
236
|
### HTTP request headers
|
|
145
237
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
238
|
+
- **Content-Type**: Not defined
|
|
239
|
+
- **Accept**: application/json
|
|
150
240
|
|