Skip to content

Commit

Permalink
Al 252 sdk devcenter add endpoint add charges (#73)
Browse files Browse the repository at this point in the history
* Update generator-tag to v7.9.0 in check.yml
Add endpoint /orders/{id}/add_charges for creating charges for an existing order
Update schemas and components related to charges and orders

* Refactor charges_order_response schema

The charges_order_response schema has been refactored to remove the unnecessary title field. This change improves code readability and maintainability.

* Refactor API and mocks for creating charges

- Removed unnecessary summary from API definition
- Added new endpoint for creating charges in the API definition
- Updated mock data to include successful multiple cash charges, successful card with monthly installments, successful spei, successful cash, authentication error, not found entity, and internal server error
- Updated order_charges_param.yml to remove unnecessary summary
  • Loading branch information
fcarrero authored Oct 25, 2024
1 parent 72c5f91 commit 3c4983b
Show file tree
Hide file tree
Showing 10 changed files with 426 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
generator: openapi-yaml
openapi-file: api.yaml
generator-tag: v7.4.0
generator-tag: v7.9.0
- name: check if api.yaml are equals
run: |
if diff -q _build/api.yaml openapi-yaml-client/openapi/openapi.yaml >/dev/null; then
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
API_README_VERSION_ID = 641deb4041d58005f2c45bf3
merge:
docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli:v7.6.0 generate \
-v ${PWD}:/local openapitools/openapi-generator-cli:v7.9.0 generate \
-g openapi-yaml \
-i /local/api.yaml \
-p outputFile=local/_build/api.yaml \
Expand Down
148 changes: 148 additions & 0 deletions _build/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,120 @@ 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
in: path
name: id
required: true
schema:
type: string
- 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
in: header
name: Accept-Language
required: false
schema:
default: es
enum:
- es
- en
type: string
- description: "In the case of a holding company, the company id of the child\
\ company to which will process the request."
example: 6441b6376b60c3a638da80af
in: header
name: X-Child-Company-Id
required: false
schema:
type: string
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 @@ -12178,6 +12292,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 @@ -12228,6 +12346,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 @@ -12304,6 +12427,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 @@ -14939,6 +15072,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 @@ -15628,6 +15767,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 @@ -15929,6 +16071,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
2 changes: 2 additions & 0 deletions api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ paths:
$ref: "./resources/charges/update_charge.yml"
/orders/{id}/charges:
$ref: "./resources/orders/order_charge_param.yml"
/orders/{id}/add_charges:
$ref: "./resources/orders/order_charges_param.yml"
/companies:
$ref: "./resources/companies/companies.yml"
/companies/{id}:
Expand Down
Loading

0 comments on commit 3c4983b

Please sign in to comment.