Skip to content

Commit

Permalink
feat: Add endpoint to create charges for an existing order (#114)
Browse files Browse the repository at this point in the history
* feat: Add endpoint to create charges for an existing order

- Added new endpoint `/orders/{id}/add_charges` to create charges for an existing order
- Updated OpenAPI specification file with the new endpoint and its parameters
- Added corresponding method `OrdersCreateCharges` in `ChargesApi.cs`
- Added test case `OrdersCreateChargesCashTest` in `ChargesApiTests.cs` to test the new endpoint

* Update codeclimate-action version to v9.0.0 for test and publish code coverage.

- Update codeclimate-action version from v5.0.0 to v9.0.0
- Allows for test and publish code coverage

* Refactor ChargesApiTests.cs: remove unnecessary assertions

- Remove assertions for Agreement and ProductType in the test method at line 122.

* Update Conekta.net package version to 6.0.12 and fix data-file URL in dotnet.yml
  • Loading branch information
fcarrero authored Oct 25, 2024
1 parent 113e01f commit da26907
Show file tree
Hide file tree
Showing 220 changed files with 4,357 additions and 1,519 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Execute dotnet
run: dotnet build
- name: Test and publish code coverage
uses: paambaati/codeclimate-action@v5.0.0
uses: paambaati/codeclimate-action@v9.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
BASE_PATH: http://localhost:3000
Expand Down
4 changes: 4 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ docs/ChargeResponseRefundsData.md
docs/ChargeUpdateRequest.md
docs/ChargesApi.md
docs/ChargesDataResponse.md
docs/ChargesOrderResponse.md
docs/ChargesOrderResponseAllOfData.md
docs/Checkout.md
docs/CheckoutOrderTemplate.md
docs/CheckoutOrderTemplateCustomerInfo.md
Expand Down Expand Up @@ -268,6 +270,8 @@ src/Conekta.net/Model/ChargeResponseRefunds.cs
src/Conekta.net/Model/ChargeResponseRefundsData.cs
src/Conekta.net/Model/ChargeUpdateRequest.cs
src/Conekta.net/Model/ChargesDataResponse.cs
src/Conekta.net/Model/ChargesOrderResponse.cs
src/Conekta.net/Model/ChargesOrderResponseAllOfData.cs
src/Conekta.net/Model/Checkout.cs
src/Conekta.net/Model/CheckoutOrderTemplate.cs
src/Conekta.net/Model/CheckoutOrderTemplateCustomerInfo.cs
Expand Down
2 changes: 1 addition & 1 deletion .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.9.0
10 changes: 5 additions & 5 deletions Conekta.net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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", "{F4EEE3F4-00D1-4376-A5E8-0ADD0FFDCB95}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Conekta.net", "src\Conekta.net\Conekta.net.csproj", "{604EDD2F-2B46-4DDC-8212-DC4E6595C4E6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Conekta.net.Test", "src\Conekta.net.Test\Conekta.net.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
Expand All @@ -12,10 +12,10 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{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
{604EDD2F-2B46-4DDC-8212-DC4E6595C4E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{604EDD2F-2B46-4DDC-8212-DC4E6595C4E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{604EDD2F-2B46-4DDC-8212-DC4E6595C4E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{604EDD2F-2B46-4DDC-8212-DC4E6595C4E6}.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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ csharp:
rm -rf /docs && \
rm -rf src/Conekta.net/Model && \
docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli:v7.5.0 generate \
-v ${PWD}:/local openapitools/openapi-generator-cli:v7.9.0 generate \
-i https://raw.githubusercontent.com/conekta/openapi/main/_build/api.yaml \
-g csharp \
-o /local \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.11
6.0.12
156 changes: 156 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,126 @@ paths:
summary: Create charge
tags:
- Charges
/orders/{id}/add_charges:
post:
description: Create charges for an existing orden
operationId: ordersCreateCharges
parameters:
- description: Identifier of the resource
example: 6307a60c41de27127515a575
explode: false
in: path
name: id
required: true
schema:
type: string
style: simple
- description: Use for knowing which language to use
examples:
es:
summary: for spanish request/response
value: es
en:
summary: for english request/response
value: en
explode: false
in: header
name: Accept-Language
required: false
schema:
default: es
enum:
- es
- en
type: string
style: simple
- description: "In the case of a holding company, the company id of the child\
\ company to which will process the request."
example: 6441b6376b60c3a638da80af
explode: false
in: header
name: X-Child-Company-Id
required: false
schema:
type: string
style: simple
requestBody:
$ref: '#/components/requestBodies/charge_create'
responses:
"200":
content:
application/vnd.conekta-v2.1.0+json:
schema:
$ref: '#/components/schemas/charges_order_response'
description: successful
"401":
content:
application/vnd.conekta-v2.1.0+json:
example:
details:
- message: Please include your access key in your request.
param: null
code: conekta.errors.authentication.missing_key
log_id: 507f1f77bcf86cd799439011
object: error
type: authentication_error
schema:
$ref: '#/components/schemas/error'
description: authentication error
"404":
content:
application/vnd.conekta-v2.1.0+json:
example:
details:
- message: The resource was not found.
param: null
code: conekta.errors.resource_not_found.entity
debug_message: The object Webhook "641b1d5662d7e00001eaa46b" could
not be found.
log_id: 641b6c253cd9a50001514fae
object: error
type: resource_not_found_error
schema:
$ref: '#/components/schemas/error'
description: not found entity
"428":
content:
application/vnd.conekta-v2.1.0+json:
example:
details:
- debug_message: The order cannot be modified because it has already
a charge which is pending payment.
message: The order cannot be modified because it has already a charge
which is pending payment.
param: null
code: conekta.errors.precondition_required.combo.order.cannot_be_updated_because_has_charge
log_id: 641b6e233cd9a50001515039
object: error
type: precondition_required_error
schema:
$ref: '#/components/schemas/error'
description: Precondition Required
"500":
content:
application/vnd.conekta-v2.1.0+json:
example:
details:
- debug_message: There was a runtime error and Conekta engineers have
been notified.
message: There was a runtime error and Conekta engineers have been
notified.
param: null
code: conekta.errors.api.system.general_failure
object: error
type: api_error
log_id: 641b6f2b3cd9a50001515098
schema:
$ref: '#/components/schemas/error'
description: internal server error
security:
- bearerAuth: []
tags:
- Charges
/companies:
get:
description: Consume the list of child companies. This is used for holding
Expand Down Expand Up @@ -13292,6 +13412,10 @@ components:
type: object
charge_response:
properties:
agreement:
description: Agreement ID
example: agreement_2tN73UdUSNrYRPD9r
type: string
amount:
example: 4321
type: integer
Expand Down Expand Up @@ -13342,6 +13466,11 @@ components:
type: integer
payment_method:
$ref: '#/components/schemas/charge_response_payment_method'
product_type:
description: "Product type, e.g. bbva_cash_in, cash_in, pespay_cash_in,\
\ etc."
example: bbva_cash_in
type: string
reference_id:
description: Reference ID of the charge
example: ref_2tN73UdUSNrYRPD9r
Expand Down Expand Up @@ -13418,6 +13547,16 @@ components:
type: string
title: charges_data_response
type: object
charges_order_response:
allOf:
- $ref: '#/components/schemas/pagination'
- properties:
data:
items:
$ref: '#/components/schemas/charges_order_response_allOf_data'
type: array
type: object
description: The charges associated with the order
company_response:
description: Company model
properties:
Expand Down Expand Up @@ -16053,6 +16192,12 @@ components:
format: int8
type: integer
type: array
max_failed_retries:
description: Number of retries allowed before the checkout is marked as
failed
example: 3
format: int8
type: integer
name:
description: Reason for payment
type: string
Expand Down Expand Up @@ -16742,6 +16887,9 @@ components:
- $ref: '#/components/schemas/payment_method_card'
- $ref: '#/components/schemas/payment_method_bank_transfer'
title: charge_order_response_payment_method
charges_order_response_allOf_data:
allOf:
- $ref: '#/components/schemas/charge_response'
customer_antifraud_info_response:
nullable: true
properties:
Expand Down Expand Up @@ -17041,6 +17189,12 @@ components:
livemode:
example: false
type: boolean
max_failed_retries:
description: Number of retries allowed before the checkout is marked as
failed
example: 3
format: int8
type: integer
metadata:
additionalProperties: true
maxProperties: 100
Expand Down Expand Up @@ -17748,6 +17902,7 @@ components:
example: "123"
maxLength: 4
type: string
x-encripted: true
device_fingerprint:
description: It is a value that allows identifying the device fingerprint.
example: zptcxk4p6w1ijwz85snf1l3bqe5g09ie
Expand All @@ -17772,6 +17927,7 @@ components:
description: It is a value that allows identifying the number of the card.
example: "4242424242424242"
type: string
x-encripted: true
required:
- cvc
- exp_month
Expand Down
2 changes: 1 addition & 1 deletion config-netcore.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"packageCopyright" : "Conekta",
"PackageReleaseNotes" : "add support for payout orders",
"releaseNote" : "update entity webhook, nuget config",
"packageVersion" : "6.0.11"
"packageVersion" : "6.0.12"
}
2 changes: 2 additions & 0 deletions docs/ChargeResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Agreement** | **string** | Agreement ID | [optional]
**Amount** | **int** | | [optional]
**Channel** | [**ChargeResponseChannel**](ChargeResponseChannel.md) | | [optional]
**CreatedAt** | **long** | | [optional]
Expand All @@ -19,6 +20,7 @@ Name | Type | Description | Notes
**OrderId** | **string** | Order ID | [optional]
**PaidAt** | **long?** | Payment date | [optional]
**PaymentMethod** | [**ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional]
**ProductType** | **string** | Product type, e.g. bbva_cash_in, cash_in, pespay_cash_in, etc. | [optional]
**ReferenceId** | **string** | Reference ID of the charge | [optional]
**Refunds** | [**ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional]
**Status** | **string** | | [optional]
Expand Down
Loading

0 comments on commit da26907

Please sign in to comment.