diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..9f348fb --- /dev/null +++ b/.drone.yml @@ -0,0 +1,49 @@ +--- +kind: pipeline +type: kubernetes +name: default + +trigger: + branch: + - main + event: + - pull_request + + +steps: + - name: build_image + image: plugins/ecr + privileged: true + settings: + dockerfile: Dockerfile + registry: 462204803675.dkr.ecr.us-east-1.amazonaws.com + debug: true + target: builder + tags: + - "${DRONE_BUILD_NUMBER}" + environment: + AWS_ACCESS_KEY_ID: + from_secret: AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: + from_secret: AWS_SECRET_ACCESS_KEY + PLUGIN_SSH_AGENT_KEY: + from_secret: SSH_KEY + DOCKER_BUILDKIT: 1 + ECR_CREATE_REPOSITORY: true + PLUGIN_REPO: ${DRONE_REPO} + - name: validate + image: 462204803675.dkr.ecr.us-east-1.amazonaws.com/${DRONE_REPO}:${DRONE_BUILD_NUMBER} + depends_on: + - build_image + commands: + - openapi-generator-cli validate -i api.yaml + - name: dummy generator + image: 462204803675.dkr.ecr.us-east-1.amazonaws.com/${DRONE_REPO}:${DRONE_BUILD_NUMBER} + depends_on: + - build_image + commands: + - openapi-generator-cli generate -i api.yaml -g openapi-yaml + +image_pull_secrets: + - ECR_PULL_SECRET + - DOCKERCONFIG \ No newline at end of file diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b2044ca..da0c0c0 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -24,7 +24,7 @@ jobs: with: generator: openapi-yaml openapi-file: api.yaml - generator-tag: v6.6.0 + generator-tag: v7.4.0 - name: check if api.yaml are equals run: | if diff -q _build/api.yaml openapi-yaml-client/openapi/openapi.yaml >/dev/null; then diff --git a/Dockerfile b/Dockerfile index ac344cd..1f80e9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14 as builder +FROM node:16 as builder # Install OpenJDK-11 RUN apt-get update && \ @@ -6,13 +6,12 @@ RUN apt-get update && \ apt-get clean; RUN npm install @openapitools/openapi-generator-cli -g -RUN openapi-generator-cli version-manager set 6.3.0 +RUN openapi-generator-cli version-manager set 7.3.0 WORKDIR /app COPY parameters/ parameters/ COPY requestBodies requestBodies/ COPY resources resources/ COPY schemas schemas/ -COPY templates templates/ COPY Makefile Makefile COPY api.yaml api.yaml diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index d6d1428..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,44 +0,0 @@ -@Library('ckt-libraries') -import static git.Github.* -import static checks.SonarQube.* -import static docker.Docker.* - -node('sre-slave') { - - ansiColor('xterm') { - final String REGEX_FILTER = '^((false (opened|reopened|synchronize))|(true (closed)))? (develop|master|main)?$' - triggers.setGenericTriggerConfiguration(this, repo_name, REGEX_FILTER) - - final String CI_DOCKER_TARGET_STAGE = "builder" - final String DEFAULT_DOCKERFILE = "Dockerfile" - final List vulnerabilities_type = ["CRITICAL"] - String target_branch = action == "closed" ? base_branch : head_branch - currentBuild.displayName = "${BUILD_NUMBER} - ${repo_name} - ${target_branch}" - - try { - notifyPRStatus(this, env.GITHUB_TOKEN_CREDENTIAL_ID, "pending", statuses_url, "${BUILD_URL}") - stage("Checkout") { - git(url: clone_url, branch: target_branch, credentialsId: env.GITHUB_SSH_CREDENTIAL_ID) - } - - stage('Docker Build') { - buildDockerImage(this, repo_name, env.GITHUB_SSH_CREDENTIAL_ID, DEFAULT_DOCKERFILE, CI_DOCKER_TARGET_STAGE) - } - stage('validate') { - runCommand(this, repo_name, "openapi-generator-cli validate -i api.yaml") - } - stage('dummy generator') { - runCommand(this, repo_name, "openapi-generator-cli generate -i api.yaml -g openapi-yaml") - } - - notifyPRStatus(this, env.GITHUB_TOKEN_CREDENTIAL_ID, "success", statuses_url, "${BUILD_URL}") - } catch (Exception e) { - currentBuild.result = 'FAILURE' - echo "Exception: ${e}" - notifyPRStatus(this, env.GITHUB_TOKEN_CREDENTIAL_ID, "failure", statuses_url, "${BUILD_URL}") - } finally { - downDockerCompose(this, "docker-compose.ci.yml", BUILD_NUMBER) - cleanWs() - } - } -} diff --git a/Makefile b/Makefile index 6736d93..f53cf7b 100644 --- a/Makefile +++ b/Makefile @@ -1,80 +1,11 @@ API_README_VERSION_ID = 641deb4041d58005f2c45bf3 merge: - npx @openapitools/openapi-generator-cli generate \ + docker run --rm \ + -v ${PWD}:/local openapitools/openapi-generator-cli:v7.4.0 generate \ -g openapi-yaml \ - -i api.yaml \ - -p outputFile=_build/api.yaml \ + -i /local/api.yaml \ + -p outputFile=local/_build/api.yaml \ --skip-validate-spec - -python: - npx @openapitools/openapi-generator-cli generate \ - -i api.yaml \ - -g python-nextgen \ - -o ../conekta-python \ - -c config-python.json \ - --global-property modelTests=false - -java: - mkdir -p conekta-java && \ - npx @openapitools/openapi-generator-cli generate \ - -i api.yaml \ - -g java \ - -o ../ct-conekta-java \ - -c config-java.json \ - --global-property modelTests=false \ - --additional-properties=hideGenerationTimestamp=true - -go: - npx @openapitools/openapi-generator-cli generate \ - -i api.yaml \ - -g go \ - -o ../conekta-go \ - -c config-go.json \ - --global-property modelTests=false \ - --additional-properties=hideGenerationTimestamp=true - -ruby: - npx @openapitools/openapi-generator-cli generate \ - -i api.yaml \ - -g ruby \ - -o ../conekta-ruby \ - -c config-ruby.json \ - --global-property modelTests=false - -csharp: - mkdir -p conekta-.net && \ - cp .openapi-generator-ignore conekta-.net/.openapi-generator-ignore && \ - rm -rf ../conekta-.net/docs && \ - rm -rf ../conekta-.net/src/Conekta.net/Model && \ - npx @openapitools/openapi-generator-cli generate \ - -i api.yaml \ - -g csharp-netcore \ - -o ../conekta-.net \ - -c config-netcore.json \ - --global-property modelTests=false - -php: - npx @openapitools/openapi-generator-cli generate \ - -i api.yaml \ - -g php \ - -o ../conekta-php \ - -c config-php.json \ - --global-property modelTests=false - -node: - rm -rf ../conekta-node/api && \ - rm -rf ../conekta-node/model && \ - npx @openapitools/openapi-generator-cli generate -i api.yaml -g typescript-axios \ - -o ../conekta-node -c config-node.json \ - --global-property apiDocs=false --global-property apiTests=true - -dart: - rm -rf ../conekta-dart/lib && \ - rm -rf ../conekta-dart/doc && \ - npx @openapitools/openapi-generator-cli generate -i api.yaml -g dart-dio \ - -o ../conekta-dart \ - -c config-dart.json \ - --global-property modelTests=false update-readme: make merge && rdme openapi _build/api.yaml --id=$(API_README_VERSION_ID) --key=${README_API_KEY} diff --git a/README.md b/README.md index ec40d70..5272a9b 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ How to use

-java generator proyect +go generator proyect

``` -make java +make go ```

diff --git a/_build/api.yaml b/_build/api.yaml index 794739c..3f8eeb9 100644 --- a/_build/api.yaml +++ b/_build/api.yaml @@ -1227,6 +1227,128 @@ paths: summary: Get A List of Charges tags: - Charges + /charges/{id}: + put: + operationId: updateCharge + 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_update' + responses: + "200": + content: + application/vnd.conekta-v2.1.0+json: + schema: + $ref: '#/components/schemas/charge_response' + description: successful + headers: + Date: + description: The date and time that the response was sent + schema: + example: "Fri, 03 Feb 2023 16:57:48 GMT" + type: string + Content-Type: + description: The format of the response body + schema: + example: application/json; charset=utf-8 + type: string + Content-Length: + description: The length of the response body in bytes + schema: + example: "2737" + type: string + Connection: + description: The type of connection used to transfer the response + schema: + example: keep-alive + type: string + Conekta-Media-Type: + schema: + example: conekta-v2.1.0; format=application/json + type: string + "422": + content: + application/vnd.conekta-v2.1.0+json: + example: + details: + - debug_message: The "custom_field" parameter is not allowed + message: El parametro "custom_field" no está permitido + code: conekta.errors.parameter_validation.whitelist + object: error + type: parameter_validation_error + log_id: 6462aa7c90fef20001633546 + schema: + $ref: '#/components/schemas/error' + description: whitelist validation 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 + "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: [] + summary: Update a charge + tags: + - Charges /orders/{id}/charges: post: description: Create charge for an existing orden @@ -3641,10 +3763,8 @@ paths: examples: cash: $ref: '#/components/examples/order_cash' - value: null card: $ref: '#/components/examples/order_card' - value: null schema: $ref: '#/components/schemas/order_response' description: successful operation @@ -4755,10 +4875,10 @@ paths: summary: Cancel Refund tags: - Orders - /checkouts: + /payout_orders: get: - description: Returns a list of links generated by the merchant - operationId: getCheckouts + description: Get Payout order details in the form of a list + operationId: getPayoutOrders parameters: - description: Use for knowing which language to use examples: @@ -4777,14 +4897,6 @@ paths: - 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 - description: "The numbers of items to return, the maximum value is 250" in: query name: limit @@ -4816,38 +4928,13 @@ paths: responses: "200": content: - application/vnd.conekta-v2.2.0+json: + application/vnd.conekta-v2.1.0+json: schema: - $ref: '#/components/schemas/checkouts_response' + $ref: '#/components/schemas/payout_orders_response' description: successful operation - headers: - Date: - description: The date and time that the response was sent - schema: - example: "Fri, 03 Feb 2023 16:57:48 GMT" - type: string - Content-Type: - description: The format of the response body - schema: - example: application/json; charset=utf-8 - type: string - Content-Length: - description: The length of the response body in bytes - schema: - example: "2737" - type: string - Connection: - description: The type of connection used to transfer the response - schema: - example: keep-alive - type: string - Conekta-Media-Type: - schema: - example: conekta-v2.1.0; format=application/json - type: string "401": content: - application/vnd.conekta-v2.2.0+json: + application/vnd.conekta-v2.1.0+json: example: details: - message: Please include your access key in your request. @@ -4859,38 +4946,9 @@ paths: schema: $ref: '#/components/schemas/error' description: authentication error - "402": - content: - application/vnd.conekta-v2.2.0+json: - example: - details: - - message: The card could not be processed. - code: conekta.errors.processing.tokenization.used - debug_message: The token has already been used. - log_id: 641b6d073cd9a50001515007 - object: error - type: processing_error - schema: - $ref: '#/components/schemas/error' - description: payment required error - "422": - content: - application/vnd.conekta-v2.2.0+json: - example: - details: - - message: The token does not exist. - param: payment_method.token_id - code: conekta.errors.parameter_validation.payment_method.token_id.nonexistent_token - debug_message: The token does not exist. - log_id: 641b6d813cd9a50001515017 - object: error - type: parameter_validation_error - schema: - $ref: '#/components/schemas/error' - description: parameter validation error "500": content: - application/vnd.conekta-v2.2.0+json: + application/vnd.conekta-v2.1.0+json: example: details: - debug_message: There was a runtime error and Conekta engineers have @@ -4907,11 +4965,12 @@ paths: description: internal server error security: - bearerAuth: [] - summary: Get a list of payment links + summary: Get a list of Payout Orders tags: - - Payment Link + - Payout Orders post: - operationId: createCheckout + description: Create a new payout order. + operationId: createPayoutOrder parameters: - description: Use for knowing which language to use examples: @@ -4930,53 +4989,33 @@ paths: - 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/checkout' + $ref: '#/components/requestBodies/payout_order' responses: "200": content: - application/vnd.conekta-v2.2.0+json: + application/vnd.conekta-v2.1.0+json: schema: - $ref: '#/components/schemas/checkout_response' + $ref: '#/components/schemas/payout_order_response' description: successful operation - headers: - Date: - description: The date and time that the response was sent - schema: - example: "Fri, 03 Feb 2023 16:57:48 GMT" - type: string - Content-Type: - description: The format of the response body - schema: - example: application/json; charset=utf-8 - type: string - Content-Length: - description: The length of the response body in bytes - schema: - example: "2737" - type: string - Connection: - description: The type of connection used to transfer the response - schema: - example: keep-alive - type: string - Conekta-Media-Type: - description: The version of the API used to process the request and - the format of the response body + "422": + content: + application/vnd.conekta-v2.1.0+json: + example: + details: + - message: The token does not exist. + param: payment_method.token_id + code: conekta.errors.parameter_validation.payment_method.token_id.nonexistent_token + debug_message: The token does not exist. + log_id: 641b6d813cd9a50001515017 + object: error + type: parameter_validation_error schema: - example: conekta-v2.1.0; format=application/json - type: string + $ref: '#/components/schemas/error' + description: parameter validation error "401": content: - application/vnd.conekta-v2.2.0+json: + application/vnd.conekta-v2.1.0+json: example: details: - message: Please include your access key in your request. @@ -4990,7 +5029,7 @@ paths: description: authentication error "402": content: - application/vnd.conekta-v2.2.0+json: + application/vnd.conekta-v2.1.0+json: example: details: - message: The card could not be processed. @@ -5002,24 +5041,25 @@ paths: schema: $ref: '#/components/schemas/error' description: payment required error - "422": + "404": content: - application/vnd.conekta-v2.2.0+json: + application/vnd.conekta-v2.1.0+json: example: details: - - message: The token does not exist. - param: payment_method.token_id - code: conekta.errors.parameter_validation.payment_method.token_id.nonexistent_token - debug_message: The token does not exist. - log_id: 641b6d813cd9a50001515017 + - 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: parameter_validation_error + type: resource_not_found_error schema: $ref: '#/components/schemas/error' - description: parameter validation error + description: not found entity "500": content: - application/vnd.conekta-v2.2.0+json: + application/vnd.conekta-v2.1.0+json: example: details: - debug_message: There was a runtime error and Conekta engineers have @@ -5036,12 +5076,102 @@ paths: description: internal server error security: - bearerAuth: [] - summary: Create Unique Payment Link + summary: Create payout order tags: - - Payment Link - /checkouts/{id}: + - Payout Orders + /payout_orders/{id}: get: - operationId: getCheckout + description: Gets a payout Order resource that corresponds to a payout order + ID. + operationId: getPayoutOrderById + 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 + responses: + "200": + content: + application/vnd.conekta-v2.1.0+json: + schema: + $ref: '#/components/schemas/payout_order_response' + description: successful operation + "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 + "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: [] + summary: Get Payout Order + tags: + - Payout Orders + /checkouts: + get: + description: Returns a list of links generated by the merchant + operationId: getCheckouts parameters: - description: Use for knowing which language to use examples: @@ -5068,11 +5198,32 @@ paths: required: false schema: type: string - - description: Identifier of the resource - example: 6307a60c41de27127515a575 - in: path - name: id - required: true + - description: "The numbers of items to return, the maximum value is 250" + in: query + name: limit + required: false + schema: + default: 20 + format: int32 + maximum: 250 + minimum: 1 + type: integer + - description: "General order search, e.g. by mail, reference etc." + in: query + name: search + required: false + schema: + type: string + - description: next page + in: query + name: next + required: false + schema: + type: string + - description: previous page + in: query + name: previous + required: false schema: type: string responses: @@ -5080,7 +5231,7 @@ paths: content: application/vnd.conekta-v2.2.0+json: schema: - $ref: '#/components/schemas/checkout_response' + $ref: '#/components/schemas/checkouts_response' description: successful operation headers: Date: @@ -5135,22 +5286,6 @@ paths: schema: $ref: '#/components/schemas/error' description: payment required error - "404": - content: - application/vnd.conekta-v2.2.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 "422": content: application/vnd.conekta-v2.2.0+json: @@ -5185,12 +5320,11 @@ paths: description: internal server error security: - bearerAuth: [] - summary: Get a payment link by ID + summary: Get a list of payment links tags: - Payment Link - /checkouts/{id}/cancel: - put: - operationId: cancelCheckout + post: + operationId: createCheckout parameters: - description: Use for knowing which language to use examples: @@ -5217,13 +5351,8 @@ paths: required: false schema: type: string - - description: Identifier of the resource - example: 6307a60c41de27127515a575 - in: path - name: id - required: true - schema: - type: string + requestBody: + $ref: '#/components/requestBodies/checkout' responses: "200": content: @@ -5253,6 +5382,8 @@ paths: example: keep-alive type: string Conekta-Media-Type: + description: The version of the API used to process the request and + the format of the response body schema: example: conekta-v2.1.0; format=application/json type: string @@ -5284,22 +5415,6 @@ paths: schema: $ref: '#/components/schemas/error' description: payment required error - "404": - content: - application/vnd.conekta-v2.2.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 "422": content: application/vnd.conekta-v2.2.0+json: @@ -5334,12 +5449,12 @@ paths: description: internal server error security: - bearerAuth: [] - summary: Cancel Payment Link + summary: Create Unique Payment Link tags: - Payment Link - /checkouts/{id}/email: - post: - operationId: emailCheckout + /checkouts/{id}: + get: + operationId: getCheckout parameters: - description: Use for knowing which language to use examples: @@ -5373,8 +5488,6 @@ paths: required: true schema: type: string - requestBody: - $ref: '#/components/requestBodies/checkout_email' responses: "200": content: @@ -5485,12 +5598,12 @@ paths: description: internal server error security: - bearerAuth: [] - summary: Send an email + summary: Get a payment link by ID tags: - Payment Link - /checkouts/{id}/sms: - post: - operationId: smsCheckout + /checkouts/{id}/cancel: + put: + operationId: cancelCheckout parameters: - description: Use for knowing which language to use examples: @@ -5524,8 +5637,6 @@ paths: required: true schema: type: string - requestBody: - $ref: '#/components/requestBodies/checkout_sms' responses: "200": content: @@ -5636,21 +5747,13 @@ paths: description: internal server error security: - bearerAuth: [] - summary: Send an sms + summary: Cancel Payment Link tags: - Payment Link - /customers/{id}/payment_sources: - get: - description: Get a list of Payment Methods - operationId: GetCustomerPaymentMethods + /checkouts/{id}/email: + post: + operationId: emailCheckout 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: @@ -5676,40 +5779,350 @@ paths: required: false schema: type: string - - description: "The numbers of items to return, the maximum value is 250" - in: query - name: limit - required: false - schema: - default: 20 - format: int32 - maximum: 250 - minimum: 1 - type: integer - - description: next page - in: query - name: next - required: false - schema: - type: string - - description: previous page - in: query - name: previous - required: false - schema: - type: string - - description: "General order search, e.g. by mail, reference etc." - in: query - name: search - required: false + - description: Identifier of the resource + example: 6307a60c41de27127515a575 + in: path + name: id + required: true schema: type: string + requestBody: + $ref: '#/components/requestBodies/checkout_email' responses: "200": content: application/vnd.conekta-v2.2.0+json: - examples: - card: + schema: + $ref: '#/components/schemas/checkout_response' + description: successful operation + headers: + Date: + description: The date and time that the response was sent + schema: + example: "Fri, 03 Feb 2023 16:57:48 GMT" + type: string + Content-Type: + description: The format of the response body + schema: + example: application/json; charset=utf-8 + type: string + Content-Length: + description: The length of the response body in bytes + schema: + example: "2737" + type: string + Connection: + description: The type of connection used to transfer the response + schema: + example: keep-alive + type: string + Conekta-Media-Type: + schema: + example: conekta-v2.1.0; format=application/json + type: string + "401": + content: + application/vnd.conekta-v2.2.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 + "402": + content: + application/vnd.conekta-v2.2.0+json: + example: + details: + - message: The card could not be processed. + code: conekta.errors.processing.tokenization.used + debug_message: The token has already been used. + log_id: 641b6d073cd9a50001515007 + object: error + type: processing_error + schema: + $ref: '#/components/schemas/error' + description: payment required error + "404": + content: + application/vnd.conekta-v2.2.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 + "422": + content: + application/vnd.conekta-v2.2.0+json: + example: + details: + - message: The token does not exist. + param: payment_method.token_id + code: conekta.errors.parameter_validation.payment_method.token_id.nonexistent_token + debug_message: The token does not exist. + log_id: 641b6d813cd9a50001515017 + object: error + type: parameter_validation_error + schema: + $ref: '#/components/schemas/error' + description: parameter validation error + "500": + content: + application/vnd.conekta-v2.2.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: [] + summary: Send an email + tags: + - Payment Link + /checkouts/{id}/sms: + post: + operationId: smsCheckout + parameters: + - 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 + - description: Identifier of the resource + example: 6307a60c41de27127515a575 + in: path + name: id + required: true + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/checkout_sms' + responses: + "200": + content: + application/vnd.conekta-v2.2.0+json: + schema: + $ref: '#/components/schemas/checkout_response' + description: successful operation + headers: + Date: + description: The date and time that the response was sent + schema: + example: "Fri, 03 Feb 2023 16:57:48 GMT" + type: string + Content-Type: + description: The format of the response body + schema: + example: application/json; charset=utf-8 + type: string + Content-Length: + description: The length of the response body in bytes + schema: + example: "2737" + type: string + Connection: + description: The type of connection used to transfer the response + schema: + example: keep-alive + type: string + Conekta-Media-Type: + schema: + example: conekta-v2.1.0; format=application/json + type: string + "401": + content: + application/vnd.conekta-v2.2.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 + "402": + content: + application/vnd.conekta-v2.2.0+json: + example: + details: + - message: The card could not be processed. + code: conekta.errors.processing.tokenization.used + debug_message: The token has already been used. + log_id: 641b6d073cd9a50001515007 + object: error + type: processing_error + schema: + $ref: '#/components/schemas/error' + description: payment required error + "404": + content: + application/vnd.conekta-v2.2.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 + "422": + content: + application/vnd.conekta-v2.2.0+json: + example: + details: + - message: The token does not exist. + param: payment_method.token_id + code: conekta.errors.parameter_validation.payment_method.token_id.nonexistent_token + debug_message: The token does not exist. + log_id: 641b6d813cd9a50001515017 + object: error + type: parameter_validation_error + schema: + $ref: '#/components/schemas/error' + description: parameter validation error + "500": + content: + application/vnd.conekta-v2.2.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: [] + summary: Send an sms + tags: + - Payment Link + /customers/{id}/payment_sources: + get: + description: Get a list of Payment Methods + operationId: GetCustomerPaymentMethods + 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 + - description: "The numbers of items to return, the maximum value is 250" + in: query + name: limit + required: false + schema: + default: 20 + format: int32 + maximum: 250 + minimum: 1 + type: integer + - description: next page + in: query + name: next + required: false + schema: + type: string + - description: previous page + in: query + name: previous + required: false + schema: + type: string + - description: "General order search, e.g. by mail, reference etc." + in: query + name: search + required: false + schema: + type: string + responses: + "200": + content: + application/vnd.conekta-v2.2.0+json: + examples: + card: summary: Card value: next_page_url: null @@ -6833,7 +7246,6 @@ paths: examples: sucessfull: $ref: '#/components/examples/shipping' - value: null schema: $ref: '#/components/schemas/shipping_order_response' description: successful @@ -8924,12 +9336,6 @@ paths: maximum: 250 minimum: 1 type: integer - - description: "General order search, e.g. by mail, reference etc." - in: query - name: search - required: false - schema: - type: string - description: next page in: query name: next @@ -8942,6 +9348,34 @@ paths: required: false schema: type: string + - description: id of the object to be retrieved + in: query + name: id + required: false + schema: + example: 65412a893cd69a0001c25892 + type: string + - description: id of the charge used for filtering + in: query + name: charge_id + required: false + schema: + example: 65412a893cd69a0001c25892 + type: string + - description: type of the object to be retrieved + in: query + name: type + required: false + schema: + example: capture + type: string + - description: currency of the object to be retrieved + in: query + name: currency + required: false + schema: + example: MXN + type: string responses: "200": content: @@ -9939,6 +10373,12 @@ paths: required: false schema: type: string + - description: url for webhook filter + in: query + name: url + required: false + schema: + type: string - description: next page in: query name: next @@ -10591,6 +11031,22 @@ components: phone: "5522997233" corporate: false object: customer_info + fiscal_entity: + tax_id: "1234567890" + name: Conekta Inc + email: test@gmail.com + phone: "525511223344" + metadata: + test: true + company_id: "123" + address: + street1: Nuevo Leon 254 + street2: Departamento 404 + postal_code: "06100" + city: Ciudad de Mexico + state: Ciudad de Mexico + country: MX + external_number: "123" discount_lines: - amount: 500 code: "123" @@ -10613,17 +11069,19 @@ components: additionalProp2: string additionalProp3: string metadata: - additionalProp1: string - additionalProp2: string - additionalProp3: string + test: true + company_id: "123" pre_authorize: false shipping_contact: phone: "525511223344" receiver: Marvin Fuller between_streets: Ackerman Crescent + metadata: + test: true + company_id: "123" address: - street1: avenida siempre viva - street2: fake street + street1: Nuevo Leon 254 + street2: Departamento 404 postal_code: "06100" city: Ciudad de Mexico state: Ciudad de Mexico @@ -10699,8 +11157,8 @@ components: receiver: Marvin Fuller between_streets: Ackerman Crescent address: - street1: avenida siempre viva - street2: fake street + street1: Nuevo Leon 254 + street2: Departamento 404 postal_code: "06100" city: Ciudad de Mexico state: Ciudad de Mexico @@ -10948,6 +11406,45 @@ components: required: true schema: type: string + id_query: + description: id of the object to be retrieved + in: query + name: id + required: false + schema: + example: 65412a893cd69a0001c25892 + type: string + charge_id: + description: id of the charge used for filtering + in: query + name: charge_id + required: false + schema: + example: 65412a893cd69a0001c25892 + type: string + type: + description: type of the object to be retrieved + in: query + name: type + required: false + schema: + example: capture + type: string + currency: + description: currency of the object to be retrieved + in: query + name: currency + required: false + schema: + example: MXN + type: string + url: + description: url for webhook filter + in: query + name: url + required: false + schema: + type: string requestBodies: api_keys_create: content: @@ -10956,6 +11453,13 @@ components: $ref: '#/components/schemas/api_key_request' description: requested field for a api keys required: true + charge_update: + content: + application/json: + schema: + $ref: '#/components/schemas/charge_update_request' + description: requested field for update a charge + required: true charge_create: content: application/json: @@ -11011,19 +11515,14 @@ components: examples: order_with_charges: $ref: '#/components/examples/order_with_charges' - value: null order_with_checkout: $ref: '#/components/examples/order_with_checkout' - value: null split_payment_with_2_card_charges: $ref: '#/components/examples/split_payment_with_2_cards' - value: null split_payment_with_3_cash_charges: $ref: '#/components/examples/split_payment_with_cash' - value: null split_payment_with_cash_card_charges: $ref: '#/components/examples/split_payment_with_cash_card' - value: null schema: $ref: '#/components/schemas/order_request' description: requested field for order @@ -11056,6 +11555,13 @@ components: $ref: '#/components/schemas/orderRefund_request' description: requested field for a refund required: true + payout_order: + content: + application/json: + schema: + $ref: '#/components/schemas/payout_order' + description: requested field for payout order + required: true checkout: content: application/json: @@ -11307,15 +11813,44 @@ components: $ref: '#/components/schemas/error' description: payment required error schemas: + event_types: + description: "It is a parameter that allows to identify in the response, the\ + \ type of event that is being generated." + enum: + - webhook_ping + - order.paid + - order.expired + - order.canceled + - order.pending_payment + title: event_types + type: string risk_rules_list: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/risk_rules' + - properties: + data: + items: + $ref: '#/components/schemas/risk_rules_data' + type: array + title: risk_rules + type: object error: allOf: - $ref: '#/components/schemas/details' - - $ref: '#/components/schemas/error_allOf' + - properties: + log_id: + description: log id + example: 507f1f77bcf86cd799439011 + nullable: true + type: string + type: + example: authentication_error + type: string + object: + example: error + type: string + type: object description: err model title: error create_risk_rules_data: @@ -11549,9 +12084,6 @@ components: example: Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso. type: string - fee: - example: 1160 - type: integer id: example: 63efa757cf65380001aec040 type: string @@ -11610,9 +12142,6 @@ components: example: Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso. type: string - fee: - example: 1160 - type: integer id: example: 63efa757cf65380001aec040 type: string @@ -11689,12 +12218,16 @@ components: antifraud_info: $ref: '#/components/schemas/customer_antifraud_info_response' corporate: + description: true if the customer is a company type: boolean created_at: + description: Creation date of the object example: 1485151007 format: int64 type: integer custom_reference: + description: Custom reference + example: custom_reference type: string default_fiscal_entity_id: example: fis_ent_2tKqqAfqPi21oCmEJ @@ -11714,21 +12247,30 @@ components: fiscal_entities: $ref: '#/components/schemas/customer_fiscal_entities_response' id: + description: Customer's ID example: cus_2tHJfJ79KyUwpxTik type: string livemode: + description: true if the object exists in live mode or the value false if + the object exists in test mode example: true type: boolean name: + description: Customer's name example: Felipe type: string + metadata: + additionalProperties: true + maxProperties: 100 + type: object object: example: customer type: string payment_sources: $ref: '#/components/schemas/customer_payment_methods_response' phone: - example: +5215555555555 + description: Customer's phone number + example: "+5215555555555" type: string shipping_contacts: $ref: '#/components/schemas/customer_response_shipping_contacts' @@ -11738,13 +12280,15 @@ components: - created_at - id - livemode + - name - object title: customer response type: object customer_fiscal_entities_request: properties: address: - $ref: '#/components/schemas/customer_fiscal_entities_request_address' + allOf: + - $ref: '#/components/schemas/customer_address' tax_id: type: string email: @@ -11765,7 +12309,24 @@ components: discount_lines_response: allOf: - $ref: '#/components/schemas/order_discount_lines_request' - - $ref: '#/components/schemas/discount_lines_response_allOf' + - properties: + id: + description: The discount line id + example: dis_lin_2tQQ58HPgPw7StE8z + type: string + object: + description: The object name + example: discount_line + type: string + parent_id: + description: The order id + example: ord_2tPAmKCEJqh8RE6nY + type: string + required: + - id + - object + - parent_id + type: object title: discount_lines_order_response event_response: description: event model @@ -12038,7 +12599,7 @@ components: discount_lines: $ref: '#/components/schemas/order_response_discount_lines' fiscal_entity: - $ref: '#/components/schemas/order_response_fiscal_entity' + $ref: '#/components/schemas/order_fiscal_entity_response' id: example: ord_2tMtQQpDvfnNjiuFG type: string @@ -12058,6 +12619,8 @@ components: structured format. maxProperties: 100 type: object + next_action: + $ref: '#/components/schemas/order_next_action_response' object: description: String representing the object’s type. Objects of the same type share the same value. @@ -12085,8 +12648,99 @@ components: product_order_response: allOf: - $ref: '#/components/schemas/product' - - $ref: '#/components/schemas/product_order_response_allOf' + - properties: + id: + type: string + object: + type: string + parent_id: + type: string + type: object title: product order response + payout_order_response: + description: payout order model response + properties: + allowed_payout_methods: + description: The payout methods that are allowed for the payout order. + example: + - cashout + items: + type: string + minItems: 1 + type: array + amount: + description: The amount of the payout order. + example: 100 + type: integer + created_at: + description: The creation date of the payout order. + example: 1677626837 + format: int64 + type: integer + currency: + default: MXN + description: The currency in which the payout order is made. + example: MXN + type: string + customer_info: + $ref: '#/components/schemas/payout_order_response_customer_info' + expires_at: + description: The expiration date of the payout order. + example: 1677626837 + format: int64 + type: integer + id: + description: The id of the payout order. + example: f2654d66-d740-457a-9a8c-f96b5196f44e + type: string + livemode: + description: The live mode of the payout order. + example: true + type: boolean + object: + description: The object of the payout order. + example: payout_order + type: string + metadata: + additionalProperties: true + description: The metadata of the payout order. + example: + custom_client_id: "12345" + maxProperties: 100 + type: object + payouts: + description: The payout information of the payout order. + items: + $ref: '#/components/schemas/payout_order_payouts_item' + title: payout_order_payouts + type: array + reason: + description: The reason for the payout order. + example: Payout order for the customer + type: string + status: + description: The status of the payout order. + example: open + type: string + updated_at: + description: The update date of the payout order. + example: 1677626837 + format: int64 + type: integer + required: + - allowed_payout_methods + - amount + - created_at + - currency + - customer_info + - id + - livemode + - object + - payouts + - reason + - updated_at + title: payout_order_response + type: object checkout_response: description: checkout response properties: @@ -12194,15 +12848,71 @@ components: payment_method_cash_response: allOf: - $ref: '#/components/schemas/payment_method_response' - - $ref: '#/components/schemas/payment_method_cash_response_allOf' + - description: use for cash responses + properties: + reference: + example: "93000262276908" + type: string + barcode: + example: "93000262276908" + type: string + barcode_url: + example: https://pt-common-s3-stg.s3.amazonaws.com/644ebf80f2243197aad6cd8810375b905b613dbe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MP4SLLCWV%2F20230203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230203T215750Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH4aCXVzLWVhc3QtMSJGMEQCICd79cu7DYu%2F4%2B3HnVVswydgU9yHcE9kmQIIk2TLoZJrAiBVZ0HxVSeboK5lhdQSqADjwQF62XX35jhC%2F2riB0M8uCqQBAj2%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDc5OTgwMTA4MTY4OCIMXWZds9ZI5hzUdbeGKuQDFreMyeWnWWPqDuGZ2%2BHk6usCr%2Fl096%2FNJh9xtf8htLu56K%2FhWUTx%2BjiqFWM2O%2FF5zTS%2BIV6TqkLDZ%2BQ5Jo1miQrRmR57YDz6uP2Yd1mNZ1ouq5ipnNjUuu5UWCCBAmqyZQsrVmeMQpSV2IB%2BTERCCcW2SukFEYU%2F20%2Fzy5orsoZ8DxOW460IymR3cWBk5u3Xh2cV6Y1RdPEwDEThhqYEF5w%2ByKbLENloMsI%2FUm6sG5PPrO3yQOAP9aK2muLJs9lXQRU%2FL%2FSsmS4FKSUFOqlN6YU%2Bi2Y%2FyGIKAJT2VDkngvz5Sl%2Fadj0j%2BPKftVRV5FcEhySB6Rl%2BSkPN7kVQMJp6pS8hMJ6JCyEA%2BA3eWYdIfKgQhWVXAR4oCBfJ62DH8FU3a7WfSjjpTwfVkiReWen3GGCYfUWETTVKp46MKnJ9PG0CD3KzxKV8VfmEGc5krK%2FI%2F%2BDV2wtSa%2F9qf1%2BK1YYJIK9qZGb25ljUiGhTB4T%2BMUOSQFjetiWUoOJc5Q3Jz%2FXJbiTAMTST39MhdbCgiMgfrc8OGKN5DOVbex33Z7dn0xf%2FOCkSqurhLaG08efKQBdhLNS0RlE9hbg9yZ2ywwtQIF39fI6A7eeH0T11a5HMlvm51u4rAffPHRuEJfwJoIuj%2F2s3QzDg7%2FWeBjqmAbnPOlGfysjrDdvHyG7HVnaX02kdG%2BI3Q4PFOO4Mjaa3ocpjcfPT70%2BZ5a%2FSv5vP0jDLGrLToeM9%2BAUlNepptICRu23a1tLGW4ri0twPA%2FZ4JDTtUUUgdblyG8bKpcUTNp4oOsdmLLBz3FVyr4c2xQbDZSu2zYOtoOxB18W0AC6kIbsMWVU55Bf0mBhPeBWxGrtM4Kw1SgHHlt%2F8vetQi2OwtUcg08c%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=d06dfa41550003359f2aabc8006063a80dfd806a13a54d244024946a76aa9abc + type: string + expires_at: + example: 0 + format: int64 + type: integer + provider: + example: Oxxo + type: string + type: object payment_method_card_response: allOf: - $ref: '#/components/schemas/payment_method_response' - - $ref: '#/components/schemas/payment_method_card_response_allOf' + - description: use for card responses + properties: + last4: + example: "6410" + type: string + bin: + example: "40276657" + type: string + card_type: + example: debit + type: string + exp_month: + example: "10" + type: string + exp_year: + example: "25" + type: string + brand: + example: visa + type: string + name: + example: Fulano Perez" + type: string + default: + type: boolean + visible_on_checkout: + type: boolean + payment_source_status: + example: active + type: string + type: object payment_method_spei_recurrent: allOf: - $ref: '#/components/schemas/payment_method_response' - - $ref: '#/components/schemas/payment_method_spei_recurrent_allOf' + - description: use for spei responses + properties: + reference: + example: "93000262276908" + type: string + expires_at: + example: none + type: string + type: object plan_response: description: plans model properties: @@ -12248,14 +12958,21 @@ components: shipping_order_response: allOf: - $ref: '#/components/schemas/shipping_request' - - $ref: '#/components/schemas/product_order_response_allOf' + - properties: + id: + type: string + object: + type: string + parent_id: + type: string + type: object title: shipping_order_response customer_shipping_contacts_response: description: Contains the detail of the shipping addresses that the client has active or has used in Conekta properties: phone: - example: +525511223344 + example: "+525511223344" type: string receiver: example: Marvin Fuller @@ -12278,6 +12995,11 @@ components: example: 1675715413 format: int64 type: integer + metadata: + additionalProperties: true + description: Metadata associated with the shipping contact + maxProperties: 100 + type: object object: example: shipping_contact type: string @@ -12358,7 +13080,17 @@ components: update_order_tax_response: allOf: - $ref: '#/components/schemas/order_tax_request' - - $ref: '#/components/schemas/update_order_tax_response_allOf' + - properties: + id: + example: tax_lin_2tQ8dC5mg1UADmVPo + type: string + object: + example: tax_line + type: string + parent_id: + example: ord_2tPAmKCEJqh8RE6nY + type: string + type: object description: create new taxes for an existing order response required: - id @@ -12725,17 +13457,21 @@ components: - role title: api_keys_request type: object + charge_update_request: + description: requested field for update a charge + properties: + reference_id: + description: custom reference id + example: "278482642" + type: string + title: charge_update_request + type: object charge_request: description: The charges to be made properties: amount: example: 40000 type: integer - monthly_installments: - description: "How many months without interest to apply, it can be 3, 6,\ - \ 9, 12 or 18" - format: int8 - type: integer payment_method: $ref: '#/components/schemas/charge_request_payment_method' reference_id: @@ -12796,7 +13532,7 @@ components: type: array phone: description: Is the customer's phone number - example: +5215555555555 + example: "+5215555555555" type: string plan_id: description: "Contains the ID of a plan, which could together with name,\ @@ -12839,7 +13575,7 @@ components: type: string phone: description: Is the customer's phone number - example: +5215555555555 + example: "+5215555555555" type: string plan_id: description: "Contains the ID of a plan, which could together with name,\ @@ -12887,7 +13623,8 @@ components: customer_update_fiscal_entities_request: properties: address: - $ref: '#/components/schemas/customer_fiscal_entities_request_address' + allOf: + - $ref: '#/components/schemas/customer_address' tax_id: type: string email: @@ -12969,6 +13706,8 @@ components: items: $ref: '#/components/schemas/order_discount_lines_request' type: array + fiscal_entity: + $ref: '#/components/schemas/order_fiscal_entity_request' line_items: description: "List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct)\ \ that are sold in the order. You must have at least one product." @@ -12993,6 +13732,12 @@ components: \ recurrent or validation." example: ecommerce type: string + return_url: + description: Indicates the redirection callback upon completion of the 3DS2 + flow. + example: https://my-website.com + format: uri + type: string shipping_contact: $ref: '#/components/schemas/customer_shipping_contacts' shipping_lines: @@ -13007,6 +13752,9 @@ components: items: $ref: '#/components/schemas/order_tax_request' type: array + three_ds_mode: + description: "Indicates the 3DS2 mode for the order, either smart or strict." + type: string required: - currency - customer_info @@ -13036,6 +13784,8 @@ components: items: $ref: '#/components/schemas/order_discount_lines_request' type: array + fiscal_entity: + $ref: '#/components/schemas/order_update_fiscal_entity_request' line_items: description: "List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct)\ \ that are sold in the order. You must have at least one product." @@ -13161,6 +13911,49 @@ components: type: object title: update_product type: object + payout_order: + description: a payout order + properties: + allowed_payout_methods: + description: The payout methods that are allowed for the payout order. + example: + - cashout + items: + type: string + type: array + amount: + description: The amount of the payout order. + example: 100 + type: integer + currency: + default: MXN + description: The currency in which the payout order is made. + example: MXN + type: string + customer_info: + $ref: '#/components/schemas/customer_info_just_customer_id' + metadata: + additionalProperties: true + description: The metadata of the payout order. + example: + custom_client_id: "12345" + maxProperties: 100 + type: object + payout: + $ref: '#/components/schemas/payout' + reason: + description: The reason for the payout order. + example: Payout order for the customer + type: string + required: + - allowed_payout_methods + - amount + - currency + - customer_info + - payout + - reason + title: payout order request + type: object checkout: description: It is a sub-resource of the Order model that can be stipulated in order to configure its corresponding checkout @@ -13240,19 +14033,36 @@ components: payment_method_card_request: allOf: - $ref: '#/components/schemas/customer_payment_method_request' - - $ref: '#/components/schemas/payment_method_card_request_allOf' - required: - - token_id + - properties: + token_id: + description: "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." + example: tok_32hj4g234as + type: string + required: + - token_id + type: object title: payment_method_card_request payment_method_cash_request: allOf: - $ref: '#/components/schemas/customer_payment_method_request' - - $ref: '#/components/schemas/payment_method_cash_request_allOf' + - properties: + expires_at: + example: 1553273553 + format: int64 + type: integer + type: object title: payment_method_cash_request payment_method_spei_request: allOf: - $ref: '#/components/schemas/customer_payment_method_request' - - $ref: '#/components/schemas/payment_method_cash_request_allOf' + - properties: + expires_at: + example: 1553273553 + format: int64 + type: integer + type: object title: payment_method_spei_request update_payment_methods: properties: @@ -13378,7 +14188,7 @@ components: properties: phone: description: Phone contact - example: +525511223344 + example: "+525511223344" type: string receiver: description: Name of the person who will receive the order @@ -13398,6 +14208,11 @@ components: deleted: nullable: true type: boolean + metadata: + additionalProperties: true + description: Metadata associated with the shipping contact + maxProperties: 100 + type: object required: - address title: customer_shipping_contacts_request @@ -13409,7 +14224,7 @@ components: properties: phone: description: Phone contact - example: +525511223344 + example: "+525511223344" type: string receiver: description: Name of the person who will receive the order @@ -13584,15 +14399,135 @@ components: payment_method_cash: allOf: - $ref: '#/components/schemas/payment_method' - - $ref: '#/components/schemas/charge_data_payment_method_cash_response' + - description: use for cash responses + properties: + auth_code: + example: 542563 + nullable: true + type: integer + cashier_id: + example: OINM01010 + nullable: true + type: string + reference: + example: "93000262276908" + type: string + barcode_url: + example: https://pt-common-s3-stg.s3.amazonaws.com/644ebf80f2243197aad6cd8810375b905b613dbe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MP4SLLCWV%2F20230203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230203T215750Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH4aCXVzLWVhc3QtMSJGMEQCICd79cu7DYu%2F4%2B3HnVVswydgU9yHcE9kmQIIk2TLoZJrAiBVZ0HxVSeboK5lhdQSqADjwQF62XX35jhC%2F2riB0M8uCqQBAj2%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDc5OTgwMTA4MTY4OCIMXWZds9ZI5hzUdbeGKuQDFreMyeWnWWPqDuGZ2%2BHk6usCr%2Fl096%2FNJh9xtf8htLu56K%2FhWUTx%2BjiqFWM2O%2FF5zTS%2BIV6TqkLDZ%2BQ5Jo1miQrRmR57YDz6uP2Yd1mNZ1ouq5ipnNjUuu5UWCCBAmqyZQsrVmeMQpSV2IB%2BTERCCcW2SukFEYU%2F20%2Fzy5orsoZ8DxOW460IymR3cWBk5u3Xh2cV6Y1RdPEwDEThhqYEF5w%2ByKbLENloMsI%2FUm6sG5PPrO3yQOAP9aK2muLJs9lXQRU%2FL%2FSsmS4FKSUFOqlN6YU%2Bi2Y%2FyGIKAJT2VDkngvz5Sl%2Fadj0j%2BPKftVRV5FcEhySB6Rl%2BSkPN7kVQMJp6pS8hMJ6JCyEA%2BA3eWYdIfKgQhWVXAR4oCBfJ62DH8FU3a7WfSjjpTwfVkiReWen3GGCYfUWETTVKp46MKnJ9PG0CD3KzxKV8VfmEGc5krK%2FI%2F%2BDV2wtSa%2F9qf1%2BK1YYJIK9qZGb25ljUiGhTB4T%2BMUOSQFjetiWUoOJc5Q3Jz%2FXJbiTAMTST39MhdbCgiMgfrc8OGKN5DOVbex33Z7dn0xf%2FOCkSqurhLaG08efKQBdhLNS0RlE9hbg9yZ2ywwtQIF39fI6A7eeH0T11a5HMlvm51u4rAffPHRuEJfwJoIuj%2F2s3QzDg7%2FWeBjqmAbnPOlGfysjrDdvHyG7HVnaX02kdG%2BI3Q4PFOO4Mjaa3ocpjcfPT70%2BZ5a%2FSv5vP0jDLGrLToeM9%2BAUlNepptICRu23a1tLGW4ri0twPA%2FZ4JDTtUUUgdblyG8bKpcUTNp4oOsdmLLBz3FVyr4c2xQbDZSu2zYOtoOxB18W0AC6kIbsMWVU55Bf0mBhPeBWxGrtM4Kw1SgHHlt%2F8vetQi2OwtUcg08c%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=d06dfa41550003359f2aabc8006063a80dfd806a13a54d244024946a76aa9abc + type: string + expires_at: + example: 0 + format: int64 + type: integer + service_name: + example: OxxoPay + type: string + store: + example: 10MON50EDI + nullable: true + type: string + store_name: + example: OXXO + type: string + title: charge_data_payment_method_cash_response + type: object payment_method_card: allOf: - $ref: '#/components/schemas/payment_method' - - $ref: '#/components/schemas/charge_data_payment_method_card_response' + - description: use for card responses + properties: + account_type: + example: Credit + type: string + auth_code: + example: "867372" + type: string + brand: + example: visa + type: string + contract_id: + description: Id sent for recurrent charges. + example: S781317595 + type: string + country: + example: MX + type: string + exp_month: + example: "02" + type: string + exp_year: + example: "30" + type: string + fraud_indicators: + items: {} + type: array + issuer: + example: BANAMEX + type: string + last4: + example: "4242" + type: string + name: + example: Fulanito Perez + type: string + title: charge_data_payment_method_card_response + type: object payment_method_bank_transfer: allOf: - $ref: '#/components/schemas/payment_method' - - $ref: '#/components/schemas/charge_data_payment_method_bank_transfer_response' + - description: use for bank transfer responses + properties: + bank: + example: STP + type: string + clabe: + example: "646180111805034237" + type: string + description: + nullable: true + type: string + executed_at: + nullable: true + type: integer + expires_at: + example: 1683053729 + format: int64 + type: integer + issuing_account_bank: + nullable: true + type: string + issuing_account_number: + nullable: true + type: string + issuing_account_holder_name: + nullable: true + type: string + issuing_account_tax_id: + nullable: true + type: string + payment_attempts: + items: {} + type: array + receiving_account_holder_name: + nullable: true + type: string + receiving_account_number: + example: "646180111805034237" + type: string + receiving_account_bank: + example: STP + type: string + receiving_account_tax_id: + nullable: true + type: string + reference_number: + nullable: true + type: string + tracking_code: + nullable: true + type: string + title: charge_data_payment_method_bank_transfer_response + type: object company_payout_destination_response: description: Company payout destination model properties: @@ -13658,10 +14593,10 @@ components: customer_address: properties: street1: - example: avenida siempre viva + example: Nuevo Leon 254 type: string street2: - example: fake street + example: Departamento 404 type: string postal_code: example: "06100" @@ -13677,6 +14612,7 @@ components: example: MX type: string residential: + default: false example: true type: boolean external_number: @@ -13686,8 +14622,13 @@ components: - postal_code - street1 type: object - customer_info_response: + order_customer_info_response: properties: + customer_custom_reference: + description: Custom reference + example: custom_reference + nullable: true + type: string name: example: DevTest type: string @@ -13704,7 +14645,7 @@ components: object: example: customer_info type: string - title: customer_info + title: order_customer_info_response type: object customer_info_just_customer_id_response: properties: @@ -13713,6 +14654,46 @@ components: type: string title: customer_info_response type: object + fiscal_entity_address: + description: Address of the fiscal entity + properties: + street1: + description: Street name and number + example: Nuevo Leon 254 + type: string + street2: + description: Street name and number + example: Departamento 404 + nullable: true + type: string + postal_code: + description: Postal code + example: "06100" + type: string + city: + description: City + example: Ciudad de Mexico + type: string + state: + description: State + example: Ciudad de Mexico + type: string + country: + description: "this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)" + example: MX + type: string + external_number: + description: External number + example: "123" + type: string + required: + - city + - country + - external_number + - postal_code + - street1 + title: order_fiscal_entity_address_request + type: object payment_method_response: properties: type: @@ -13775,6 +14756,11 @@ components: on_demand_enabled: example: true type: boolean + redirection_time: + description: number of seconds to wait before redirecting to the success_url + example: 10 + format: int8 + type: integer success_url: description: "Redirection url back to the site in case of successful payment,\ \ applies only to HostedPayment" @@ -13963,31 +14949,27 @@ components: type: string title: deleted_blacklist_rule_response type: object - get_api_keys_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/api_key_response' - type: array - type: object get_api_keys_response: allOf: - $ref: '#/components/schemas/page' - $ref: '#/components/schemas/pagination' - - $ref: '#/components/schemas/get_api_keys_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/api_key_response' + type: array + type: object title: get_api_keys_response - api_key_create_response_allOf: - properties: - authentication_token: - description: "It is occupied as a user when authenticated with basic authentication,\ - \ with a blank password. This value will only appear once, in the request\ - \ to create a new key. Copy and save it in a safe place." - example: key_rpHzxufNgjFCdprEEFZRTKi - type: string - type: object api_key_create_response: allOf: - - $ref: '#/components/schemas/api_key_create_response_allOf' + - properties: + authentication_token: + description: "It is occupied as a user when authenticated with basic authentication,\ + \ with a blank password. This value will only appear once, in the request\ + \ to create a new key. Copy and save it in a safe place." + example: key_rpHzxufNgjFCdprEEFZRTKi + type: string + type: object - $ref: '#/components/schemas/api_key_response' title: api_key_create_response api_key_update_request: @@ -14002,136 +14984,120 @@ components: type: string title: api_key_update_request type: object - delete_api_keys_response_allOf: - properties: - deleted: - example: true - type: boolean - type: object delete_api_keys_response: allOf: - $ref: '#/components/schemas/api_key_response_on_delete' - - $ref: '#/components/schemas/delete_api_keys_response_allOf' + - properties: + deleted: + example: true + type: boolean + type: object title: delete_api_keys_response - get_charges_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/charge_response' - type: array - type: object get_charges_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_charges_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/charge_response' + type: array + type: object title: get_charges_response - get_companies_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/company_response' - type: array - type: object get_companies_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_companies_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/company_response' + type: array + type: object title: get_companies_response - customers_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/customer_response' - title: customers_data_response - type: array - type: object customers_response: allOf: - - $ref: '#/components/schemas/customers_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/customer_response' + title: customers_data_response + type: array + type: object - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' title: customers_response - create_customer_fiscal_entities_response_allOf: - properties: - id: - example: ship_cont_2tKZsTYcsryyu7Ah8 - type: string - object: - example: shipping_contact - type: string - created_at: - example: 1675715413 - format: int64 - type: integer - parent_id: - example: cus_2tKcHxhTz7xU5SymF - type: string - default: - type: boolean - required: - - created_at - - id - - object - type: object create_customer_fiscal_entities_response: allOf: - $ref: '#/components/schemas/customer_fiscal_entities_request' - - $ref: '#/components/schemas/create_customer_fiscal_entities_response_allOf' + - properties: + id: + example: ship_cont_2tKZsTYcsryyu7Ah8 + type: string + object: + example: shipping_contact + type: string + created_at: + example: 1675715413 + format: int64 + type: integer + parent_id: + example: cus_2tKcHxhTz7xU5SymF + type: string + default: + type: boolean + required: + - created_at + - id + - object + type: object title: create_customer_fiscal_entities_response - update_customer_fiscal_entities_response_allOf: - properties: - id: - example: fis_ent_2tKZsTYcsryyu7Ah8 - type: string - object: - example: fiscal_entities - type: string - created_at: - example: 1675715413 - format: int64 - type: integer - parent_id: - example: cus_2tKcHxhTz7xU5SymF - type: string - default: - type: boolean - required: - - created_at - - id - - object - type: object update_customer_fiscal_entities_response: allOf: - $ref: '#/components/schemas/customer_fiscal_entities_request' - - $ref: '#/components/schemas/update_customer_fiscal_entities_response_allOf' + - properties: + id: + example: fis_ent_2tKZsTYcsryyu7Ah8 + type: string + object: + example: fiscal_entities + type: string + created_at: + example: 1675715413 + format: int64 + type: integer + parent_id: + example: cus_2tKcHxhTz7xU5SymF + type: string + default: + type: boolean + required: + - created_at + - id + - object + type: object title: update_customer_fiscal_entities_response - get_order_discount_lines_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/discount_lines_response' - type: array - type: object get_order_discount_lines_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_order_discount_lines_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/discount_lines_response' + type: array + type: object title: get_order_discount_lines_response - get_events_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/event_response' - type: array - type: object get_events_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_events_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/event_response' + type: array + type: object title: get_events_response get_orders_response: allOf: @@ -14169,18 +15135,28 @@ components: - amount - reason type: object - checkouts_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/checkout_response' - type: array - type: object + payout_orders_response: + allOf: + - properties: + data: + items: + $ref: '#/components/schemas/payout_order_response' + title: payout_orders_data_response + type: array + type: object + - $ref: '#/components/schemas/pagination' + - $ref: '#/components/schemas/page' + title: payout_orders_response checkouts_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/checkouts_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/checkout_response' + type: array + type: object title: checkouts_response emailCheckout_request: properties: @@ -14212,18 +15188,16 @@ components: - $ref: '#/components/schemas/payment_method_card_response' - $ref: '#/components/schemas/payment_method_spei_recurrent' title: get_customer_payment_method_data_response - get_payment_method_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/get_customer_payment_method_data_response' - type: array - type: object get_payment_method_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_payment_method_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/get_customer_payment_method_data_response' + type: array + type: object title: get_payment_method_response CreateCustomerPaymentMethods_request: description: Contains details of the payment methods that the customer has active @@ -14258,65 +15232,62 @@ components: - $ref: '#/components/schemas/payment_method_card_response' - $ref: '#/components/schemas/payment_method_spei_recurrent' title: update_customer_payment_methods_response - get_plans_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/plan_response' - type: array - type: object get_plans_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_plans_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/plan_response' + type: array + type: object title: get_plans_response subscription_events_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_events_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/event_response' + type: array + type: object title: subscription_events_response - get_transactions_response_allOf: - properties: - data: - description: Transactions - items: - $ref: '#/components/schemas/transaction_response' - type: array - type: object get_transactions_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_transactions_response_allOf' + - properties: + data: + description: Transactions + items: + $ref: '#/components/schemas/transaction_response' + type: array + type: object title: get_transactions_response - get_transfers_response_allOf: - properties: - data: - description: Transfers - items: - $ref: '#/components/schemas/transfers_response' - type: array - type: object get_transfers_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_transfers_response_allOf' + - properties: + data: + description: Transfers + items: + $ref: '#/components/schemas/transfers_response' + type: array + type: object title: get_transfers_response - get_webhook_keys_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/webhook-key_response' - type: array - type: object get_webhook_keys_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_webhook_keys_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/webhook-key_response' + type: array + type: object title: get_webhook_keys_response webhook_key_request: properties: @@ -14336,18 +15307,16 @@ components: type: boolean title: webhook_key_update_request type: object - get_webhooks_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/webhook_response' - type: array - type: object get_webhooks_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/get_webhooks_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/webhook_response' + type: array + type: object title: get_webhooks_response risk_rules_data: properties: @@ -14380,31 +15349,6 @@ components: example: secure customer example@example.com type: string type: object - example: null - risk_rules: - properties: - data: - items: - $ref: '#/components/schemas/risk_rules_data' - type: array - title: risk_rules - type: object - example: null - error_allOf: - properties: - log_id: - description: log id - example: 507f1f77bcf86cd799439011 - nullable: true - type: string - type: - example: authentication_error - type: string - object: - example: error - type: string - type: object - example: null charge_response_channel: properties: segment: @@ -14467,19 +15411,17 @@ components: - object title: charge_response_refunds_data type: object - charge_response_refunds_allOf: - properties: - data: - description: refunds - items: - $ref: '#/components/schemas/charge_response_refunds_data' - type: array - type: object charge_response_refunds: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/charge_response_refunds_allOf' + - properties: + data: + description: refunds + items: + $ref: '#/components/schemas/charge_response_refunds_data' + type: array + type: object nullable: true title: charge_response_refunds type: object @@ -14510,19 +15452,37 @@ components: customer_fiscal_entities_data_response: allOf: - $ref: '#/components/schemas/customer_fiscal_entities_request' - - $ref: '#/components/schemas/create_customer_fiscal_entities_response_allOf' + - properties: + id: + example: ship_cont_2tKZsTYcsryyu7Ah8 + type: string + object: + example: shipping_contact + type: string + created_at: + example: 1675715413 + format: int64 + type: integer + parent_id: + example: cus_2tKcHxhTz7xU5SymF + type: string + default: + type: boolean + required: + - created_at + - id + - object + type: object title: customer_fiscal_entities_data_response - customer_fiscal_entities_response_allOf: - properties: - data: - items: - $ref: '#/components/schemas/customer_fiscal_entities_data_response' - type: array - type: object customer_fiscal_entities_response: allOf: - $ref: '#/components/schemas/pagination' - - $ref: '#/components/schemas/customer_fiscal_entities_response_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/customer_fiscal_entities_data_response' + type: array + type: object title: customer_fiscal_entities_response customer_payment_methods_data: discriminator: @@ -14537,77 +15497,48 @@ components: - $ref: '#/components/schemas/payment_method_card_response' - $ref: '#/components/schemas/payment_method_spei_recurrent' title: customer_payment_methods_data - customerPaymentMethods: - properties: - data: - items: - $ref: '#/components/schemas/customer_payment_methods_data' - title: customer_payment_methods_data - type: array - title: customerPaymentMethods - type: object customer_payment_methods_response: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/customerPaymentMethods' + - properties: + data: + items: + $ref: '#/components/schemas/customer_payment_methods_data' + title: customer_payment_methods_data + type: array + title: customerPaymentMethods + type: object title: customer_payment_methods_response - customer_shipping_contacts_data_response_allOf: - properties: - id: - example: ship_cont_2tKZsTYcsryyu7Ah8 - type: string - object: - example: shipping_contact - type: string - created_at: - example: 1675715413 - format: int64 - type: integer - required: - - created_at - - id - - object - type: object customer_shipping_contacts_data_response: allOf: - $ref: '#/components/schemas/customer_shipping_contacts' - - $ref: '#/components/schemas/customer_shipping_contacts_data_response_allOf' + - properties: + id: + example: ship_cont_2tKZsTYcsryyu7Ah8 + type: string + object: + example: shipping_contact + type: string + created_at: + example: 1675715413 + format: int64 + type: integer + required: + - created_at + - id + - object + type: object title: customer_shipping_contacts_data_response - customer_response_shipping_contacts_allOf: - properties: - data: - items: - $ref: '#/components/schemas/customer_shipping_contacts_data_response' - type: array - type: object customer_response_shipping_contacts: allOf: - $ref: '#/components/schemas/pagination' - - $ref: '#/components/schemas/customer_response_shipping_contacts_allOf' - customer_fiscal_entities_request_address: - allOf: - - $ref: '#/components/schemas/customer_address' - discount_lines_response_allOf: - properties: - id: - description: The discount line id - example: dis_lin_2tQQ58HPgPw7StE8z - type: string - object: - description: The object name - example: discount_line - type: string - parent_id: - description: The order id - example: ord_2tPAmKCEJqh8RE6nY - type: string - required: - - id - - object - - parent_id - type: object - example: null + - properties: + data: + items: + $ref: '#/components/schemas/customer_shipping_contacts_data_response' + type: array + type: object WebhookLog: properties: failed_attempts: @@ -14760,21 +15691,17 @@ components: type: string title: logs_response_data type: object - charges_data_response: - allOf: - - $ref: '#/components/schemas/charge_response' - title: charges_data_response - order_response_charges_allOf: - properties: - data: - items: - $ref: '#/components/schemas/charges_data_response' - type: array - type: object order_response_charges: allOf: - $ref: '#/components/schemas/pagination' - - $ref: '#/components/schemas/order_response_charges_allOf' + - properties: + data: + items: + allOf: + - $ref: '#/components/schemas/charge_response' + title: charges_data_response + type: array + type: object description: The charges associated with the order order_response_checkout: properties: @@ -14842,6 +15769,12 @@ components: recurrent: example: false type: boolean + redirection_time: + description: number of seconds to wait before redirecting to the success_url + example: 2 + format: int8 + nullable: true + type: integer slug: example: 6fca054a85194c43971ecea35cc519bb type: string @@ -14861,185 +15794,220 @@ components: example: HostedPayment type: string url: - example: https://pay.stg.conekta.io/checkout/6fca054a85194c43971ecea35cc519bb - type: string - type: object - order_response_customer_info_allOf: - properties: - object: - example: customer_info - type: string - type: object - order_response_customer_info: - allOf: - - $ref: '#/components/schemas/order_response_customer_info_allOf' - - $ref: '#/components/schemas/customer_info_response' - - $ref: '#/components/schemas/customer_info_just_customer_id_response' - discount_lines_data_response: - allOf: - - $ref: '#/components/schemas/discount_lines_response' - title: discount_lines_data_response - order_response_discount_lines_allOf: - properties: - data: - items: - $ref: '#/components/schemas/discount_lines_data_response' - type: array + example: https://pay.stg.conekta.io/checkout/6fca054a85194c43971ecea35cc519bb + type: string type: object + order_response_customer_info: + allOf: + - properties: + object: + example: customer_info + type: string + type: object + - $ref: '#/components/schemas/order_customer_info_response' + - $ref: '#/components/schemas/customer_info_just_customer_id_response' order_response_discount_lines: allOf: - $ref: '#/components/schemas/pagination' - - $ref: '#/components/schemas/order_response_discount_lines_allOf' - order_response_fiscal_entity_address_allOf: - properties: - object: - example: fiscal_entity_address - type: string - type: object - order_response_fiscal_entity_address: + - properties: + data: + items: + allOf: + - $ref: '#/components/schemas/discount_lines_response' + title: discount_lines_data_response + type: array + type: object + order_fiscal_entity_address_response: allOf: - - $ref: '#/components/schemas/customer_address' - - $ref: '#/components/schemas/order_response_fiscal_entity_address_allOf' - order_response_fiscal_entity: + - $ref: '#/components/schemas/fiscal_entity_address' + - properties: + object: + example: fiscal_entity_address + type: string + type: object + description: Address of the fiscal entity + title: order_fiscal_entity_address_response + order_fiscal_entity_response: + description: "Fiscal entity of the order, Currently it is a purely informative\ + \ field" + nullable: true properties: address: - $ref: '#/components/schemas/order_response_fiscal_entity_address' + $ref: '#/components/schemas/order_fiscal_entity_address_response' + email: + description: Email of the fiscal entity + example: test@gmail.com + nullable: true + type: string + metadata: + additionalProperties: true + description: Metadata associated with the fiscal entity + maxProperties: 100 + type: object + name: + description: Name of the fiscal entity + example: Conekta Inc + nullable: true + type: string tax_id: + description: Tax ID of the fiscal entity example: "324234234" + nullable: true type: string id: + description: ID of the fiscal entity example: fis_ent_2tN85VYaSMyDvjB3M type: string + created_at: + description: The time at which the object was created in seconds since the + Unix epoch + example: 1676328434 + format: int64 + type: integer object: example: fiscal_entity type: string - type: object - product_data_response_allOf: - properties: - id: - type: string - object: - type: string - parent_id: + phone: + description: Phone of the fiscal entity + example: "+525511223344" + nullable: true type: string + required: + - address + - created_at + - id + - object + title: order_fiscal_entity_response type: object product_data_response: allOf: - $ref: '#/components/schemas/product' - - $ref: '#/components/schemas/product_data_response_allOf' + - properties: + id: + type: string + object: + type: string + parent_id: + type: string + type: object title: product_data_response - order_response_products_allOf: - properties: - data: - items: - $ref: '#/components/schemas/product_data_response' - type: array - type: object order_response_products: allOf: - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/page' - - $ref: '#/components/schemas/order_response_products_allOf' + - properties: + data: + items: + $ref: '#/components/schemas/product_data_response' + type: array + type: object title: order_response_products - order_response_shipping_contact_allOf: + order_next_action_response_redirect_to_url: + description: contains the following attributes that will guide to continue the + flow properties: - created_at: - format: int64 - type: integer - id: + url: + description: "pay.conekta.com/{id} Indicates the url of the Conekta component\ + \ to authenticate the flow through 3DS2." + example: https://pay.conekta.com/6fca054a85194c43971ecea35cc519bb + format: uri type: string - object: + return_url: + description: "Indicates the url to which the 3DS2 flow returns at the end,\ + \ when the integration is redirected." + example: https://my-website.com" + format: uri type: string type: object - order_response_shipping_contact: - allOf: - - $ref: '#/components/schemas/order_response_shipping_contact_allOf' - - $ref: '#/components/schemas/customer_shipping_contacts_response' - product_order_response_allOf: + order_next_action_response: + description: contains the following attributes that will guide to continue the + flow properties: - id: - type: string - object: - type: string - parent_id: + redirect_to_url: + $ref: '#/components/schemas/order_next_action_response_redirect_to_url' + type: + description: Indicates the type of action to be taken + example: redirect_to_url type: string + title: order_next_action_response type: object - example: null - payment_method_cash_response_allOf: - description: use for cash responses + order_response_shipping_contact: + allOf: + - properties: + created_at: + format: int64 + type: integer + id: + type: string + object: + type: string + type: object + - $ref: '#/components/schemas/customer_shipping_contacts_response' + payout_order_response_customer_info: + allOf: + - properties: + id: + description: The id of the customer. + example: cus_23874283647 + type: string + required: + - id + type: object + - $ref: '#/components/schemas/order_customer_info_response' + description: The customer information of the payout order. + payout_order_payouts_item: properties: - reference: - example: "93000262276908" - type: string - barcode: - example: "93000262276908" - type: string - barcode_url: - example: https://pt-common-s3-stg.s3.amazonaws.com/644ebf80f2243197aad6cd8810375b905b613dbe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MP4SLLCWV%2F20230203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230203T215750Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH4aCXVzLWVhc3QtMSJGMEQCICd79cu7DYu%2F4%2B3HnVVswydgU9yHcE9kmQIIk2TLoZJrAiBVZ0HxVSeboK5lhdQSqADjwQF62XX35jhC%2F2riB0M8uCqQBAj2%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDc5OTgwMTA4MTY4OCIMXWZds9ZI5hzUdbeGKuQDFreMyeWnWWPqDuGZ2%2BHk6usCr%2Fl096%2FNJh9xtf8htLu56K%2FhWUTx%2BjiqFWM2O%2FF5zTS%2BIV6TqkLDZ%2BQ5Jo1miQrRmR57YDz6uP2Yd1mNZ1ouq5ipnNjUuu5UWCCBAmqyZQsrVmeMQpSV2IB%2BTERCCcW2SukFEYU%2F20%2Fzy5orsoZ8DxOW460IymR3cWBk5u3Xh2cV6Y1RdPEwDEThhqYEF5w%2ByKbLENloMsI%2FUm6sG5PPrO3yQOAP9aK2muLJs9lXQRU%2FL%2FSsmS4FKSUFOqlN6YU%2Bi2Y%2FyGIKAJT2VDkngvz5Sl%2Fadj0j%2BPKftVRV5FcEhySB6Rl%2BSkPN7kVQMJp6pS8hMJ6JCyEA%2BA3eWYdIfKgQhWVXAR4oCBfJ62DH8FU3a7WfSjjpTwfVkiReWen3GGCYfUWETTVKp46MKnJ9PG0CD3KzxKV8VfmEGc5krK%2FI%2F%2BDV2wtSa%2F9qf1%2BK1YYJIK9qZGb25ljUiGhTB4T%2BMUOSQFjetiWUoOJc5Q3Jz%2FXJbiTAMTST39MhdbCgiMgfrc8OGKN5DOVbex33Z7dn0xf%2FOCkSqurhLaG08efKQBdhLNS0RlE9hbg9yZ2ywwtQIF39fI6A7eeH0T11a5HMlvm51u4rAffPHRuEJfwJoIuj%2F2s3QzDg7%2FWeBjqmAbnPOlGfysjrDdvHyG7HVnaX02kdG%2BI3Q4PFOO4Mjaa3ocpjcfPT70%2BZ5a%2FSv5vP0jDLGrLToeM9%2BAUlNepptICRu23a1tLGW4ri0twPA%2FZ4JDTtUUUgdblyG8bKpcUTNp4oOsdmLLBz3FVyr4c2xQbDZSu2zYOtoOxB18W0AC6kIbsMWVU55Bf0mBhPeBWxGrtM4Kw1SgHHlt%2F8vetQi2OwtUcg08c%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=d06dfa41550003359f2aabc8006063a80dfd806a13a54d244024946a76aa9abc + amount: + description: The amount of the payout. + example: 3000 + type: integer + currency: + description: The currency in which the payout is made. + example: MXN type: string expires_at: - example: 0 + description: The expiration date of the payout. + example: 1677626837 format: int64 type: integer - provider: - example: Oxxo - type: string - type: object - example: null - payment_method_card_response_allOf: - description: use for card responses - properties: - last4: - example: "6410" - type: string - bin: - example: "40276657" - type: string - card_type: - example: debit - type: string - exp_month: - example: "10" - type: string - exp_year: - example: "25" - type: string - brand: - example: visa - type: string - name: - example: Fulano Perez" + id: + description: The id of the payout. + example: payout_2vZwsRAhhGp2dFDJx type: string - default: - type: boolean - visible_on_checkout: + livemode: + description: The live mode of the payout. + example: true type: boolean - payment_source_status: - example: active + object: + description: The object of the payout. + example: payout type: string - type: object - example: null - payment_method_spei_recurrent_allOf: - description: use for spei responses - properties: - reference: - example: "93000262276908" + payout_order_id: + description: The id of the payout order. + example: f2654d66-d740-457a-9a8c-f96b5196f44e type: string - expires_at: - example: none + status: + description: The status of the payout. + example: open type: string + required: + - amount + - currency + - id + - livemode + - object + title: payout_order_payouts_item type: object - example: null customer_shipping_contacts_response_address: properties: object: example: shipping_address type: string street1: - example: avenida siempre viva + example: Nuevo Leon 254 type: string street2: - example: fake street + example: Departamento 404 type: string postal_code: example: "06100" @@ -15055,21 +16023,9 @@ components: type: string residential: example: true + nullable: true type: boolean type: object - update_order_tax_response_allOf: - properties: - id: - example: tax_lin_2tQ8dC5mg1UADmVPo - type: string - object: - example: tax_line - type: string - parent_id: - example: ord_2tPAmKCEJqh8RE6nY - type: string - type: object - example: null token_response_checkout: deprecated: true nullable: true @@ -15254,6 +16210,11 @@ components: example: 1677196303 format: int64 type: integer + monthly_installments: + description: "How many months without interest to apply, it can be 3, 6,\ + \ 9, 12 or 18" + format: int8 + type: integer type: example: card type: string @@ -15267,8 +16228,6 @@ components: description: Optional id sent to indicate the bank contract for recurrent card charges. example: S781317595 - maxLength: 10 - minLength: 10 type: string required: - type @@ -15307,10 +16266,96 @@ components: oneOf: - $ref: '#/components/schemas/customer_info' - $ref: '#/components/schemas/customer_info_just_customer_id' + order_fiscal_entity_request: + description: "Fiscal entity of the order, Currently it is a purely informative\ + \ field" + properties: + address: + $ref: '#/components/schemas/fiscal_entity_address' + email: + description: Email of the fiscal entity + example: test@gmail.com + type: string + metadata: + additionalProperties: true + description: Metadata associated with the fiscal entity + maxProperties: 100 + type: object + name: + description: Name of the fiscal entity + example: Conekta Inc + nullable: true + type: string + phone: + description: Phone of the fiscal entity + example: "+525511223344" + type: string + tax_id: + description: Tax ID of the fiscal entity + example: AAA010101AAA + nullable: true + type: string + required: + - address + title: order_fiscal_entity_request + type: object order_update_request_customer_info: oneOf: - $ref: '#/components/schemas/customer_info' - $ref: '#/components/schemas/customer_info_just_customer_id' + order_update_fiscal_entity_request: + description: "Fiscal entity of the order, Currently it is a purely informative\ + \ field" + properties: + address: + $ref: '#/components/schemas/fiscal_entity_address' + email: + description: Email of the fiscal entity + example: test@gmail.com + type: string + name: + description: Name of the fiscal entity + example: Conekta Inc + nullable: true + type: string + metadata: + additionalProperties: true + description: Metadata associated with the fiscal entity + maxProperties: 100 + type: object + phone: + description: Phone of the fiscal entity + example: "+525511223344" + type: string + tax_id: + description: Tax ID of the fiscal entity + example: AAA010101AAA + nullable: true + type: string + required: + - address + title: order_update_fiscal_entity_request + type: object + payout_method: + description: The payout method of the payout order. + properties: + type: + description: The type of the payout method. + example: cashout + type: string + required: + - type + title: payout_method + type: object + payout: + description: The payout information of the payout order. + properties: + payout_method: + $ref: '#/components/schemas/payout_method' + required: + - payout_method + title: payout + type: object checkout_order_template_customer_info: description: It is the information of the customer who will be created when receiving a new payment. @@ -15349,32 +16394,14 @@ components: - currency - line_items type: object - payment_method_card_request_allOf: - properties: - token_id: - description: "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." - example: tok_32hj4g234as - type: string - type: object - example: null - payment_method_cash_request_allOf: - properties: - expires_at: - example: 1553273553 - format: int64 - type: integer - type: object - example: null customer_shipping_contacts_address: description: Address of the person who will receive the order properties: street1: - example: avenida siempre viva + example: Nuevo Leon 254 type: string street2: - example: fake street + example: Departamento 404 type: string postal_code: example: "06100" @@ -15459,137 +16486,6 @@ components: type: string title: details_error type: object - charge_data_payment_method_cash_response: - description: use for cash responses - properties: - auth_code: - example: 542563 - nullable: true - type: integer - cashier_id: - example: OINM01010 - nullable: true - type: string - reference: - example: "93000262276908" - type: string - barcode_url: - example: https://pt-common-s3-stg.s3.amazonaws.com/644ebf80f2243197aad6cd8810375b905b613dbe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MP4SLLCWV%2F20230203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230203T215750Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH4aCXVzLWVhc3QtMSJGMEQCICd79cu7DYu%2F4%2B3HnVVswydgU9yHcE9kmQIIk2TLoZJrAiBVZ0HxVSeboK5lhdQSqADjwQF62XX35jhC%2F2riB0M8uCqQBAj2%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDc5OTgwMTA4MTY4OCIMXWZds9ZI5hzUdbeGKuQDFreMyeWnWWPqDuGZ2%2BHk6usCr%2Fl096%2FNJh9xtf8htLu56K%2FhWUTx%2BjiqFWM2O%2FF5zTS%2BIV6TqkLDZ%2BQ5Jo1miQrRmR57YDz6uP2Yd1mNZ1ouq5ipnNjUuu5UWCCBAmqyZQsrVmeMQpSV2IB%2BTERCCcW2SukFEYU%2F20%2Fzy5orsoZ8DxOW460IymR3cWBk5u3Xh2cV6Y1RdPEwDEThhqYEF5w%2ByKbLENloMsI%2FUm6sG5PPrO3yQOAP9aK2muLJs9lXQRU%2FL%2FSsmS4FKSUFOqlN6YU%2Bi2Y%2FyGIKAJT2VDkngvz5Sl%2Fadj0j%2BPKftVRV5FcEhySB6Rl%2BSkPN7kVQMJp6pS8hMJ6JCyEA%2BA3eWYdIfKgQhWVXAR4oCBfJ62DH8FU3a7WfSjjpTwfVkiReWen3GGCYfUWETTVKp46MKnJ9PG0CD3KzxKV8VfmEGc5krK%2FI%2F%2BDV2wtSa%2F9qf1%2BK1YYJIK9qZGb25ljUiGhTB4T%2BMUOSQFjetiWUoOJc5Q3Jz%2FXJbiTAMTST39MhdbCgiMgfrc8OGKN5DOVbex33Z7dn0xf%2FOCkSqurhLaG08efKQBdhLNS0RlE9hbg9yZ2ywwtQIF39fI6A7eeH0T11a5HMlvm51u4rAffPHRuEJfwJoIuj%2F2s3QzDg7%2FWeBjqmAbnPOlGfysjrDdvHyG7HVnaX02kdG%2BI3Q4PFOO4Mjaa3ocpjcfPT70%2BZ5a%2FSv5vP0jDLGrLToeM9%2BAUlNepptICRu23a1tLGW4ri0twPA%2FZ4JDTtUUUgdblyG8bKpcUTNp4oOsdmLLBz3FVyr4c2xQbDZSu2zYOtoOxB18W0AC6kIbsMWVU55Bf0mBhPeBWxGrtM4Kw1SgHHlt%2F8vetQi2OwtUcg08c%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=d06dfa41550003359f2aabc8006063a80dfd806a13a54d244024946a76aa9abc - type: string - expires_at: - example: 0 - format: int64 - type: integer - service_name: - example: OxxoPay - type: string - store: - example: 10MON50EDI - nullable: true - type: string - store_name: - example: OXXO - type: string - title: charge_data_payment_method_cash_response - type: object - example: null - charge_data_payment_method_card_response: - description: use for card responses - properties: - account_type: - example: Credit - type: string - auth_code: - example: "867372" - type: string - brand: - example: visa - type: string - contract_id: - description: Id sent for recurrent charges. - example: S781317595 - maxLength: 10 - minLength: 10 - type: string - country: - example: MX - type: string - exp_month: - example: "02" - type: string - exp_year: - example: "30" - type: string - fraud_indicators: - items: {} - type: array - issuer: - example: BANAMEX - type: string - last4: - example: "4242" - type: string - name: - example: Fulanito Perez - type: string - title: charge_data_payment_method_card_response - type: object - example: null - charge_data_payment_method_bank_transfer_response: - description: use for bank transfer responses - properties: - bank: - example: STP - type: string - clabe: - example: "646180111805034237" - type: string - description: - nullable: true - type: string - executed_at: - nullable: true - type: integer - expires_at: - example: 1683053729 - format: int64 - type: integer - issuing_account_bank: - nullable: true - type: string - issuing_account_number: - nullable: true - type: string - issuing_account_holder_name: - nullable: true - type: string - issuing_account_tax_id: - nullable: true - type: string - payment_attempts: - items: {} - type: array - receiving_account_holder_name: - nullable: true - type: string - receiving_account_number: - example: "646180111805034237" - type: string - receiving_account_bank: - example: STP - type: string - receiving_account_tax_id: - nullable: true - type: string - reference_number: - nullable: true - type: string - tracking_code: - nullable: true - type: string - title: charge_data_payment_method_bank_transfer_response - type: object - example: null securitySchemes: bearerAuth: scheme: bearer diff --git a/api.yaml b/api.yaml index 7fbefa1..bdb2345 100644 --- a/api.yaml +++ b/api.yaml @@ -30,6 +30,8 @@ paths: $ref: "./resources/balances/balances.yml" /charges: $ref: "./resources/charges/charges.yml" + /charges/{id}: + $ref: "./resources/charges/update_charge.yml" /orders/{id}/charges: $ref: "./resources/orders/order_charge_param.yml" /companies: @@ -74,6 +76,10 @@ paths: $ref: "./resources/orders/order_refunds_param.yml" /orders/{id}/refunds/{refund_id}: $ref: "./resources/orders/order_cancel_refunds_param.yml" + /payout_orders: + $ref: "./resources/payout_orders/payout_orders.yml" + /payout_orders/{id}: + $ref: "./resources/payout_orders/get_payout_order.yml" /checkouts: $ref: "./resources/checkouts/checkouts.yml" /checkouts/{id}: @@ -137,6 +143,9 @@ paths: security: - bearerAuth: [] components: + schemas: + event_types: + $ref: "./schemas/event_types/event_types.yml" securitySchemes: bearerAuth: type: http diff --git a/config-dart.json b/config-dart.json deleted file mode 100644 index 7f8e7b3..0000000 --- a/config-dart.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "useEnumExtension": true, - "pubAuthor": "conekta", - "pubLibrary": "conekta", - "pubVersion": "6.0.0-beta.2", - "pubName": "conekta", - "pubRepository": "https://www.github.com/conekta/conekta-dart", - "pubHomepage" : "https://www.github.com/conekta/conekta-dart", - "pubAuthorEmail": "engineering@conekta.com", - "pubDescription": "Conekta dart Library", - "serializationLibrary" : "built_value", - "templateDir": "templates/dart", - "files" : { - "CODE_OF_CONDUCT.md" : {}, - "AUTHORS.md" : {}, - "LICENSE" : {}, - "conekta.png" : {}, - "CONTRIBUTING.md" : {}, - "utils.mustache" : { - "templateType": "SupportingFiles", - "destinationFilename": "utils.dart", - "folder": "lib/src/utils" - }, - "VERSION.mustache" : { - "templateType": "SupportingFiles", - "destinationFilename": "VERSION" - } - }, - "httpUserAgent": "Conekta/v2 DartBindings", - "gitUserId": "conekta", - "gitRepoId": "conekta-dart" -} \ No newline at end of file diff --git a/config-go.json b/config-go.json deleted file mode 100644 index 7adcdc5..0000000 --- a/config-go.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "packageVersion": "6.0.2", - "packageName": "conekta", - "hideGenerationTimestamp": false, - "generateInterfaces": true, - "disallowAdditionalPropertiesIfNotPresent": true, - "gitUserId": "conekta", - "gitRepoId": "conekta-go", - "httpUserAgent": "Conekta/v2 GoBindings/6.0.2", - "files": { - "CODE_OF_CONDUCT.md" : {}, - "AUTHORS.md": {}, - "LICENSE": {}, - "conekta.png" : {} - }, - "templateDir": "templates/go", - "useOneOfDiscriminatorLookup": true -} \ No newline at end of file diff --git a/config-java.json b/config-java.json deleted file mode 100644 index 43b4cce..0000000 --- a/config-java.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "snapshotVersion": false, - "useRuntimeException": true, - "developerEmail": "core@conekta.com", - "developerName": "Conekta API Core Team", - "developerOrganization": "Conekta, Inc.", - "developerOrganizationUrl": "https://www.conekta.io", - "artifactUrl": "https://developers.conekta.com/", - "artifactVersion": "6.0.0", - "modelPackage": "com.conekta.model", - "licenseName": "MIT License", - "invokerPackage": "com.conekta", - "licenseUrl": "https://www.opensource.org/licenses/mit-license.php", - "apiPackage": "com.conekta", - "artifactDescription": "This is a java library that allows interaction with https://api.conekta.io API.", - "artifactId": "ct-conekta-java", - "groupId": "io.conekta", - "scmConnection": "scm:git:git@github.com:conekta/ct-conekta-java.git", - "scmDeveloperConnection": "scm:git:git@github.com:conekta/ct-conekta-java.git", - "scmUrl": "https://github.com/conekta/ct-conekta-java/tree/main", - "library": "jersey3", - "files": { - "AUTHORS.md": {}, - "CODE_OF_CONDUCT.md": {}, - "LICENSE": {} - }, - "javaMinVersion": 11, - "swagger1AnnotationLibrary": false, - "javaxPackage": "javax", - "templateDir": "templates/java/jersey3", - "disallowAdditionalPropertiesIfNotPresent": true, - "useOneOfDiscriminatorLookup": true, - "serializationLibrary": "jackson", - "httpUserAgent": "Conekta/v2 JavaBindings/", - "openApiNullable" : false -} \ No newline at end of file diff --git a/config-netcore.json b/config-netcore.json deleted file mode 100644 index b2c1c99..0000000 --- a/config-netcore.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "targetFramework" : "netstandard2.0;net6.0", - "testTargetFramework" : "net6.0", - "files": { - "CODE_OF_CONDUCT.md" : {}, - "AUTHORS.md" : {}, - "LICENSE" : {}, - "conekta.png" : {}, - "CONTRIBUTING.md" : {}, - "RuntimeInformation.mustache" : { - "templateType": "SupportingFiles", - "destinationFilename": "RuntimeInformation.cs", - "folder": "src/Conekta.net/Utils" - }, - "VERSION.mustache" : { - "templateType": "SupportingFiles", - "destinationFilename": "VERSION" - } - }, - "apiName" : "conekta", - "packageName" : "Conekta.net", - "netCoreProjectFile" : true, - "packageDescription" : "This is a .net library that allows interaction with https://api.conekta.io API.", - "packageTitle" : "Conekta Library", - "gitUserId": "conekta", - "gitRepoId": "conekta-.net", - "httpUserAgent": "Conekta/v2 .NetBindings", - "packageAuthors" : "engineering@conekta.com", - "packageCompany" : "Conekta", - "useGenericHost" : false, - "templateDir": "templates/netcore", - "useOneOfDiscriminatorLookup" : true, - "packageCopyright" : "Conekta", - "PackageReleaseNotes" : "", - "releaseNote" : "support for resend event, api keys and webhook keys", - "packageVersion" : "6.0.4" -} diff --git a/config-node.json b/config-node.json deleted file mode 100644 index 4596f57..0000000 --- a/config-node.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "npmName": "conekta", - "generateSourceCodeOnly": "false", - "npmVersion": "6.0.0", - "packageUrl": "https://developers.conekta.com/", - "projectName": "conekta-node", - "appDescription": "Conekta Node Library", - "useOneOfDiscriminatorLookup": true, - "nonCompliantUseDiscriminatorIfCompositionFails": false, - "httpUserAgent": "Conekta/v2 NodeBindings", - "files": { - "CODE_OF_CONDUCT.md": {}, - "AUTHORS.md": {}, - "LICENSE": {}, - "conekta.png": {}, - "CONTRIBUTING.md" : {}, - "VERSION.mustache" : { - "templateType": "SupportingFiles", - "destinationFilename": "VERSION" - } - }, - "gitUserId": "conekta", - "gitRepoId": "conekta-node", - "modern": true, - "disallowAdditionalPropertiesIfNotPresent": true, - "invokerPackage": "Conekta", - "useObjectParameters": true, - "npmRepository": "https://www.npmjs.com/package/conekta", - "supportsES6": true, - "legacyDiscriminatorBehavior": true, - "modelPackage" : "model", - "apiPackage" : "api", - "withSeparateModelsAndApi": true, - "withInterfaces" :true, - "templateDir": "templates/node", - "enumPropertyNaming" : "camelCase", - "paramNaming" : "camelCase", - "apiVersion" :"application/vnd.conekta-v2.1.0+json" -} \ No newline at end of file diff --git a/config-php.json b/config-php.json deleted file mode 100644 index dfc5407..0000000 --- a/config-php.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "packageName": "conekta", - "generateSourceCodeOnly": "false", - "artifactVersion": "6.0.1", - "packageUrl": "https://developers.conekta.com/", - "projectName": "conekta-php", - "appDescriptionV2" : "Conekta PHP Library", - "useOneOfDiscriminatorLookup" : true, - "nonCompliantUseDiscriminatorIfCompositionFails" : false, - "httpUserAgent": "Conekta/v2 PhpBindings/6.0.1", - "packageAuthors" : "engineering@conekta.com", - "files": { - "CODE_OF_CONDUCT.md" : {}, - "AUTHORS.md" : {}, - "CONTRIBUTING.md" : {}, - "LICENSE" : {}, - "conekta.png" : {}, - "VERSION.mustache" : { - "templateType": "SupportingFiles", - "destinationFilename": "VERSION" - }, - "ssl_data/ca_bundle.crt": { - "destinationFilename": "lib/ssl_data/ca_bundle.crt" - } - }, - "gitUserId": "conekta", - "gitRepoId": "conekta-php", - "modern" : true, - "disallowAdditionalPropertiesIfNotPresent" : true, - "invokerPackage" : "Conekta", - "templateDir": "templates/php", - "legacyDiscriminatorBehavior" : false -} diff --git a/config-python.json b/config-python.json deleted file mode 100644 index 2781649..0000000 --- a/config-python.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "packageName": "conekta", - "developerEmail": "core@conekta.com", - "developerName": "Conekta API Core Team", - "developerOrganization": "Grupo Conektame, S.A. de C.V", - "developerOrganizationUrl": "https://www.conekta.com", - "licenseName": "MIT License", - "licenseUrl": "https://www.opensource.org/licenses/mit-license.php", - "generateSourceCodeOnly": "false", - "packageVersion": "6.0.1", - "packageUrl": "https://github.com/conekta/conekta-python", - "projectName": "conekta", - "templateDir": "templates/python", - "hasBearerMethods" : true, - "useOneOfDiscriminatorLookup" : true, - "nonCompliantUseDiscriminatorIfCompositionFails" : false, - "httpUserAgent": "Conekta/v2 PythonBindings/6.0.1", - "files": { - "AUTHORS.md" : {}, - "CODE_OF_CONDUCT.md": {}, - "LICENSE" : {}, - "VERSION.mustache" : { - "templateType": "SupportingFiles", - "destinationFilename": "VERSION" - } - }, - "gitUserId": "conekta", - "gitRepoId": "conekta-python" -} diff --git a/config-ruby.json b/config-ruby.json deleted file mode 100644 index 3cc4d21..0000000 --- a/config-ruby.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "gemAuthorEmail" : "core@conekta.com", - "gemAuthor": "Conekta", - "gemName" : "conekta", - "gemLicense": "MIT", - "gemVersion": "6.0.0", - "hideGenerationTimestamp": false, - "moduleName": "Conekta", - "gemSummary" : "This library provides https://api.conekta.io operations", - "gemHomepage" : "https://www.conekta.com", - "gemDescription" : "Ruby library for https://api.conekta.io", - "library": "faraday", - "httpUserAgent": "Conekta/v2 RubyBindings/#{Conekta::VERSION}", - "gemRequiredRubyVersion" : ">= 2.6", - "templateDir": "templates/ruby", - "gitUserId" : "conekta", - "gitRepoId" : "conekta-ruby", - "files": { - "CODE_OF_CONDUCT.md" : {}, - "AUTHORS.md" : {}, - "CONTRIBUTING.md" : {}, - "LICENSE" : {}, - "conekta.png" : {}, - "ssl_data/ca_bundle.crt": { - "destinationFilename": "lib/ssl_data/ca_bundle.crt" - }, - "CUSTOM_VERSION.mustache" : { - "templateType": "SupportingFiles", - "destinationFilename": "VERSION" - } - } -} diff --git a/mocks/conekta_api.json b/mocks/conekta_api.json index 3a3384d..14ab72d 100644 --- a/mocks/conekta_api.json +++ b/mocks/conekta_api.json @@ -4568,7 +4568,7 @@ "responses": [ { "uuid": "90ab7bed-8239-4abb-aa49-36a4b2d5fbe8", - "body": "{\n \"next_page_url\": \"https://api-core.stg.conekta.io/orders?next=ord_2tNDyQbJacvUZiyfp\",\n \"has_more\": true,\n \"total\": 448,\n \"object\": \"list\",\n \"data\": [\n {\n \"livemode\": true,\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Miles_Price@gmail.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKZmA749BLsMRgBY\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUigJs3CPGFSNbZi\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUigJ8DgBhbp6w5D\",\n \"metadata\": {},\n \"is_refundable\": true,\n \"created_at\": 1678134109,\n \"updated_at\": 1678134110,\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"64064b5ddb5c8a0001cde484\",\n \"livemode\": true,\n \"created_at\": 1678134109,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"QFdozPB7caeKikDCXQebz2j1uyYKUf2s\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKZmA749BLsMRgBY\",\n \"order_id\": \"ord_2tUigJ8DgBhbp6w5D\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUhuyzqLi6UJE9Cy\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"8bf936e6-3b5c-4095-a9f3-69aca5ad7863\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUhuyzqLi6UJE9D2\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUhuyzqLi6UJE9Cz\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"8bf936e6-3b5c-4095-a9f3-69aca5ad7863\",\n \"name\": \"ord-2tUhuyzqLi6UJE9D1\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": true\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUhuyzqLi6UJE9D1\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678130628,\n \"updated_at\": 1678130628,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUhuyzqLi6UJE9Cw\",\n \"parent_id\": \"ord_2tUhuyzqLi6UJE9D1\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUhcjeepaMTxHwQ7\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"ed002df7-6b53-483f-8ac3-bc35fbbfbc10\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUhcjeepaMTxHwQA\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUhcjeepaMTxHwQ8\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"ed002df7-6b53-483f-8ac3-bc35fbbfbc10\",\n \"name\": \"ord-2tUhcjeepaMTxHwQ9\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [\n 3,\n 6,\n 12\n ],\n \"monthly_installments_enabled\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUhcjeepaMTxHwQ9\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678129273,\n \"updated_at\": 1678129273,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUhcjeepaMTxHwQ5\",\n \"parent_id\": \"ord_2tUhcjeepaMTxHwQ9\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUhcPiXmC9x512Am\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"dc45f292-4890-468b-a117-8d8e1ea5371a\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUhcPiXmC9x512Ap\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUhcPiXmC9x512An\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"dc45f292-4890-468b-a117-8d8e1ea5371a\",\n \"name\": \"ord-2tUhcPiXmC9x512Ao\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUhcPiXmC9x512Ao\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678129246,\n \"updated_at\": 1678129246,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUhcPiXmC9x512Aj\",\n \"parent_id\": \"ord_2tUhcPiXmC9x512Ao\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgccjdQJ7SdBrXZ\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"8c4e58f7-828e-48cb-960d-c12242ffa319\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgccjdQJ7SdBrXc\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgccjdQJ7SdBrXa\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"8c4e58f7-828e-48cb-960d-c12242ffa319\",\n \"name\": \"ord-2tUgccjdQJ7SdBrXb\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [\n 3,\n 6,\n 12\n ],\n \"monthly_installments_enabled\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678124707,\n \"updated_at\": 1678124707,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgccjdQJ7SdBrXX\",\n \"parent_id\": \"ord_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgQLJywuuSAaTmy\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"bc2a3674-660b-4118-b209-10fd0c7b2539\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgQM3oU7U5nr8GS\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgQLJywuuSAaTmz\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"bc2a3674-660b-4118-b209-10fd0c7b2539\",\n \"name\": \"ord-2tUgQLJywuuSAaTn1\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUgQLJywuuSAaTn1\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678123743,\n \"updated_at\": 1678123743,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgQLJywuuSAaTmw\",\n \"parent_id\": \"ord_2tUgQLJywuuSAaTn1\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgAg9rFzuNAoQ7o\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"96a87c6e-e848-4f3d-bf06-c66b1c03e5c7\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgAg9rFzuNAoQ7r\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgAg9rFzuNAoQ7p\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"96a87c6e-e848-4f3d-bf06-c66b1c03e5c7\",\n \"name\": \"ord-2tUgAg9rFzuNAoQ7q\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUgAg9rFzuNAoQ7q\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1678122669,\n \"updated_at\": 1678122669,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgAg9rFzuNAoQ7m\",\n \"parent_id\": \"ord_2tUgAg9rFzuNAoQ7q\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUg8uXxtHfCFGA21\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"e085df36-bb2d-4e8e-825e-31d713ba15a7\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUg8vGnQVDqsXpWU\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUg8uXxtHfCFGA22\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"e085df36-bb2d-4e8e-825e-31d713ba15a7\",\n \"name\": \"ord-2tUg8uXxtHfCFGA23\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678341599,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUg8uXxtHfCFGA23\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1678122531,\n \"updated_at\": 1678122531,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUg8uXxtHfCFGA1y\",\n \"parent_id\": \"ord_2tUg8uXxtHfCFGA23\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUg82bRxXpS6dNDH\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"eeb3a7d9-ceec-4bdf-8aae-2b70f5c81bb7\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUg82bRxXpS6dNDL\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUg82bRxXpS6dNDJ\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"eeb3a7d9-ceec-4bdf-8aae-2b70f5c81bb7\",\n \"name\": \"ord-2tUg82bRxXpS6dNDK\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678341599,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUg82bRxXpS6dNDK\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1678122461,\n \"updated_at\": 1678122461,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUg82bRxXpS6dNDF\",\n \"parent_id\": \"ord_2tUg82bRxXpS6dNDK\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tTirxDJEFDe8NUAL\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tTirxDJEFDe8NUAM\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tTirxDJEFDe8NUAN\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1677870662,\n \"updated_at\": 1677870662,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tTirxDJEFDe8NUAJ\",\n \"parent_id\": \"ord_2tTirxDJEFDe8NUAN\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"6402464645f9e8000165c2ca\",\n \"livemode\": true,\n \"created_at\": 1677870662,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/94e526bbd9f77af1a95130691088021ff869fbda.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MLPWLPAKO%2F20230303%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230303T191102Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEBwaCXVzLWVhc3QtMSJIMEYCIQCJcvbKD7bOSESXyn8oo%2FzfAPwgWO4m3NCWDb2gumoMZAIhAIam91DYG1qorOEkgdzBoLNsGcQEMW%2BoxcWGT0Y0IqIXKpAECMT%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQAhoMNzk5ODAxMDgxNjg4IgwOC3W4Y8gV514Fx7cq5APKrTe4Zq7AkcKI9H4NfaNt1MA7YwPFUl0JCC0jkCW1KRpmzXir9Gl8%2F6YslsKNsWhyPU7ZJH8rynf%2BENPwAf0doyCP0mT5mA7I1HaCNXW4AioVMgP2uPAVEimK16%2Br2MQ9LGNbUywuMErd8rDtpzSQ0tXyB0E9piLTh3ejASBzSsSF79KCD2eVEg24wdyUQyw1ftuwsDk24j9QpCFUyPeihzOVf3RDXtTYSWyQt4%2B1cYVodnBXErRVpO%2FPVA%2FpKe20WxZbLyBkMKU4Sb34YpFOhqVIeWr8SWB%2BueUkRuXj8jxhaMve9lNaCdRIzSZxSbhIcslWupXp6J6hPXgOSv%2BVBDxtl4geZLNACIXcTgVzLaLOUt8w2ItPULFzdtgOYaHvsQzZUlDcJFUrl1ytBOdrIvBX7qwuHOxJBQ2yQKMbH7gKFdd%2B5PGNDj5cWe%2B1plr%2FUileuMpdXLfXmQ2%2FNTgo6knbmXbaji6O%2BdS3ox3czOobhNOoqvCGdpPzyHyACYmzRP9VLnJluXZIHn3T6lEqNcGO1b%2FGdP1yeAG%2Bw%2BSWS6nspG9y33z8fdjqBFqmD%2F0Qp4fzPqrbI4G0Yc8us8xzJKw8t32Eq%2FTOvxxhOxqZTPi%2B5LiDADW8qvIO1v1SpmqKUnVVMJ2KiaAGOqQBKKpjIc7bpa6UwW1yHiHZNf7wCDnSr0bucJHkDvFTGc6wcCNzQgzCaRxp5%2FlLY68NFiqTLrjswEesap%2FQINS9y68Wz%2BvmZYEQrjSLXdDuXvckYrPzYsInCb%2BKvqS1p%2FXAhrk6c9eHYErOLJC4gTowtTWM6VH68%2B74ZSu4J1C2nxL252u5uCb2yODA5WfQ79cxPCeMmB9D0b9cJnDPqa6vf1tHHoc%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=0af1ed056b660f18c69f4ab039e46891dee21fd4a045a9201181a825f1766c05\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1680480000,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262280678\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 2000,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tTirxDJEFDe8NUAN\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"payment_status\": \"declined\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tSoWNL3A41LDVatS\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tSoWNL3A41LDVatQ\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tSoWNL3A41LDVatK\",\n \"metadata\": {},\n \"is_refundable\": true,\n \"created_at\": 1677627543,\n \"updated_at\": 1677717913,\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 5,\n \"data\": [\n {\n \"id\": \"640570cc4f47a400014847ed\",\n \"livemode\": true,\n \"created_at\": 1678078156,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"PeLn2HZJKwT9PmEuVCcPLPYN7WeYmZMf\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n },\n {\n \"id\": \"6402b1a64f47a40001483299\",\n \"livemode\": true,\n \"created_at\": 1677898150,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"Q8PhhabwTyjeKo9d1DwujHZWDkvX9y8v\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n },\n {\n \"id\": \"63fff28386af700001fff912\",\n \"livemode\": true,\n \"created_at\": 1677718147,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"ST6wUrE6WFfVg2uTHJ5AtCp4ZEGNiTLp\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n },\n {\n \"id\": \"63fff19986af700001fff900\",\n \"livemode\": true,\n \"created_at\": 1677717913,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"JMvw8DEXV5dnc7GWNru4f98VPHkM5txc\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n },\n {\n \"id\": \"63fe90977ec07c00013c91c4\",\n \"livemode\": true,\n \"created_at\": 1677627543,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"aaKEctPdNiPbk1PovzsMarfVEbQ32ExX\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tSoMP7bZJbLiq4zF\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tSoMP7bZJbLiq4zD\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tSoMP7bZJbLiq4z8\",\n \"metadata\": {},\n \"is_refundable\": true,\n \"created_at\": 1677626837,\n \"updated_at\": 1677626837,\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63fe8dd57ec07c00013c914d\",\n \"livemode\": true,\n \"created_at\": 1677626837,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"ZXetAuLpsAMgEMKEJRcmbmqfJt1afCTC\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoMP7bZJbLiq4z8\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 20000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"leandro.orban@conekta.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Leandro Orban\",\n \"corporate\": false,\n \"customer_id\": \"cus_2ss5YAeTKuEr5M4fD\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Mario perez\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Campeche y Morelos\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"78215\"\n },\n \"id\": \"ship_cont_2tSiWW7njfEgy4Ms5\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tSiWZ54pTVHU91pm\"\n },\n \"checkout\": {\n \"id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"name\": \"Arte en Sublimación\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"https://aortegag0501.wixsite.com/artesublimacion/success\",\n \"failure_url\": \"https://aortegag0501.wixsite.com/artesublimacion/failure\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"HostedPayment\",\n \"recurrent\": false,\n \"starts_at\": 1677564000,\n \"expires_at\": 1677823199,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [\n 3,\n 6,\n 9,\n 12\n ],\n \"monthly_installments_enabled\": true,\n \"is_redirect_on_failure\": true,\n \"redirection_time\": 10,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"slug\": \"a767fcb10b7541c796ca1083d948ce31\",\n \"url\": \"https://pay.stg.conekta.io/checkout/a767fcb10b7541c796ca1083d948ce31\"\n },\n \"object\": \"order\",\n \"id\": \"ord_2tSiWW7njfEgy4Ms6\",\n \"metadata\": {},\n \"is_refundable\": true,\n \"created_at\": 1677604774,\n \"updated_at\": 1677604774,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Vasija de Cerámica\",\n \"description\": \"Description\",\n \"unit_price\": 20000,\n \"quantity\": 1,\n \"sku\": \"SKU\",\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ],\n \"brand\": \"Brand\",\n \"object\": \"line_item\",\n \"id\": \"line_item_2tSiWW7njfEgy4Ms2\",\n \"parent_id\": \"ord_2tSiWW7njfEgy4Ms6\",\n \"metadata\": {\n \"Valor3\": \"South#23\"\n },\n \"antifraud_info\": {}\n }\n ]\n },\n \"shipping_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"amount\": 0,\n \"carrier\": \"Fedex\",\n \"method\": \"Airplane\",\n \"tracking_number\": \"TRACK000000000123\",\n \"object\": \"shipping_line\",\n \"id\": \"ship_lin_2tSiWW7njfEgy4Ms3\",\n \"parent_id\": \"ord_2tSiWW7njfEgy4Ms6\"\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 3,\n \"data\": [\n {\n \"id\": \"63fe39067033d8000169dd7a\",\n \"livemode\": true,\n \"created_at\": 1677605126,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"FIBd3eKUhff43QLEp6xZ\",\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tSib2crxT9HiVyas\"\n },\n \"payment_method\": {\n \"name\": \"Alexis Gatto\",\n \"exp_month\": \"01\",\n \"exp_year\": \"25\",\n \"object\": \"card_payment\",\n \"type\": \"debit\",\n \"last4\": \"5454\",\n \"brand\": \"mastercard\",\n \"issuer\": \"\",\n \"account_type\": \"\",\n \"country\": \"US\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"declined\",\n \"amount\": 20000,\n \"fee\": 1044,\n \"customer_id\": \"cus_2ss5YAeTKuEr5M4fD\",\n \"order_id\": \"ord_2tSiWW7njfEgy4Ms6\"\n },\n {\n \"id\": \"63fe38f97033d8000169dd6f\",\n \"livemode\": true,\n \"created_at\": 1677605113,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"FIBd3eKUhff43QLEp6xZ\",\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tSias2DBrprazMDJ\"\n },\n \"payment_method\": {\n \"name\": \"ale test\",\n \"exp_month\": \"12\",\n \"exp_year\": \"25\",\n \"object\": \"card_payment\",\n \"type\": \"debit\",\n \"last4\": \"5454\",\n \"brand\": \"mastercard\",\n \"issuer\": \"\",\n \"account_type\": \"\",\n \"country\": \"US\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"declined\",\n \"amount\": 20000,\n \"fee\": 1044,\n \"customer_id\": \"cus_2ss5YAeTKuEr5M4fD\",\n \"order_id\": \"ord_2tSiWW7njfEgy4Ms6\"\n },\n {\n \"id\": \"63fe38ef7033d8000169dd64\",\n \"livemode\": true,\n \"created_at\": 1677605103,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"FIBd3eKUhff43QLEp6xZ\",\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tSiakNqW4m1xZNoP\"\n },\n \"payment_method\": {\n \"name\": \"Alexis TestVisa\",\n \"exp_month\": \"01\",\n \"exp_year\": \"25\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4242\",\n \"brand\": \"visa\",\n \"issuer\": \"BANAMEX\",\n \"account_type\": \"Credit\",\n \"country\": \"MX\",\n \"fraud_indicators\": [\n {\n \"description\": \"El usuario está utilizando una tarjeta de crédito o débito de prueba en modo producción.\",\n \"weight\": null,\n \"value\": null\n }\n ]\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"declined\",\n \"amount\": 20000,\n \"fee\": 116,\n \"customer_id\": \"cus_2ss5YAeTKuEr5M4fD\",\n \"order_id\": \"ord_2tSiWW7njfEgy4Ms6\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 4300,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tPAmKCEJqh8RE6nW\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tPAmKCEJqh8RE6nX\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676667267,\n \"updated_at\": 1676996351,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 3,\n \"data\": [\n {\n \"name\": \"test csharp\",\n \"description\": \"test modified\",\n \"unit_price\": 500,\n \"quantity\": 2,\n \"tags\": [\n \"Pago 2\",\n \"Pago mensualidad 2\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tQ8HkkfbauaKP9Ho\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {\n \"key\": \"value\"\n },\n \"antifraud_info\": {\n \"key\": \"value2\"\n }\n },\n {\n \"name\": \"test csharp\",\n \"description\": \"test csharp\",\n \"unit_price\": 500,\n \"quantity\": 2,\n \"object\": \"line_item\",\n \"id\": \"line_item_2tPAokCikvD2rorMf\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {\n \"key\": \"value\"\n },\n \"antifraud_info\": {\n \"key\": \"value\"\n }\n },\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tPAmKCEJqh8RE6nU\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"shipping_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"amount\": 100,\n \"carrier\": \"FEDEX\",\n \"method\": \"bus\",\n \"tracking_number\": \"track123\",\n \"object\": \"shipping_line\",\n \"id\": \"ship_lin_2tQPU5qoFZFCsQHGs\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {\n \"key2\": \"value2\"\n }\n }\n ]\n },\n \"tax_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 4,\n \"data\": [\n {\n \"description\": \"test csharp2222\",\n \"amount\": 100,\n \"object\": \"tax_line\",\n \"id\": \"tax_lin_2tQ974hSHcsdeSZHG\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n },\n {\n \"description\": \"test csharp\",\n \"amount\": 100,\n \"object\": \"tax_line\",\n \"id\": \"tax_lin_2tQ95yCyWUTqsDV9b\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n },\n {\n \"description\": \"test csharp\",\n \"amount\": 100,\n \"object\": \"tax_line\",\n \"id\": \"tax_lin_2tQ94zMtR87tiRPRf\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n },\n {\n \"description\": \"test postman\",\n \"amount\": 100,\n \"object\": \"tax_line\",\n \"id\": \"tax_lin_2tQ8dC5mg1UADmVPo\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n }\n ]\n },\n \"discount_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"code\": \"1234\",\n \"amount\": 200,\n \"type\": \"loyalty\",\n \"object\": \"discount_line\",\n \"id\": \"dis_lin_2tQQ58HPgPw7StE8z\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tPAkpQH14jq2hDgA\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tPAkpQH14jq2hDgB\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tPAkpQH14jq2hDgC\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676667228,\n \"updated_at\": 1676667245,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 2,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad test\",\n \"description\": \"Mes de marz.\",\n \"unit_price\": 1000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago 2\",\n \"Pago mensualidad 2\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tPAm2xCrTJrfHW1K\",\n \"parent_id\": \"ord_2tPAkpQH14jq2hDgC\",\n \"metadata\": {},\n \"antifraud_info\": {}\n },\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tPAkpQH14jq2hDg8\",\n \"parent_id\": \"ord_2tPAkpQH14jq2hDgC\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tP72uE7jK7iHdFVd\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tP72uE7jK7iHdFVe\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tP72uE7jK7iHdFVf\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676650265,\n \"updated_at\": 1676650327,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tP72uE7jK7iHdFVb\",\n \"parent_id\": \"ord_2tP72uE7jK7iHdFVf\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63efa757cf65380001aec040\",\n \"livemode\": true,\n \"created_at\": 1676650327,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/9e9f39dd48fe91bef5424e64e3a3bfedc919b120.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MFEACMARD%2F20230217%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230217T161207Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEMf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCIGWtRkzuSh3mieAG8Qtont4%2Bmuqe%2B%2BvKmNJdbLv5Z3xDAiBjUMuXrcmJDneKaUAbwfKKNi%2FCxs7kgSZXIeviKdPKIyqHBAhgEAIaDDc5OTgwMTA4MTY4OCIMLJnfLVnI3fBUtD0EKuQDtNV5vIciROZNyt5VAPR2WpkDLPFU%2BfpQGyWom0W6Axhi1b8ACxSsCYGFzmnR1IrUiJ8wsaJN3Z758MqA88y6c2tHjOABgiqGGyO4njO64LCzuTYnyz2Hs3LnTG9uayqxf8lQYWoL4%2FdyXi3%2BCVXTbWvhcmQPB1o03AWLGr1hjzHuAKQPhz2HTnM85f3H5EVU5PvLY6WFVzjV5E0QWXta%2B4K%2FiSzOqWk%2BS%2FtT0KYhQ2s9RRVE3TWf4OtD8PpPKKGAicCnrqTWiXDLmbx1ZnyBtC5Qewhadi4%2BMEf9a7aLNsgYjAu197%2Fcz%2FPIYxEw2Mu%2BFBjfEmx%2FZ2qa%2BV6HUOUMylhLgfFXlbmQv049qXjkhXpNKPFigv0zl7Mk%2FhASn5gnf7Lgqpcpx6V%2Bg9kCwZ74ix%2FrdxYeilFVV%2FeYyutRnc6yEtAOTPxX03Zgrs8gO5knIhMDBymtc2wDtlYWBEDpsrxflVAxXf8gyNa3Sl9afRHjq04kehAt8TdTLBOUHJHLDHkk0ZtGS8tCO50KCYjMpqwGbibqv%2BwoiaNd3J%2Ft%2F71jlZXVyYdcXI1Z0psC1aY5vpR7%2BOCEWS7K7terNfPBdHlfqTispgCQHqMEB3nay0Sms0KAB9H5k56gswIBUlwNL2z28DCBrr6fBjqmAZrx0soBstN9%2BXgZT2S0JmuyhGzc2XKpaIDkctpITE12Ym25YDWwQYmHuYpECdjKBQ%2BzSb1RbEqlz37iyF6XGTMmh4WNNhENZ7Ie8lNQNLz8zCneeMFM%2FAaEHwbsgvEhTKykoESBX5TGyo%2Fi1YrbZvbQJ2WSFS6gVFHwoBq86Ooa3AyINUZB4boqhO0BJ1ffvtz%2BwBJSvmyMKoXv7OaED43nxW%2BvJTk%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=db0689f105fdba31a4a3ba62b2cdb8f80bbe570a737c1b8cedb65e45cbb45b91\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1679011200,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262277930\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 14,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tP72uE7jK7iHdFVf\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tNYbzzbb1zcB4gBp\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tNYbzzbb1zcB4gBq\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tNYbzzbb1zcB4gBr\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676502497,\n \"updated_at\": 1676502498,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tNYbzzbb1zcB4gBn\",\n \"parent_id\": \"ord_2tNYbzzbb1zcB4gBr\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63ed65e14044ea0001b3cf30\",\n \"livemode\": true,\n \"created_at\": 1676502497,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/5aebfcdecfc60bf3128e3d6d52d698e75c61b8fe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MO4IXAVWV%2F20230215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230215T230817Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEJ%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIGlYRndD5T2JnPk%2BWWOoI3h9nXW4F%2FQiREVp60I9GS2eAiEAkwgQwACxy%2BWsNEga5Enr4KRQLSpHXxxlhuxp3vDOE%2FsqhwQIOBACGgw3OTk4MDEwODE2ODgiDA7qNmZeph78KJO1NyrkA%2FiUSVNu7PO1rGUYmhuC18uvQv57lkPPPtQV%2B9IOA5W0RrKcxBQZRzBQwYtOZUJcv4wNrHgHv6nxj%2BaRAo3qaLv9ow29n2L7KvZeZsPMhoBd1yGyYirbY7x5Acj54dSQqiV6oBwaJLIdyFeGTMRHBYCuLC9LQv4Hs4zU%2FRSx4%2Bzp4PKDJZKMW8JS0bFO6dj1ecCATik4n3%2BOW%2BDj6T735ESVQLDETVj1XS%2BYyK1DLWsMabn0PgS%2FhIGQk%2B7vLUT2dCS0L4B6rLRYIIYkywVeoMPjSl7aVFlxBhxFRm7a2YVYPktlfNjmp6Kzg9G75LRQQyDdCD32Xs3HYOArWonEO1hFl8EhaTWyKhxOQHHq0TUo4tkAx0Kmy0ar0JLbRfIyrXdpZgjbNyGfGGW2%2BnSeONYJpj1WHBwQkDtg3oO5mrch9S83sYrz7c%2BXifku2HSdr4kucNgXqCG5Fbp%2F3qqCr4m2%2BImzbclxL1gS5rpl45OYA0AlMfIGNrET%2BlombMH3mXaoPtbsbYAXkX7xk6HqXZRJmdphVgOTWWhnt8j3M4VFwPd9rj6QrSaKZFIIpgluKVqePuLFjRgfToQ%2FBXNOVHJT8cRbSC%2BDz3Y7y%2BPsPCjEOOvQEbzT%2BhuZNMMllaAgnz%2FCGIUwwcm1nwY6pQGKbewlnXqfAU%2B5yDwJDFsgj5mtPXhh7ED9NefljsJzUH31l0kbFLkIgWPxynNLxMnZlTrecwBjTJLQEnx7Utpm51mA%2FrolACdwLpEoL6XH63RBvFs%2F%2Bc0lfc6mcP8zu4qoBA0A11aAh1uqDpQDhMGfOzQWga9EEs39kx85UlMCPxQRrh1bmsaolFKxNmUCZv5a%2BwoPtjIj3M0tiZjcJDLQ%2FQYYD78%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=7ef873dcb182b87061704afdba056da24d6707a08a1a0659d4a32aec1c06ce23\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1678838400,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262277815\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 2000,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tNYbzzbb1zcB4gBr\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tNYRWFQHBtbsCSi2\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tNYRWFQHBtbsCSi3\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tNYRWFQHBtbsCSi4\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676501672,\n \"updated_at\": 1676501673,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tNYRWFQHBtbsCShz\",\n \"parent_id\": \"ord_2tNYRWFQHBtbsCSi4\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63ed62a8b057b50001186bb0\",\n \"livemode\": true,\n \"created_at\": 1676501672,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/dbe611be7832d4b1803f6a8c0178a8eb1235fb5d.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MF5UC2Y2T%2F20230215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230215T225433Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEJ%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIBOfT4UaZyh9mY3GyrKZ8cx8C9Fzc0CXCZpKWxgnWCjuAiEA5F8Hx7cpw8UasEOl3kHcojqawwjc9MANBHS9B8g01JcqhwQIOBACGgw3OTk4MDEwODE2ODgiDAt%2BQN4aqP8pxbGWjCrkA9DXhVV%2BP0p%2FRLBXYzX9AvMgZdRIZW9bU5m8S0c2WfM26AUqVEYd4SPk3ZGbrsUEQ9Ooh5xCSFf1kH%2BYa7kRm0fOIAWoGdHc3CD6RKDNBB7TIOUxG1L25oG6ebZzZcbU0hTFuqgdbsjAjwTK1zjlSKg%2FYINtiD1uRXkemWVy71VIXx%2FCfuxn4iEGtljZBsSKnUZ14PxnSZ1lXo9IOC0HzSbHGNXwIeO5ppj2QdexIfEP%2BiKELU96nWEbIEaMYdkA%2Bz1RKYBWYU%2FxHX6Wz%2BOnsr0feqw7an8IGzMoAtKO0p8VAxTfOo4Jt222E45j8vvwASVD9rMf2r8sdqLbpQHSIOX0j1FzLQfLcKHvJCOdPhSYImr2V9vJss82onqeCfG%2FnvYKyZCUs%2BEoIw91A39sHw5oAzN1TlAcxGlHyXzAL180koX8QOCObOtPm89NVmAYvsZLahVEAP6%2BHqrnmUGWAtOC1Y3H%2FyUIB9vUnTyDhPMbx18vUdaOF2zkYwFDP7up6R%2BIzABzmYxRtokq0aFYKdOJMb0%2FK6F0rTYChcmIkowjFK%2FtXDZ84c2rtMsAEnivxyc3h59Sdd9hukxwhw3mIsIOT6UGsgraBSX9CcPZS1pEJIt6fTu2a5qA2g%2B1y6WR%2BcARkGIwmb21nwY6pQHhY2fqu3M%2Fp%2FJWgVLrZuev7%2FW1SAVYSLuh4kS79glqUItsUILIh4tladBKFksyaX0ytRmzOZ%2BdFW4nsDlbZ4eqXZP1QL0RWjVX5Jw3kc%2Bg5zTFeDTHUVUhevS9RG7xQBfO4CarswXZ5RTG2ozc213YuWTgumElbp6wcUACeIOa6IkxOHhqmuTBSJfBv48ycSNljAxSZqkxHPENX87HK5vBCUeWPOg%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=8cc6e4f8b822db762ecc409798a40024bcd61b321b0bb3e64d0bf26919378d54\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1678838400,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262277807\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 2000,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tNYRWFQHBtbsCSi4\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 460,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tNDzhA4Akmzj11AQ\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"6fca054a-8519-4c43-971e-cea35cc519bb\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tNDzhA4Akmzj11AU\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tNDzhA4Akmzj11AR\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"6fca054a-8519-4c43-971e-cea35cc519bb\",\n \"name\": \"ord-2tNDzhA4Akmzj11AS\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx\",\n \"failure_url\": \"http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"HostedPayment\",\n \"recurrent\": false,\n \"starts_at\": 1676354400,\n \"expires_at\": 1676613599,\n \"allowed_payment_methods\": [\n \"card\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"is_redirect_on_failure\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"slug\": \"6fca054a85194c43971ecea35cc519bb\",\n \"url\": \"https://pay.stg.conekta.io/checkout/6fca054a85194c43971ecea35cc519bb\"\n },\n \"object\": \"order\",\n \"id\": \"ord_2tNDzhA4Akmzj11AS\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676417703,\n \"updated_at\": 1676663383,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 460,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tNDzhA4Akmzj11AN\",\n \"parent_id\": \"ord_2tNDzhA4Akmzj11AS\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63efda57cf65380001aec1a9\",\n \"livemode\": true,\n \"created_at\": 1676663383,\n \"currency\": \"MXN\",\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"6fca054a-8519-4c43-971e-cea35cc519bb\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tP9usmyzXMXaJc2F\"\n },\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/0f0f98272185c8060bb812ad1c790f4247360512.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MOQYX2SEM%2F20230217%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230217T194943Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEMr%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIQDzzIB7Wi7vELmx9iGedGGem1vsg%2FYnCWsECQ%2Fx%2BdQ%2FqgIgVqINLKl2CQF2OgpWBZw7bnEl5Pp6KY49%2FOQ56LM5ylYqhwQIYxACGgw3OTk4MDEwODE2ODgiDB4G%2F22RR5G7uGaExyrkA0IuptcoulAGRSziLp59vcR1%2BbSL8pY64k84b%2B%2FIgGnf1XSJek2wOALC3WbJ%2Fs1zrT6iRoJHAmQ%2B%2BtjVJgF1XxujQZiGiQVHThsePVtFVEGSZfjNWzldUaFKQLhn%2BZfls9JTb3pddbIHA%2BRQwjOJ1K8NKf7EQGn5gMMZQKaC%2FAWTlXwWnZfM2u03JVvJaioRZm3S7lnM89ICjHTxOxTk0m51Vm9ZVVARhb38w%2FPw%2F194Ah4JU7NrYai5rdkALbVP%2FAE0QYP0micI9Whj8OQDlptB53rsDzlZatcSjYK%2Frod9bzMJXv5b6dWezTCwO4ryGV24N0Q3Pmdg9U9cUOPvHVsjiq4HKx6l8Gc70WI61F77HNq0MnYXMR1ozJSHtPLTbFXZcyFGnPXbEy7t78gCnpjAPQCaMCnrWBur43mcNRG80sYPo%2FJLDD2jZ9glhzlSzSHik%2FI6ozQC13kBHL8PHVAw6OAwaSXbU%2BPI5nMtEUOOiPwQpsqcFErN8YVvHH1JqWdjNiiPTMqNNMxPRdAOcrLmGHwWDswOwhg0HMW0bKY3JjClAhSb1JxD5wNIvcZiMLxva6pMwJiQlv%2FFbLvQcN%2BMDEz3Ophf1u%2BWA8IPg08%2B29rk78AIFMotIFB7QVQ8kqacbVcw4IC%2FnwY6pQH8BNCZY%2Bp0ngsfYTZ%2BuNMr0%2B50E3HhXzQIRXajTNtNg4pAxoSHccoeEQGBGy6TTeblpCT%2Bet8unkDeOyHrqJwQLFOwj0wXdSnLEkE6iNdHBhUgSWtD5RwRcquS3VPH7v5S3zY2k2GecLxjWuhDA1Wrammgjgk4cz7XsjBBrk1e7Rte2W4gNKq1oYX4SaZBSfAV7QkFb6SYxEKgv4C5VfBmXRGAOJc%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=4a0673cb5d996dc426a9e749a2c00894ee1c58b68f29a9fd12a311974d178fed\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1679011200,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262277955\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 460,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tNDzhA4Akmzj11AS\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 460,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tNDyQbJacvUZiyfn\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"fc9fd60a-39ad-4f00-b938-8aa484d9c62f\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tNDyQbJacvUZiyfq\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tNDyQbJacvUZiyfo\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"fc9fd60a-39ad-4f00-b938-8aa484d9c62f\",\n \"name\": \"ord-2tNDyQbJacvUZiyfp\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx\",\n \"failure_url\": \"http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"HostedPayment\",\n \"recurrent\": false,\n \"starts_at\": 1676354400,\n \"expires_at\": 1676613599,\n \"allowed_payment_methods\": [\n \"card\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"is_redirect_on_failure\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"slug\": \"fc9fd60a39ad4f00b9388aa484d9c62f\",\n \"url\": \"https://pay.stg.conekta.io/checkout/fc9fd60a39ad4f00b9388aa484d9c62f\"\n },\n \"object\": \"order\",\n \"id\": \"ord_2tNDyQbJacvUZiyfp\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676417602,\n \"updated_at\": 1676417602,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Box of Cohiba S1s\",\n \"unit_price\": 460,\n \"quantity\": 1,\n \"object\": \"line_item\",\n \"id\": \"line_item_2tNDyQbJacvUZiyfk\",\n \"parent_id\": \"ord_2tNDyQbJacvUZiyfp\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n }\n ]\n}", + "body": "{\n \"next_page_url\": \"https://api-core.stg.conekta.io/orders?next=ord_2tNDyQbJacvUZiyfp\",\n \"has_more\": true,\n \"total\": 448,\n \"object\": \"list\",\n \"data\": [\n {\n \"livemode\": true,\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Miles_Price@gmail.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKZmA749BLsMRgBY\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUigJs3CPGFSNbZi\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUigJ8DgBhbp6w5D\",\n \"metadata\": {},\n \"is_refundable\": true,\n \"created_at\": 1678134109,\n \"updated_at\": 1678134110,\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"64064b5ddb5c8a0001cde484\",\n \"livemode\": true,\n \"created_at\": 1678134109,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"QFdozPB7caeKikDCXQebz2j1uyYKUf2s\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKZmA749BLsMRgBY\",\n \"order_id\": \"ord_2tUigJ8DgBhbp6w5D\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUhuyzqLi6UJE9Cy\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"8bf936e6-3b5c-4095-a9f3-69aca5ad7863\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUhuyzqLi6UJE9D2\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUhuyzqLi6UJE9Cz\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"8bf936e6-3b5c-4095-a9f3-69aca5ad7863\",\n \"name\": \"ord-2tUhuyzqLi6UJE9D1\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": true\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUhuyzqLi6UJE9D1\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678130628,\n \"updated_at\": 1678130628,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUhuyzqLi6UJE9Cw\",\n \"parent_id\": \"ord_2tUhuyzqLi6UJE9D1\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUhcjeepaMTxHwQ7\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"ed002df7-6b53-483f-8ac3-bc35fbbfbc10\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUhcjeepaMTxHwQA\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUhcjeepaMTxHwQ8\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"ed002df7-6b53-483f-8ac3-bc35fbbfbc10\",\n \"name\": \"ord-2tUhcjeepaMTxHwQ9\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [\n 3,\n 6,\n 12\n ],\n \"monthly_installments_enabled\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUhcjeepaMTxHwQ9\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678129273,\n \"updated_at\": 1678129273,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUhcjeepaMTxHwQ5\",\n \"parent_id\": \"ord_2tUhcjeepaMTxHwQ9\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUhcPiXmC9x512Am\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"dc45f292-4890-468b-a117-8d8e1ea5371a\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUhcPiXmC9x512Ap\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUhcPiXmC9x512An\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"dc45f292-4890-468b-a117-8d8e1ea5371a\",\n \"name\": \"ord-2tUhcPiXmC9x512Ao\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUhcPiXmC9x512Ao\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678129246,\n \"updated_at\": 1678129246,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUhcPiXmC9x512Aj\",\n \"parent_id\": \"ord_2tUhcPiXmC9x512Ao\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgccjdQJ7SdBrXZ\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"8c4e58f7-828e-48cb-960d-c12242ffa319\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgccjdQJ7SdBrXc\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgccjdQJ7SdBrXa\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"8c4e58f7-828e-48cb-960d-c12242ffa319\",\n \"name\": \"ord-2tUgccjdQJ7SdBrXb\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [\n 3,\n 6,\n 12\n ],\n \"monthly_installments_enabled\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678124707,\n \"updated_at\": 1678124707,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgccjdQJ7SdBrXX\",\n \"parent_id\": \"ord_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgQLJywuuSAaTmy\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"bc2a3674-660b-4118-b209-10fd0c7b2539\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgQM3oU7U5nr8GS\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgQLJywuuSAaTmz\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"bc2a3674-660b-4118-b209-10fd0c7b2539\",\n \"name\": \"ord-2tUgQLJywuuSAaTn1\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUgQLJywuuSAaTn1\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678123743,\n \"updated_at\": 1678123743,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgQLJywuuSAaTmw\",\n \"parent_id\": \"ord_2tUgQLJywuuSAaTn1\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgAg9rFzuNAoQ7o\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"96a87c6e-e848-4f3d-bf06-c66b1c03e5c7\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgAg9rFzuNAoQ7r\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgAg9rFzuNAoQ7p\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"96a87c6e-e848-4f3d-bf06-c66b1c03e5c7\",\n \"name\": \"ord-2tUgAg9rFzuNAoQ7q\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUgAg9rFzuNAoQ7q\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1678122669,\n \"updated_at\": 1678122669,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgAg9rFzuNAoQ7m\",\n \"parent_id\": \"ord_2tUgAg9rFzuNAoQ7q\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUg8uXxtHfCFGA21\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"e085df36-bb2d-4e8e-825e-31d713ba15a7\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUg8vGnQVDqsXpWU\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUg8uXxtHfCFGA22\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"e085df36-bb2d-4e8e-825e-31d713ba15a7\",\n \"name\": \"ord-2tUg8uXxtHfCFGA23\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678341599,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUg8uXxtHfCFGA23\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1678122531,\n \"updated_at\": 1678122531,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUg8uXxtHfCFGA1y\",\n \"parent_id\": \"ord_2tUg8uXxtHfCFGA23\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUg82bRxXpS6dNDH\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"eeb3a7d9-ceec-4bdf-8aae-2b70f5c81bb7\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUg82bRxXpS6dNDL\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUg82bRxXpS6dNDJ\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"eeb3a7d9-ceec-4bdf-8aae-2b70f5c81bb7\",\n \"name\": \"ord-2tUg82bRxXpS6dNDK\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678341599,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUg82bRxXpS6dNDK\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1678122461,\n \"updated_at\": 1678122461,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUg82bRxXpS6dNDF\",\n \"parent_id\": \"ord_2tUg82bRxXpS6dNDK\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tTirxDJEFDe8NUAL\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tTirxDJEFDe8NUAM\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tTirxDJEFDe8NUAN\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1677870662,\n \"updated_at\": 1677870662,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tTirxDJEFDe8NUAJ\",\n \"parent_id\": \"ord_2tTirxDJEFDe8NUAN\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"6402464645f9e8000165c2ca\",\n \"livemode\": true,\n \"created_at\": 1677870662,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/94e526bbd9f77af1a95130691088021ff869fbda.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MLPWLPAKO%2F20230303%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230303T191102Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEBwaCXVzLWVhc3QtMSJIMEYCIQCJcvbKD7bOSESXyn8oo%2FzfAPwgWO4m3NCWDb2gumoMZAIhAIam91DYG1qorOEkgdzBoLNsGcQEMW%2BoxcWGT0Y0IqIXKpAECMT%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQAhoMNzk5ODAxMDgxNjg4IgwOC3W4Y8gV514Fx7cq5APKrTe4Zq7AkcKI9H4NfaNt1MA7YwPFUl0JCC0jkCW1KRpmzXir9Gl8%2F6YslsKNsWhyPU7ZJH8rynf%2BENPwAf0doyCP0mT5mA7I1HaCNXW4AioVMgP2uPAVEimK16%2Br2MQ9LGNbUywuMErd8rDtpzSQ0tXyB0E9piLTh3ejASBzSsSF79KCD2eVEg24wdyUQyw1ftuwsDk24j9QpCFUyPeihzOVf3RDXtTYSWyQt4%2B1cYVodnBXErRVpO%2FPVA%2FpKe20WxZbLyBkMKU4Sb34YpFOhqVIeWr8SWB%2BueUkRuXj8jxhaMve9lNaCdRIzSZxSbhIcslWupXp6J6hPXgOSv%2BVBDxtl4geZLNACIXcTgVzLaLOUt8w2ItPULFzdtgOYaHvsQzZUlDcJFUrl1ytBOdrIvBX7qwuHOxJBQ2yQKMbH7gKFdd%2B5PGNDj5cWe%2B1plr%2FUileuMpdXLfXmQ2%2FNTgo6knbmXbaji6O%2BdS3ox3czOobhNOoqvCGdpPzyHyACYmzRP9VLnJluXZIHn3T6lEqNcGO1b%2FGdP1yeAG%2Bw%2BSWS6nspG9y33z8fdjqBFqmD%2F0Qp4fzPqrbI4G0Yc8us8xzJKw8t32Eq%2FTOvxxhOxqZTPi%2B5LiDADW8qvIO1v1SpmqKUnVVMJ2KiaAGOqQBKKpjIc7bpa6UwW1yHiHZNf7wCDnSr0bucJHkDvFTGc6wcCNzQgzCaRxp5%2FlLY68NFiqTLrjswEesap%2FQINS9y68Wz%2BvmZYEQrjSLXdDuXvckYrPzYsInCb%2BKvqS1p%2FXAhrk6c9eHYErOLJC4gTowtTWM6VH68%2B74ZSu4J1C2nxL252u5uCb2yODA5WfQ79cxPCeMmB9D0b9cJnDPqa6vf1tHHoc%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=0af1ed056b660f18c69f4ab039e46891dee21fd4a045a9201181a825f1766c05\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1680480000,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262280678\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 2000,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tTirxDJEFDe8NUAN\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"payment_status\": \"declined\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tSoWNL3A41LDVatS\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tSoWNL3A41LDVatQ\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tSoWNL3A41LDVatK\",\n \"metadata\": {},\n \"is_refundable\": true,\n \"created_at\": 1677627543,\n \"updated_at\": 1677717913,\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 5,\n \"data\": [\n {\n \"id\": \"640570cc4f47a400014847ed\",\n \"livemode\": true,\n \"created_at\": 1678078156,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"PeLn2HZJKwT9PmEuVCcPLPYN7WeYmZMf\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n },\n {\n \"id\": \"6402b1a64f47a40001483299\",\n \"livemode\": true,\n \"created_at\": 1677898150,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"Q8PhhabwTyjeKo9d1DwujHZWDkvX9y8v\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n },\n {\n \"id\": \"63fff28386af700001fff912\",\n \"livemode\": true,\n \"created_at\": 1677718147,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"ST6wUrE6WFfVg2uTHJ5AtCp4ZEGNiTLp\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n },\n {\n \"id\": \"63fff19986af700001fff900\",\n \"livemode\": true,\n \"created_at\": 1677717913,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"JMvw8DEXV5dnc7GWNru4f98VPHkM5txc\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n },\n {\n \"id\": \"63fe90977ec07c00013c91c4\",\n \"livemode\": true,\n \"created_at\": 1677627543,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"aaKEctPdNiPbk1PovzsMarfVEbQ32ExX\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoWNL3A41LDVatK\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tSoMP7bZJbLiq4zF\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tSoMP7bZJbLiq4zD\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tSoMP7bZJbLiq4z8\",\n \"metadata\": {},\n \"is_refundable\": true,\n \"created_at\": 1677626837,\n \"updated_at\": 1677626837,\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63fe8dd57ec07c00013c914d\",\n \"livemode\": true,\n \"created_at\": 1677626837,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"ZXetAuLpsAMgEMKEJRcmbmqfJt1afCTC\",\n \"payment_method\": {\n \"name\": \"erererere ererere \",\n \"exp_month\": \"06\",\n \"exp_year\": \"24\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4607\",\n \"brand\": \"mastercard\",\n \"issuer\": \"JOINT STOCK SAVINGS BANK BELARUSBANK\",\n \"account_type\": \"BUSINESS\",\n \"country\": \"BY\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"status\": \"declined\",\n \"amount\": 10000,\n \"fee\": 580,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"order_id\": \"ord_2tSoMP7bZJbLiq4z8\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 20000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"leandro.orban@conekta.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Leandro Orban\",\n \"corporate\": false,\n \"customer_id\": \"cus_2ss5YAeTKuEr5M4fD\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Mario perez\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Campeche y Morelos\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"78215\"\n },\n \"id\": \"ship_cont_2tSiWW7njfEgy4Ms5\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tSiWZ54pTVHU91pm\"\n },\n \"checkout\": {\n \"id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"name\": \"Arte en Sublimación\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"https://aortegag0501.wixsite.com/artesublimacion/success\",\n \"failure_url\": \"https://aortegag0501.wixsite.com/artesublimacion/failure\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"HostedPayment\",\n \"recurrent\": false,\n \"starts_at\": 1677564000,\n \"expires_at\": 1677823199,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [\n 3,\n 6,\n 9,\n 12\n ],\n \"monthly_installments_enabled\": true,\n \"is_redirect_on_failure\": true,\n \"redirection_time\": 10,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"slug\": \"a767fcb10b7541c796ca1083d948ce31\",\n \"url\": \"https://pay.stg.conekta.io/checkout/a767fcb10b7541c796ca1083d948ce31\"\n },\n \"object\": \"order\",\n \"id\": \"ord_2tSiWW7njfEgy4Ms6\",\n \"metadata\": {},\n \"is_refundable\": true,\n \"created_at\": 1677604774,\n \"updated_at\": 1677604774,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Vasija de Cerámica\",\n \"description\": \"Description\",\n \"unit_price\": 20000,\n \"quantity\": 1,\n \"sku\": \"SKU\",\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ],\n \"brand\": \"Brand\",\n \"object\": \"line_item\",\n \"id\": \"line_item_2tSiWW7njfEgy4Ms2\",\n \"parent_id\": \"ord_2tSiWW7njfEgy4Ms6\",\n \"metadata\": {\n \"Valor3\": \"South#23\"\n },\n \"antifraud_info\": {}\n }\n ]\n },\n \"shipping_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"amount\": 0,\n \"carrier\": \"Fedex\",\n \"method\": \"Airplane\",\n \"tracking_number\": \"TRACK000000000123\",\n \"object\": \"shipping_line\",\n \"id\": \"ship_lin_2tSiWW7njfEgy4Ms3\",\n \"parent_id\": \"ord_2tSiWW7njfEgy4Ms6\"\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 3,\n \"data\": [\n {\n \"id\": \"63fe39067033d8000169dd7a\",\n \"livemode\": true,\n \"created_at\": 1677605126,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"FIBd3eKUhff43QLEp6xZ\",\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tSib2crxT9HiVyas\"\n },\n \"payment_method\": {\n \"name\": \"Alexis Gatto\",\n \"exp_month\": \"01\",\n \"exp_year\": \"25\",\n \"object\": \"card_payment\",\n \"type\": \"debit\",\n \"last4\": \"5454\",\n \"brand\": \"mastercard\",\n \"issuer\": \"\",\n \"account_type\": \"\",\n \"country\": \"US\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"declined\",\n \"amount\": 20000,\n \"fee\": 1044,\n \"customer_id\": \"cus_2ss5YAeTKuEr5M4fD\",\n \"order_id\": \"ord_2tSiWW7njfEgy4Ms6\"\n },\n {\n \"id\": \"63fe38f97033d8000169dd6f\",\n \"livemode\": true,\n \"created_at\": 1677605113,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"FIBd3eKUhff43QLEp6xZ\",\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tSias2DBrprazMDJ\"\n },\n \"payment_method\": {\n \"name\": \"ale test\",\n \"exp_month\": \"12\",\n \"exp_year\": \"25\",\n \"object\": \"card_payment\",\n \"type\": \"debit\",\n \"last4\": \"5454\",\n \"brand\": \"mastercard\",\n \"issuer\": \"\",\n \"account_type\": \"\",\n \"country\": \"US\",\n \"fraud_indicators\": []\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"declined\",\n \"amount\": 20000,\n \"fee\": 1044,\n \"customer_id\": \"cus_2ss5YAeTKuEr5M4fD\",\n \"order_id\": \"ord_2tSiWW7njfEgy4Ms6\"\n },\n {\n \"id\": \"63fe38ef7033d8000169dd64\",\n \"livemode\": true,\n \"created_at\": 1677605103,\n \"currency\": \"MXN\",\n \"failure_code\": \"suspected_fraud\",\n \"failure_message\": \"Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso.\",\n \"device_fingerprint\": \"FIBd3eKUhff43QLEp6xZ\",\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a767fcb1-0b75-41c7-96ca-1083d948ce31\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tSiakNqW4m1xZNoP\"\n },\n \"payment_method\": {\n \"name\": \"Alexis TestVisa\",\n \"exp_month\": \"01\",\n \"exp_year\": \"25\",\n \"object\": \"card_payment\",\n \"type\": \"credit\",\n \"last4\": \"4242\",\n \"brand\": \"visa\",\n \"issuer\": \"BANAMEX\",\n \"account_type\": \"Credit\",\n \"country\": \"MX\",\n \"fraud_indicators\": [\n {\n \"description\": \"El usuario está utilizando una tarjeta de crédito o débito de prueba en modo producción.\",\n \"weight\": null,\n \"value\": null\n }\n ]\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"declined\",\n \"amount\": 20000,\n \"fee\": 116,\n \"customer_id\": \"cus_2ss5YAeTKuEr5M4fD\",\n \"order_id\": \"ord_2tSiWW7njfEgy4Ms6\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 4300,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tPAmKCEJqh8RE6nW\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tPAmKCEJqh8RE6nX\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676667267,\n \"updated_at\": 1676996351,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 3,\n \"data\": [\n {\n \"name\": \"test csharp\",\n \"description\": \"test modified\",\n \"unit_price\": 500,\n \"quantity\": 2,\n \"tags\": [\n \"Pago 2\",\n \"Pago mensualidad 2\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tQ8HkkfbauaKP9Ho\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {\n \"key\": \"value\"\n },\n \"antifraud_info\": {\n \"key\": \"value2\"\n }\n },\n {\n \"name\": \"test csharp\",\n \"description\": \"test csharp\",\n \"unit_price\": 500,\n \"quantity\": 2,\n \"object\": \"line_item\",\n \"id\": \"line_item_2tPAokCikvD2rorMf\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {\n \"key\": \"value\"\n },\n \"antifraud_info\": {\n \"key\": \"value\"\n }\n },\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tPAmKCEJqh8RE6nU\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"shipping_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"amount\": 100,\n \"carrier\": \"FEDEX\",\n \"method\": \"bus\",\n \"tracking_number\": \"track123\",\n \"object\": \"shipping_line\",\n \"id\": \"ship_lin_2tQPU5qoFZFCsQHGs\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\",\n \"metadata\": {\n \"key2\": \"value2\"\n }\n }\n ]\n },\n \"tax_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 4,\n \"data\": [\n {\n \"description\": \"test csharp2222\",\n \"amount\": 100,\n \"object\": \"tax_line\",\n \"id\": \"tax_lin_2tQ974hSHcsdeSZHG\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n },\n {\n \"description\": \"test csharp\",\n \"amount\": 100,\n \"object\": \"tax_line\",\n \"id\": \"tax_lin_2tQ95yCyWUTqsDV9b\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n },\n {\n \"description\": \"test csharp\",\n \"amount\": 100,\n \"object\": \"tax_line\",\n \"id\": \"tax_lin_2tQ94zMtR87tiRPRf\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n },\n {\n \"description\": \"test postman\",\n \"amount\": 100,\n \"object\": \"tax_line\",\n \"id\": \"tax_lin_2tQ8dC5mg1UADmVPo\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n }\n ]\n },\n \"discount_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"code\": \"1234\",\n \"amount\": 200,\n \"type\": \"loyalty\",\n \"object\": \"discount_line\",\n \"id\": \"dis_lin_2tQQ58HPgPw7StE8z\",\n \"parent_id\": \"ord_2tPAmKCEJqh8RE6nY\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tPAkpQH14jq2hDgA\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tPAkpQH14jq2hDgB\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tPAkpQH14jq2hDgC\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676667228,\n \"updated_at\": 1676667245,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 2,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad test\",\n \"description\": \"Mes de marz.\",\n \"unit_price\": 1000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago 2\",\n \"Pago mensualidad 2\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tPAm2xCrTJrfHW1K\",\n \"parent_id\": \"ord_2tPAkpQH14jq2hDgC\",\n \"metadata\": {},\n \"antifraud_info\": {}\n },\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tPAkpQH14jq2hDg8\",\n \"parent_id\": \"ord_2tPAkpQH14jq2hDgC\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tP72uE7jK7iHdFVd\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tP72uE7jK7iHdFVe\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tP72uE7jK7iHdFVf\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676650265,\n \"updated_at\": 1676650327,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tP72uE7jK7iHdFVb\",\n \"parent_id\": \"ord_2tP72uE7jK7iHdFVf\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63efa757cf65380001aec040\",\n \"livemode\": true,\n \"created_at\": 1676650327,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/9e9f39dd48fe91bef5424e64e3a3bfedc919b120.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MFEACMARD%2F20230217%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230217T161207Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEMf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCIGWtRkzuSh3mieAG8Qtont4%2Bmuqe%2B%2BvKmNJdbLv5Z3xDAiBjUMuXrcmJDneKaUAbwfKKNi%2FCxs7kgSZXIeviKdPKIyqHBAhgEAIaDDc5OTgwMTA4MTY4OCIMLJnfLVnI3fBUtD0EKuQDtNV5vIciROZNyt5VAPR2WpkDLPFU%2BfpQGyWom0W6Axhi1b8ACxSsCYGFzmnR1IrUiJ8wsaJN3Z758MqA88y6c2tHjOABgiqGGyO4njO64LCzuTYnyz2Hs3LnTG9uayqxf8lQYWoL4%2FdyXi3%2BCVXTbWvhcmQPB1o03AWLGr1hjzHuAKQPhz2HTnM85f3H5EVU5PvLY6WFVzjV5E0QWXta%2B4K%2FiSzOqWk%2BS%2FtT0KYhQ2s9RRVE3TWf4OtD8PpPKKGAicCnrqTWiXDLmbx1ZnyBtC5Qewhadi4%2BMEf9a7aLNsgYjAu197%2Fcz%2FPIYxEw2Mu%2BFBjfEmx%2FZ2qa%2BV6HUOUMylhLgfFXlbmQv049qXjkhXpNKPFigv0zl7Mk%2FhASn5gnf7Lgqpcpx6V%2Bg9kCwZ74ix%2FrdxYeilFVV%2FeYyutRnc6yEtAOTPxX03Zgrs8gO5knIhMDBymtc2wDtlYWBEDpsrxflVAxXf8gyNa3Sl9afRHjq04kehAt8TdTLBOUHJHLDHkk0ZtGS8tCO50KCYjMpqwGbibqv%2BwoiaNd3J%2Ft%2F71jlZXVyYdcXI1Z0psC1aY5vpR7%2BOCEWS7K7terNfPBdHlfqTispgCQHqMEB3nay0Sms0KAB9H5k56gswIBUlwNL2z28DCBrr6fBjqmAZrx0soBstN9%2BXgZT2S0JmuyhGzc2XKpaIDkctpITE12Ym25YDWwQYmHuYpECdjKBQ%2BzSb1RbEqlz37iyF6XGTMmh4WNNhENZ7Ie8lNQNLz8zCneeMFM%2FAaEHwbsgvEhTKykoESBX5TGyo%2Fi1YrbZvbQJ2WSFS6gVFHwoBq86Ooa3AyINUZB4boqhO0BJ1ffvtz%2BwBJSvmyMKoXv7OaED43nxW%2BvJTk%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=db0689f105fdba31a4a3ba62b2cdb8f80bbe570a737c1b8cedb65e45cbb45b91\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1679011200,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262277930\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 14,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tP72uE7jK7iHdFVf\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tNYbzzbb1zcB4gBp\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tNYbzzbb1zcB4gBq\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tNYbzzbb1zcB4gBr\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676502497,\n \"updated_at\": 1676502498,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tNYbzzbb1zcB4gBn\",\n \"parent_id\": \"ord_2tNYbzzbb1zcB4gBr\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63ed65e14044ea0001b3cf30\",\n \"livemode\": true,\n \"created_at\": 1676502497,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/5aebfcdecfc60bf3128e3d6d52d698e75c61b8fe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MO4IXAVWV%2F20230215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230215T230817Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEJ%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIGlYRndD5T2JnPk%2BWWOoI3h9nXW4F%2FQiREVp60I9GS2eAiEAkwgQwACxy%2BWsNEga5Enr4KRQLSpHXxxlhuxp3vDOE%2FsqhwQIOBACGgw3OTk4MDEwODE2ODgiDA7qNmZeph78KJO1NyrkA%2FiUSVNu7PO1rGUYmhuC18uvQv57lkPPPtQV%2B9IOA5W0RrKcxBQZRzBQwYtOZUJcv4wNrHgHv6nxj%2BaRAo3qaLv9ow29n2L7KvZeZsPMhoBd1yGyYirbY7x5Acj54dSQqiV6oBwaJLIdyFeGTMRHBYCuLC9LQv4Hs4zU%2FRSx4%2Bzp4PKDJZKMW8JS0bFO6dj1ecCATik4n3%2BOW%2BDj6T735ESVQLDETVj1XS%2BYyK1DLWsMabn0PgS%2FhIGQk%2B7vLUT2dCS0L4B6rLRYIIYkywVeoMPjSl7aVFlxBhxFRm7a2YVYPktlfNjmp6Kzg9G75LRQQyDdCD32Xs3HYOArWonEO1hFl8EhaTWyKhxOQHHq0TUo4tkAx0Kmy0ar0JLbRfIyrXdpZgjbNyGfGGW2%2BnSeONYJpj1WHBwQkDtg3oO5mrch9S83sYrz7c%2BXifku2HSdr4kucNgXqCG5Fbp%2F3qqCr4m2%2BImzbclxL1gS5rpl45OYA0AlMfIGNrET%2BlombMH3mXaoPtbsbYAXkX7xk6HqXZRJmdphVgOTWWhnt8j3M4VFwPd9rj6QrSaKZFIIpgluKVqePuLFjRgfToQ%2FBXNOVHJT8cRbSC%2BDz3Y7y%2BPsPCjEOOvQEbzT%2BhuZNMMllaAgnz%2FCGIUwwcm1nwY6pQGKbewlnXqfAU%2B5yDwJDFsgj5mtPXhh7ED9NefljsJzUH31l0kbFLkIgWPxynNLxMnZlTrecwBjTJLQEnx7Utpm51mA%2FrolACdwLpEoL6XH63RBvFs%2F%2Bc0lfc6mcP8zu4qoBA0A11aAh1uqDpQDhMGfOzQWga9EEs39kx85UlMCPxQRrh1bmsaolFKxNmUCZv5a%2BwoPtjIj3M0tiZjcJDLQ%2FQYYD78%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=7ef873dcb182b87061704afdba056da24d6707a08a1a0659d4a32aec1c06ce23\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1678838400,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262277815\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 2000,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tNYbzzbb1zcB4gBr\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tNYRWFQHBtbsCSi2\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tNYRWFQHBtbsCSi3\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tNYRWFQHBtbsCSi4\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676501672,\n \"updated_at\": 1676501673,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tNYRWFQHBtbsCShz\",\n \"parent_id\": \"ord_2tNYRWFQHBtbsCSi4\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63ed62a8b057b50001186bb0\",\n \"livemode\": true,\n \"created_at\": 1676501672,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/dbe611be7832d4b1803f6a8c0178a8eb1235fb5d.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MF5UC2Y2T%2F20230215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230215T225433Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEJ%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIBOfT4UaZyh9mY3GyrKZ8cx8C9Fzc0CXCZpKWxgnWCjuAiEA5F8Hx7cpw8UasEOl3kHcojqawwjc9MANBHS9B8g01JcqhwQIOBACGgw3OTk4MDEwODE2ODgiDAt%2BQN4aqP8pxbGWjCrkA9DXhVV%2BP0p%2FRLBXYzX9AvMgZdRIZW9bU5m8S0c2WfM26AUqVEYd4SPk3ZGbrsUEQ9Ooh5xCSFf1kH%2BYa7kRm0fOIAWoGdHc3CD6RKDNBB7TIOUxG1L25oG6ebZzZcbU0hTFuqgdbsjAjwTK1zjlSKg%2FYINtiD1uRXkemWVy71VIXx%2FCfuxn4iEGtljZBsSKnUZ14PxnSZ1lXo9IOC0HzSbHGNXwIeO5ppj2QdexIfEP%2BiKELU96nWEbIEaMYdkA%2Bz1RKYBWYU%2FxHX6Wz%2BOnsr0feqw7an8IGzMoAtKO0p8VAxTfOo4Jt222E45j8vvwASVD9rMf2r8sdqLbpQHSIOX0j1FzLQfLcKHvJCOdPhSYImr2V9vJss82onqeCfG%2FnvYKyZCUs%2BEoIw91A39sHw5oAzN1TlAcxGlHyXzAL180koX8QOCObOtPm89NVmAYvsZLahVEAP6%2BHqrnmUGWAtOC1Y3H%2FyUIB9vUnTyDhPMbx18vUdaOF2zkYwFDP7up6R%2BIzABzmYxRtokq0aFYKdOJMb0%2FK6F0rTYChcmIkowjFK%2FtXDZ84c2rtMsAEnivxyc3h59Sdd9hukxwhw3mIsIOT6UGsgraBSX9CcPZS1pEJIt6fTu2a5qA2g%2B1y6WR%2BcARkGIwmb21nwY6pQHhY2fqu3M%2Fp%2FJWgVLrZuev7%2FW1SAVYSLuh4kS79glqUItsUILIh4tladBKFksyaX0ytRmzOZ%2BdFW4nsDlbZ4eqXZP1QL0RWjVX5Jw3kc%2Bg5zTFeDTHUVUhevS9RG7xQBfO4CarswXZ5RTG2ozc213YuWTgumElbp6wcUACeIOa6IkxOHhqmuTBSJfBv48ycSNljAxSZqkxHPENX87HK5vBCUeWPOg%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=8cc6e4f8b822db762ecc409798a40024bcd61b321b0bb3e64d0bf26919378d54\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1678838400,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262277807\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 2000,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tNYRWFQHBtbsCSi4\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 460,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tNDzhA4Akmzj11AQ\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"6fca054a-8519-4c43-971e-cea35cc519bb\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tNDzhA4Akmzj11AU\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tNDzhA4Akmzj11AR\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"6fca054a-8519-4c43-971e-cea35cc519bb\",\n \"name\": \"ord-2tNDzhA4Akmzj11AS\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx\",\n \"failure_url\": \"http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"HostedPayment\",\n \"recurrent\": false,\n \"starts_at\": 1676354400,\n \"expires_at\": 1676613599,\n \"allowed_payment_methods\": [\n \"card\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"is_redirect_on_failure\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"slug\": \"6fca054a85194c43971ecea35cc519bb\",\n \"url\": \"https://pay.stg.conekta.io/checkout/6fca054a85194c43971ecea35cc519bb\"\n },\n \"object\": \"order\",\n \"id\": \"ord_2tNDzhA4Akmzj11AS\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676417703,\n \"updated_at\": 1676663383,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 460,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tNDzhA4Akmzj11AN\",\n \"parent_id\": \"ord_2tNDzhA4Akmzj11AS\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"63efda57cf65380001aec1a9\",\n \"livemode\": true,\n \"created_at\": 1676663383,\n \"currency\": \"MXN\",\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"6fca054a-8519-4c43-971e-cea35cc519bb\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tP9usmyzXMXaJc2F\"\n },\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/0f0f98272185c8060bb812ad1c790f4247360512.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MOQYX2SEM%2F20230217%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230217T194943Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEMr%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIQDzzIB7Wi7vELmx9iGedGGem1vsg%2FYnCWsECQ%2Fx%2BdQ%2FqgIgVqINLKl2CQF2OgpWBZw7bnEl5Pp6KY49%2FOQ56LM5ylYqhwQIYxACGgw3OTk4MDEwODE2ODgiDB4G%2F22RR5G7uGaExyrkA0IuptcoulAGRSziLp59vcR1%2BbSL8pY64k84b%2B%2FIgGnf1XSJek2wOALC3WbJ%2Fs1zrT6iRoJHAmQ%2B%2BtjVJgF1XxujQZiGiQVHThsePVtFVEGSZfjNWzldUaFKQLhn%2BZfls9JTb3pddbIHA%2BRQwjOJ1K8NKf7EQGn5gMMZQKaC%2FAWTlXwWnZfM2u03JVvJaioRZm3S7lnM89ICjHTxOxTk0m51Vm9ZVVARhb38w%2FPw%2F194Ah4JU7NrYai5rdkALbVP%2FAE0QYP0micI9Whj8OQDlptB53rsDzlZatcSjYK%2Frod9bzMJXv5b6dWezTCwO4ryGV24N0Q3Pmdg9U9cUOPvHVsjiq4HKx6l8Gc70WI61F77HNq0MnYXMR1ozJSHtPLTbFXZcyFGnPXbEy7t78gCnpjAPQCaMCnrWBur43mcNRG80sYPo%2FJLDD2jZ9glhzlSzSHik%2FI6ozQC13kBHL8PHVAw6OAwaSXbU%2BPI5nMtEUOOiPwQpsqcFErN8YVvHH1JqWdjNiiPTMqNNMxPRdAOcrLmGHwWDswOwhg0HMW0bKY3JjClAhSb1JxD5wNIvcZiMLxva6pMwJiQlv%2FFbLvQcN%2BMDEz3Ophf1u%2BWA8IPg08%2B29rk78AIFMotIFB7QVQ8kqacbVcw4IC%2FnwY6pQH8BNCZY%2Bp0ngsfYTZ%2BuNMr0%2B50E3HhXzQIRXajTNtNg4pAxoSHccoeEQGBGy6TTeblpCT%2Bet8unkDeOyHrqJwQLFOwj0wXdSnLEkE6iNdHBhUgSWtD5RwRcquS3VPH7v5S3zY2k2GecLxjWuhDA1Wrammgjgk4cz7XsjBBrk1e7Rte2W4gNKq1oYX4SaZBSfAV7QkFb6SYxEKgv4C5VfBmXRGAOJc%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=4a0673cb5d996dc426a9e749a2c00894ee1c58b68f29a9fd12a311974d178fed\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1679011200,\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262277955\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 460,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tNDzhA4Akmzj11AS\"\n }\n ]\n }\n },\n {\n \"livemode\": true,\n \"amount\": 460,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": true,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tNDyQbJacvUZiyfn\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"fc9fd60a-39ad-4f00-b938-8aa484d9c62f\",\n \"checkout_request_type\": \"HostedPayment\",\n \"id\": \"channel_2tNDyQbJacvUZiyfq\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tNDyQbJacvUZiyfo\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"fc9fd60a-39ad-4f00-b938-8aa484d9c62f\",\n \"name\": \"ord-2tNDyQbJacvUZiyfp\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx\",\n \"failure_url\": \"http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"HostedPayment\",\n \"recurrent\": false,\n \"starts_at\": 1676354400,\n \"expires_at\": 1676613599,\n \"allowed_payment_methods\": [\n \"card\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"is_redirect_on_failure\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"slug\": \"fc9fd60a39ad4f00b9388aa484d9c62f\",\n \"url\": \"https://pay.stg.conekta.io/checkout/fc9fd60a39ad4f00b9388aa484d9c62f\"\n },\n \"object\": \"order\",\n \"id\": \"ord_2tNDyQbJacvUZiyfp\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1676417602,\n \"updated_at\": 1676417602,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Box of Cohiba S1s\",\n \"unit_price\": 460,\n \"quantity\": 1,\n \"object\": \"line_item\",\n \"id\": \"line_item_2tNDyQbJacvUZiyfk\",\n \"parent_id\": \"ord_2tNDyQbJacvUZiyfp\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n }\n ]\n}", "latency": 0, "statusCode": 200, "label": "successful operation", @@ -4763,7 +4763,7 @@ "responses": [ { "uuid": "1369035e-186e-44e5-ae7f-362d16e2f7cf", - "body": "{\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tTirxDJEFDe8NUAL\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tTirxDJEFDe8NUAM\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"object\": \"order\",\n \"id\": \"ord_2tTirxDJEFDe8NUAN\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1677870662,\n \"updated_at\": 1677870662,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tTirxDJEFDe8NUAJ\",\n \"parent_id\": \"ord_2tTirxDJEFDe8NUAN\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"6402464645f9e8000165c2ca\",\n \"livemode\": true,\n \"created_at\": 1677870662,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/94e526bbd9f77af1a95130691088021ff869fbda.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MLPWLPAKO%2F20230303%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230303T191102Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEBwaCXVzLWVhc3QtMSJIMEYCIQCJcvbKD7bOSESXyn8oo%2FzfAPwgWO4m3NCWDb2gumoMZAIhAIam91DYG1qorOEkgdzBoLNsGcQEMW%2BoxcWGT0Y0IqIXKpAECMT%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQAhoMNzk5ODAxMDgxNjg4IgwOC3W4Y8gV514Fx7cq5APKrTe4Zq7AkcKI9H4NfaNt1MA7YwPFUl0JCC0jkCW1KRpmzXir9Gl8%2F6YslsKNsWhyPU7ZJH8rynf%2BENPwAf0doyCP0mT5mA7I1HaCNXW4AioVMgP2uPAVEimK16%2Br2MQ9LGNbUywuMErd8rDtpzSQ0tXyB0E9piLTh3ejASBzSsSF79KCD2eVEg24wdyUQyw1ftuwsDk24j9QpCFUyPeihzOVf3RDXtTYSWyQt4%2B1cYVodnBXErRVpO%2FPVA%2FpKe20WxZbLyBkMKU4Sb34YpFOhqVIeWr8SWB%2BueUkRuXj8jxhaMve9lNaCdRIzSZxSbhIcslWupXp6J6hPXgOSv%2BVBDxtl4geZLNACIXcTgVzLaLOUt8w2ItPULFzdtgOYaHvsQzZUlDcJFUrl1ytBOdrIvBX7qwuHOxJBQ2yQKMbH7gKFdd%2B5PGNDj5cWe%2B1plr%2FUileuMpdXLfXmQ2%2FNTgo6knbmXbaji6O%2BdS3ox3czOobhNOoqvCGdpPzyHyACYmzRP9VLnJluXZIHn3T6lEqNcGO1b%2FGdP1yeAG%2Bw%2BSWS6nspG9y33z8fdjqBFqmD%2F0Qp4fzPqrbI4G0Yc8us8xzJKw8t32Eq%2FTOvxxhOxqZTPi%2B5LiDADW8qvIO1v1SpmqKUnVVMJ2KiaAGOqQBKKpjIc7bpa6UwW1yHiHZNf7wCDnSr0bucJHkDvFTGc6wcCNzQgzCaRxp5%2FlLY68NFiqTLrjswEesap%2FQINS9y68Wz%2BvmZYEQrjSLXdDuXvckYrPzYsInCb%2BKvqS1p%2FXAhrk6c9eHYErOLJC4gTowtTWM6VH68%2B74ZSu4J1C2nxL252u5uCb2yODA5WfQ79cxPCeMmB9D0b9cJnDPqa6vf1tHHoc%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=0af1ed056b660f18c69f4ab039e46891dee21fd4a045a9201181a825f1766c05\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": {{body 'charges.0.payment_method.expires_at' 1683232092 }},\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262280678\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 2000,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tTirxDJEFDe8NUAN\"\n }\n ]\n }\n}", + "body": "{\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"cus_2tKcHxhTz7xU5SymF\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tTirxDJEFDe8NUAL\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0,\n \"metadata\" :{{body 'shipping_contact.metadata' }}\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tTirxDJEFDe8NUAM\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0,\n \"phone\" : \"{{body 'fiscal_entity.phone' }}\",\n \"email\" : \"{{body 'fiscal_entity.email' }}\",\n \"metadata\" :{{body 'fiscal_entity.metadata' }}\n },\n \"object\": \"order\",\n \"id\": \"ord_2tTirxDJEFDe8NUAN\",\n \"metadata\": {},\n \"is_refundable\": false,\n \"created_at\": 1677870662,\n \"updated_at\": 1677870662,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tTirxDJEFDe8NUAJ\",\n \"parent_id\": \"ord_2tTirxDJEFDe8NUAN\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n },\n \"charges\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"id\": \"6402464645f9e8000165c2ca\",\n \"livemode\": true,\n \"created_at\": 1677870662,\n \"currency\": \"MXN\",\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://pt-common-s3-stg.s3.amazonaws.com/94e526bbd9f77af1a95130691088021ff869fbda.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MLPWLPAKO%2F20230303%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230303T191102Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEBwaCXVzLWVhc3QtMSJIMEYCIQCJcvbKD7bOSESXyn8oo%2FzfAPwgWO4m3NCWDb2gumoMZAIhAIam91DYG1qorOEkgdzBoLNsGcQEMW%2BoxcWGT0Y0IqIXKpAECMT%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQAhoMNzk5ODAxMDgxNjg4IgwOC3W4Y8gV514Fx7cq5APKrTe4Zq7AkcKI9H4NfaNt1MA7YwPFUl0JCC0jkCW1KRpmzXir9Gl8%2F6YslsKNsWhyPU7ZJH8rynf%2BENPwAf0doyCP0mT5mA7I1HaCNXW4AioVMgP2uPAVEimK16%2Br2MQ9LGNbUywuMErd8rDtpzSQ0tXyB0E9piLTh3ejASBzSsSF79KCD2eVEg24wdyUQyw1ftuwsDk24j9QpCFUyPeihzOVf3RDXtTYSWyQt4%2B1cYVodnBXErRVpO%2FPVA%2FpKe20WxZbLyBkMKU4Sb34YpFOhqVIeWr8SWB%2BueUkRuXj8jxhaMve9lNaCdRIzSZxSbhIcslWupXp6J6hPXgOSv%2BVBDxtl4geZLNACIXcTgVzLaLOUt8w2ItPULFzdtgOYaHvsQzZUlDcJFUrl1ytBOdrIvBX7qwuHOxJBQ2yQKMbH7gKFdd%2B5PGNDj5cWe%2B1plr%2FUileuMpdXLfXmQ2%2FNTgo6knbmXbaji6O%2BdS3ox3czOobhNOoqvCGdpPzyHyACYmzRP9VLnJluXZIHn3T6lEqNcGO1b%2FGdP1yeAG%2Bw%2BSWS6nspG9y33z8fdjqBFqmD%2F0Qp4fzPqrbI4G0Yc8us8xzJKw8t32Eq%2FTOvxxhOxqZTPi%2B5LiDADW8qvIO1v1SpmqKUnVVMJ2KiaAGOqQBKKpjIc7bpa6UwW1yHiHZNf7wCDnSr0bucJHkDvFTGc6wcCNzQgzCaRxp5%2FlLY68NFiqTLrjswEesap%2FQINS9y68Wz%2BvmZYEQrjSLXdDuXvckYrPzYsInCb%2BKvqS1p%2FXAhrk6c9eHYErOLJC4gTowtTWM6VH68%2B74ZSu4J1C2nxL252u5uCb2yODA5WfQ79cxPCeMmB9D0b9cJnDPqa6vf1tHHoc%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=0af1ed056b660f18c69f4ab039e46891dee21fd4a045a9201181a825f1766c05\",\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": {{body 'charges.0.payment_method.expires_at' 1683232092 }},\n \"store_name\": \"OXXO\",\n \"reference\": \"93000262280678\"\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"status\": \"pending_payment\",\n \"amount\": 2000,\n \"fee\": 1160,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tTirxDJEFDe8NUAN\"\n }\n ]\n }\n}", "latency": 0, "statusCode": 200, "label": "successful operation cash", @@ -4798,9 +4798,46 @@ "fallbackTo404": false, "default": true }, + { + "uuid": "c7d5553c-0f1f-4155-9736-ee0af588dd0e", + "body": "{\n \"livemode\": false,\n \"amount\": 5539,\n \"currency\": \"MXN\",\n \"payment_status\": \"pending_payment\",\n \"amount_refunded\": 0,\n \"split_payment\": null,\n \"customer_info\": {\n \"email\": \"daniela.rodriguez@conekta.com\",\n \"phone\": \"52000000000\",\n \"name\": \"daniela rodriguez\",\n \"corporate\": false,\n \"customer_id\": \"cus_2v4G1Zx9wRpN5vyy2\",\n \"object\": \"customer_info\",\n \"customer_custom_reference\": null\n },\n \"shipping_contact\": {\n \"receiver\": \"fcarrero ca\",\n \"phone\": \"3143159054\",\n \"between_streets\": null,\n \"address\": {\n \"street1\": \"av siempre viva\",\n \"street2\": null,\n \"city\": \"cdmx\",\n \"state\": \"BCN\",\n \"country\": \"mx\",\n \"residential\": null,\n \"object\": \"shipping_address\",\n \"postal_code\": \"11011\"\n },\n \"id\": \"ship_cont_2v4bXXEfZEfjDNcjb\",\n \"object\": \"shipping_contact\",\n \"created_at\": 1702415725,\n \"metadata\": {\n \"save\": true\n }\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a9b6ea04-d405-4a58-b299-f985aefef006\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2v4bXXEfZEfjDNcjt\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"29734234\",\n \"address\": {\n \"street1\": \"av siempre viva\",\n \"street2\": null,\n \"internal_number\": null,\n \"external_number\": \"123\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"BCN\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"11011\"\n },\n \"id\": \"fis_ent_2v4bXXEfZEfjDNcjc\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 1702415725,\n \"name\": \"fcarrero ca\",\n \"phone\": \"3143159054\",\n \"email\": \"m@gmail.com\",\n \"metadata\": {\n \"phone\": \"3143159054\",\n \"receiver\": \"fcarrero ca\",\n \"email\": \"m@gmail.com\",\n \"state\": \"BCN\"\n }\n },\n \"next_action\": {\n \"redirect_to_url\": {\n \"url\": \"https://3ds-pay.conekta.com/a9b6ea04-d405-4a58-b299-f985aefef006\",\n \"return_url\": \"{{body 'return_url'}}\"\n },\n \"type\": \"redirect_to_url\"\n },\n \"object\": \"order\",\n \"id\": \"ord_2v4bXXEfZEfjDNcjd\",\n \"metadata\": {\n \"magento_version\": \"2.4.6-p2\",\n \"plugin\": \"Magento\",\n \"plugin_conekta_version\": \"5.1.0\",\n \"quote_id\": \"3\",\n \"store\": 1,\n \"is_customer_guest\": true\n },\n \"is_refundable\": false,\n \"processing_mode\": null,\n \"created_at\": 1702415725,\n \"updated_at\": 1702415725,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Deirdre RelaxedFit Capri29Green\",\n \"description\": \"Deirdre RelaxedFit Capri29Green WP1229Green\",\n \"unit_price\": 5040,\n \"quantity\": 1,\n \"sku\": \"WSH07-29-Purple\",\n \"tags\": [\n \"simple\"\n ],\n \"brand\": null,\n \"type\": null,\n \"object\": \"line_item\",\n \"id\": \"line_item_2v4bXXEfZEfjDNcjV\",\n \"parent_id\": \"ord_2v4bXXEfZEfjDNcjd\",\n \"metadata\": {\n \"product_id\": \"1895\"\n },\n \"antifraud_info\": {}\n }\n ]\n },\n \"shipping_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"amount\": 500,\n \"carrier\": \"Flat Rate - Fixed\",\n \"method\": \"flatrate_flatrate\",\n \"tracking_number\": null,\n \"object\": \"shipping_line\",\n \"id\": \"ship_lin_2v4bXXEfZEfjDNcjW\",\n \"parent_id\": \"ord_2v4bXXEfZEfjDNcjd\",\n \"metadata\": null\n }\n ]\n },\n \"tax_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"description\": \"Tax\",\n \"amount\": 0,\n \"object\": \"tax_line\",\n \"id\": \"tax_lin_2v4bXXEfZEfjDNcjX\",\n \"parent_id\": \"ord_2v4bXXEfZEfjDNcjd\",\n \"metadata\": null\n }\n ]\n },\n \"discount_lines\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 2,\n \"data\": [\n {\n \"code\": \"h21\",\n \"amount\": 0,\n \"type\": \"coupon\",\n \"object\": \"discount_line\",\n \"id\": \"dis_lin_2v4bXXEfZEfjDNcjZ\",\n \"parent_id\": \"ord_2v4bXXEfZEfjDNcjd\"\n },\n {\n \"code\": \"campaign\",\n \"amount\": 1,\n \"type\": \"campaign\",\n \"object\": \"discount_line\",\n \"id\": \"dis_lin_2v4bXXEfZEfjDNcjY\",\n \"parent_id\": \"ord_2v4bXXEfZEfjDNcjd\"\n }\n ]\n },\n \"charges\": null\n}", + "latency": 0, + "statusCode": 200, + "label": "successful operation with 3ds", + "headers": [ + { + "key": "Content-Type", + "value": "application/vnd.conekta-v2.1.0+json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [ + { + "target": "body", + "modifier": "customer_info.customer_id", + "value": "cus_2v4G1Zx9wRpN5vyy2", + "invert": false, + "operator": "equals" + }, + { + "target": "body", + "modifier": "three_ds_mode", + "value": "smart", + "invert": false, + "operator": "equals" + } + ], + "rulesOperator": "AND", + "disableTemplating": false, + "fallbackTo404": false, + "default": false + }, { "uuid": "84073a91-8300-4ea6-9ebe-4a44a54fac9f", - "body": "{\n \"livemode\": true,\n \"amount\": 35000,\n \"currency\": \"{{body 'currency' }}\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"{{body 'customer_info.customer_id' }}\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgAg9rFzuNAoQ7o\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"96a87c6e-e848-4f3d-bf06-c66b1c03e5c7\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgAg9rFzuNAoQ7r\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgAg9rFzuNAoQ7p\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"96a87c6e-e848-4f3d-bf06-c66b1c03e5c7\",\n \"name\": \"ord-2tUgAg9rFzuNAoQ7q\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": {{body 'checkout.expires_at' }},\n \"allowed_payment_methods\": {{body 'checkout.allowed_payment_methods' }},\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUgAg9rFzuNAoQ7q\",\n \"metadata\": {{body 'metadata' }},\n \"is_refundable\": false,\n \"created_at\": 1678122669,\n \"updated_at\": 1678122669,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgAg9rFzuNAoQ7m\",\n \"parent_id\": \"ord_2tUgAg9rFzuNAoQ7q\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n}", + "body": "{\n \"livemode\": true,\n \"amount\": 35000,\n \"currency\": \"{{body 'currency' }}\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"Alec_Fay59@yahoo.com\",\n \"phone\": \"+5215555555555\",\n \"name\": \"Elio Rincon\",\n \"corporate\": false,\n \"customer_id\": \"{{body 'customer_info.customer_id' }}\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgAg9rFzuNAoQ7o\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"96a87c6e-e848-4f3d-bf06-c66b1c03e5c7\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgAg9rFzuNAoQ7r\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgAg9rFzuNAoQ7p\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"96a87c6e-e848-4f3d-bf06-c66b1c03e5c7\",\n \"name\": \"ord-2tUgAg9rFzuNAoQ7q\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": {{body 'checkout.expires_at' }},\n \"allowed_payment_methods\": {{body 'checkout.allowed_payment_methods' }},\n \"redirection_time\": {{body 'checkout.redirection_time' 10 }},\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [],\n \"monthly_installments_enabled\": false,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_2tUgAg9rFzuNAoQ7q\",\n \"metadata\": {{body 'metadata' }},\n \"is_refundable\": false,\n \"created_at\": 1678122669,\n \"updated_at\": 1678122669,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgAg9rFzuNAoQ7m\",\n \"parent_id\": \"ord_2tUgAg9rFzuNAoQ7q\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n}", "latency": 0, "statusCode": 200, "label": "successful operation with checkout", @@ -4837,7 +4874,7 @@ }, { "uuid": "887b02eb-45f2-40f3-bb61-717b90c395b8", - "body": "{\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"email@yahoo.com\",\n \"phone\": \"+57314314\",\n \"name\": \"Elio Rincon msi\",\n \"corporate\": false,\n \"customer_id\": \"cus_msi_2o8jK3TDtejmz1sYd\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgccjdQJ7SdBrXZ\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"8c4e58f7-828e-48cb-960d-c12242ffa319\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgccjdQJ7SdBrXc\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgccjdQJ7SdBrXa\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"{{faker 'datatype.uuid'}}\",\n \"name\": \"ord-2tUgccjdQJ7SdBrXb\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [\n 3,\n 6,\n 12\n ],\n \"monthly_installments_enabled\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_msi_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678124707,\n \"updated_at\": 1678124707,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgccjdQJ7SdBrXX\",\n \"parent_id\": \"ord_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n}", + "body": "{\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"email@yahoo.com\",\n \"phone\": \"+57314314\",\n \"name\": \"Elio Rincon msi\",\n \"corporate\": false,\n \"customer_id\": \"cus_msi_2o8jK3TDtejmz1sYd\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgccjdQJ7SdBrXZ\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"8c4e58f7-828e-48cb-960d-c12242ffa319\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgccjdQJ7SdBrXc\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgccjdQJ7SdBrXa\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"{{faker 'datatype.uuid'}}\",\n \"name\": \"ord-2tUgccjdQJ7SdBrXb\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [\n 3,\n 6,\n 12\n ],\n \"redirection_time\": {{body 'checkout.redirection_time' 10 }},\n \"monthly_installments_enabled\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_msi_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678124707,\n \"updated_at\": 1678124707,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgccjdQJ7SdBrXX\",\n \"parent_id\": \"ord_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n}", "latency": 0, "statusCode": 200, "label": "successful operation with checkout MSI", @@ -5430,6 +5467,40 @@ "fallbackTo404": false, "default": true }, + { + "uuid": "36e3869f-d275-4476-bac6-51895af75e86", + "body": "{\n\t\"amount\": 58000,\n\t\"channel\": {\n\t\t\"checkout_request_id\": \"96fdd3ed-aeea-4a33-a788-e0d4bcd5b148\",\n\t\t\"checkout_request_type\": \"Integration\",\n\t\t\"id\": \"channel_2uiGPUL1WAuroL6bW\",\n\t\t\"segment\": \"Checkout\"\n\t},\n\t\"created_at\": 1697042821,\n\t\"currency\": \"MXN\",\n\t\"customer_custom_reference\": null,\n\t\"customer_id\": \"cus_2uiGPGUfaNSD6KzML\",\n\t\"description\": \"Payment from order\",\n\t\"device_fingerprint\": \"f4b1205f5ee91ae7b3bb995d074d4708\",\n\t\"failure_code\": null,\n\t\"failure_message\": null,\n\t\"id\": \"6526d18547171200170c9b77\",\n\t\"is_refundable\": true,\n\t\"livemode\": false,\n\t\"monthly_installments\": 3,\n\t\"object\": \"charge\",\n\t\"order_id\": \"ord_2uiGPHDV6Zzribeqy\",\n\t\"paid_at\": 1697042821,\n\t\"payment_method\": {\n\t\t\"account_type\": \"BANAMEX\",\n\t\t\"auth_code\": \"451754\",\n\t\t\"brand\": \"visa\",\n\t\t\"contract_id\": null,\n\t\t\"country\": \"MX\",\n\t\t\"exp_month\": \"11\",\n\t\t\"exp_year\": \"26\",\n\t\t\"fraud_indicators\": [],\n\t\t\"fraud_score\": null,\n\t\t\"issuer\": \"banamex\",\n\t\t\"last4\": \"4242\",\n\t\t\"name\": \"fran car\",\n\t\t\"normalized_device_fingerprint\": null,\n\t\t\"object\": \"card_payment\",\n\t\t\"token_id\": \"tok_2uiGPSp8sAKHidCV3\",\n\t\t\"type\": \"credit\"\n\t},\n\t\"reference_id\": null,\n\t\"refunds\": null,\n\t\"status\": \"paid\"\n}", + "latency": 0, + "statusCode": 200, + "label": "successful card with monthly installments", + "headers": [ + { + "key": "Content-Type", + "value": "application/vnd.conekta-v2.1.0+json" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [ + { + "target": "params", + "modifier": "id", + "value": "ord_2uiGPHDV6Zzribeqy", + "invert": false, + "operator": "equals" + } + ], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": false + }, { "uuid": "fa095f68-aaf4-4340-aa07-6b06c6cc1492", "body": "{\n \"id\": \"6408c87bde4b8e00010744e3\",\n \"livemode\": true,\n \"created_at\": 1678297211,\n \"currency\": \"MXN\",\n \"failure_code\": null,\n \"failure_message\": null,\n \"monthly_installments\": null,\n \"device_fingerprint\": null,\n \"channel\": null,\n \"payment_method\": {\n \"clabe\": \"646180111805035472\",\n \"bank\": \"STP\",\n \"issuing_account_holder_name\": null,\n \"issuing_account_tax_id\": null,\n \"issuing_account_bank\": null,\n \"issuing_account_number\": null,\n \"receiving_account_holder_name\": null,\n \"receiving_account_tax_id\": null,\n \"receiving_account_number\": \"646180111805035472\",\n \"receiving_account_bank\": \"STP\",\n \"reference_number\": null,\n \"description\": null,\n \"tracking_code\": null,\n \"executed_at\": null,\n \"payment_attempts\": [],\n \"object\": \"bank_transfer_payment\",\n \"type\": \"spei\",\n \"expires_at\": 1686057163\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"reference_id\": null,\n \"status\": \"pending_payment\",\n \"amount\": {{body 'amount' }},\n \"paid_at\": null,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2tVLUFrQBB4HKz1zj\",\n \"refunds\": null\n}", @@ -10758,7 +10829,7 @@ "uuid": "d29ebe75-bf8a-4181-b92b-7c7d840efcdd", "documentation": "", "method": "get", - "endpoint": "balances", + "endpoint": "balance", "responses": [ { "uuid": "26b41b2d-37da-4dcb-ba62-d8c8a572816b", @@ -10954,6 +11025,297 @@ ], "enabled": true, "responseMode": null + }, + { + "uuid": "1b06f728-1985-4bc0-98a4-664ad6e7e604", + "documentation": "", + "method": "put", + "endpoint": "charges/:id", + "responses": [ + { + "uuid": "ceb8a957-94d3-4e37-839d-ceb7667788e5", + "body": "{\n \"details\": [\n {\n \"debug_message\": \"There was a runtime error and Conekta engineers have been notified.\",\n \"message\": \"There was a runtime error and Conekta engineers have been notified.\",\n \"param\": null,\n \"code\": \"conekta.errors.api.system.general_failure\"\n }\n ],\n \"object\": \"error\",\n \"type\": \"api_error\",\n \"log_id\": \"641b6f2b3cd9a50001515098\"\n}", + "latency": 0, + "statusCode": 500, + "label": "", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true + }, + { + "uuid": "747ace24-85ec-41f3-8e94-63a0b8814bfd", + "body": "{\n \"id\": \"6524722f28c7ba0016a5b17d\",\n \"livemode\": false,\n \"created_at\": 1696887343,\n \"currency\": \"MXN\",\n \"failure_code\": null,\n \"failure_message\": null,\n \"monthly_installments\": null,\n \"device_fingerprint\": null,\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"a4667424-f560-445a-bdbd-eb84f4ddbc0a\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2uhgGSQPPRmfW6UVB\"\n },\n \"payment_method\": {\n \"service_name\": \"OxxoPay\",\n \"barcode_url\": \"https://barcodes.conekta.com/sandbox_reference.png\",\n \"store\": null,\n \"auth_code\": null,\n \"object\": \"cash_payment\",\n \"type\": \"oxxo\",\n \"expires_at\": 1697060127,\n \"store_name\": \"OXXO\",\n \"reference\": \"98000017167159\",\n \"cashier_id\": null\n },\n \"object\": \"charge\",\n \"description\": \"Payment from order\",\n \"is_refundable\": true,\n \"reference_id\": \"{{body 'reference_id' }}\",\n \"status\": \"paid\",\n \"amount\": 18204,\n \"paid_at\": 1696887374,\n \"customer_id\": \"\",\n \"order_id\": \"ord_2uhgGEX62MnVuaKLS\",\n \"refunds\": null\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [ + { + "target": "params", + "modifier": "id", + "value": "6524722f28c7ba0016a5b17d", + "invert": false, + "operator": "equals" + } + ], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": false + } + ], + "enabled": true, + "responseMode": null + }, + { + "uuid": "3e017e41-4d6d-4490-8c66-c859706bd6eb", + "documentation": "payout_orders", + "method": "get", + "endpoint": "payout_orders/:id", + "responses": [ + { + "uuid": "0f0cea2a-ff1d-4bc0-b28c-88cec65b0ccf", + "body": "{\n \"details\": [\n {\n \"debug_message\": \"There was an issue while trying to process the request. (El payout order f2654d66-d740-457a-9a8c-f96b5196f441 o el entity_id f761dc6f-ba3d-4177-9788-cb7caf103463 no fue encontrado.)\",\n \"message\": \"Hubo un problema al procesar la petición. (El payout order f2654d66-d740-457a-9a8c-f96b5196f441 o el entity_id f761dc6f-ba3d-4177-9788-cb7caf103463 no fue encontrado.)\",\n \"param\": null,\n \"code\": \"conekta.errors.processing.payout.general\"\n }\n ],\n \"object\": \"error\",\n \"type\": \"processing_error\",\n \"log_id\": \"65ef546dbd3d850001a402b5\"\n}", + "latency": 0, + "statusCode": 402, + "label": "", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true + }, + { + "uuid": "cd19a401-4442-4d9e-92bf-3f0753d42de5", + "body": "{\n \"id\": \"f2654d66-d740-457a-9a8c-f96b5196f44e\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"livemode\": true,\n \"created_at\": 1710172680,\n \"updated_at\": 1710172680,\n \"customer_info\": {\n \"id\": \"cus_2vXfQGMFcf2uopcFt\",\n \"name\": \"Juanito José\",\n \"email\": \"declinado@conekta.com\",\n \"phone\": \"5556581111\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1710345479,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vZwsRAhhGp2dFDJx\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"f2654d66-d740-457a-9a8c-f96b5196f44e\",\n \"livemode\": true,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1710345479\n }\n ]\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [ + { + "target": "params", + "modifier": "id", + "value": "f2654d66-d740-457a-9a8c-f96b5196f44e", + "invert": false, + "operator": "equals" + }, + { + "target": "header", + "modifier": "Authorization", + "value": "", + "invert": true, + "operator": "null" + } + ], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": false + } + ], + "enabled": true, + "responseMode": null + }, + { + "uuid": "b9656029-f0c2-4920-bc41-13f88a091f4a", + "documentation": "", + "method": "get", + "endpoint": "payout_orders", + "responses": [ + { + "uuid": "e619e78e-8f73-4d27-ac2c-62190924c3dd", + "body": "{\n \"next_page_url\": null,\n \"previous_page_url\": null,\n \"has_more\": false,\n \"object\": \"list\",\n \"data\": []\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true + }, + { + "uuid": "48c1e752-24ab-4eee-af57-256e41e638d7", + "body": "{\n \"next_page_url\": null,\n \"previous_page_url\": null,\n \"has_more\": false,\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"f2654d66-d740-457a-9a8c-f96b5196f44e\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1710172680,\n \"updated_at\": 1710172680,\n \"customer_info\": {\n \"id\": \"cus_2vXfQGMFcf2uopcFt\",\n \"name\": \"Juanito José\",\n \"email\": \"declinado@conekta.com\",\n \"phone\": \"5556581111\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1710345479,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vZwsRAhhGp2dFDJx\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"f2654d66-d740-457a-9a8c-f96b5196f44e\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1710345479\n }\n ]\n },\n {\n \"id\": \"eb5d55e8-8bd9-4cfb-941c-a034e735059c\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"JENKINS TEST\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1686338764,\n \"updated_at\": 1686338764,\n \"customer_info\": {\n \"id\": \"cus_2u1mGocBoEYtuxQWB\",\n \"name\": \"Mateo\",\n \"email\": \"Andrs_Bustos@corpfolder.com\",\n \"phone\": \"5555555555\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1686511564,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2u1mGpM1KS7YYE4zf\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"eb5d55e8-8bd9-4cfb-941c-a034e735059c\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1686511564\n }\n ]\n },\n {\n \"id\": \"eb2879d3-e562-40f2-b55c-6c1b48ac5025\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1710172646,\n \"updated_at\": 1710172646,\n \"customer_info\": {\n \"id\": \"cus_2vE4xnYczpRRVPKfU\",\n \"name\": \"ans\",\n \"email\": \"sns@gmail.com\",\n \"phone\": null\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1710345445,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vZwrz4qzVfyN4eeq\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"eb2879d3-e562-40f2-b55c-6c1b48ac5025\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1710345445\n }\n ]\n },\n {\n \"id\": \"bba17c47-4e9d-4815-aa12-0549ef9f73a6\",\n \"amount\": 3000,\n \"currency\": \"\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"JENKINS TEST\",\n \"reference\": \"1025547797000139\",\n \"livemode\": true,\n \"created_at\": 1686339364,\n \"updated_at\": 1686512212,\n \"customer_info\": {\n \"id\": \"cus_2u1mQRpxgejUViuze\",\n \"name\": \"Julio César\",\n \"email\": \"Manuela26@gmail.com\",\n \"phone\": \"5555555555\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": -62135596800,\n \"metadata\": {},\n \"status\": \"expired\",\n \"payouts\": [\n {\n \"id\": \"payout_2u1mQTJbj3rmkGEyY\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"bba17c47-4e9d-4815-aa12-0549ef9f73a6\",\n \"livemode\": true,\n \"fee\": 84,\n \"status\": \"expired\",\n \"object\": \"payout\",\n \"expires_at\": 1686512163\n }\n ]\n },\n {\n \"id\": \"a2a1732a-4f0c-4fda-9dc7-efeec9be044b\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1706810746,\n \"updated_at\": 1706810746,\n \"customer_info\": {\n \"id\": \"cus_2vE4xnYczpRRVPKfU\",\n \"name\": \"ans\",\n \"email\": \"sns@gmail.com\",\n \"phone\": null\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1706983546,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vME4PZPvj2ktQe5B\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"a2a1732a-4f0c-4fda-9dc7-efeec9be044b\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1706983546\n }\n ]\n },\n {\n \"id\": \"8e37ccfd-0501-450c-9515-252c9855dd2c\",\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo 2\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1710173628,\n \"updated_at\": 1710173628,\n \"customer_info\": {\n \"id\": \"cus_2vXfQGMFcf2uopcFt\",\n \"name\": \"Juanito José\",\n \"email\": \"declinado@conekta.com\",\n \"phone\": \"5556581111\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1710346428,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vZx5V3RJGT1TGLDm\",\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"8e37ccfd-0501-450c-9515-252c9855dd2c\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1710346428\n }\n ]\n },\n {\n \"id\": \"7538f4e6-a2ee-4dac-90ab-e1c11118bcf4\",\n \"amount\": 1,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1710173309,\n \"updated_at\": 1710173309,\n \"customer_info\": {\n \"id\": \"cus_2vXfQGMFcf2uopcFt\",\n \"name\": \"Juanito José\",\n \"email\": \"declinado@conekta.com\",\n \"phone\": \"5556581111\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1710346108,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vZx1RY4Cft4y7dwX\",\n \"amount\": 1,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"7538f4e6-a2ee-4dac-90ab-e1c11118bcf4\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1710346108\n }\n ]\n },\n {\n \"id\": \"6cbaa90c-a925-42c5-adfa-dddb03e64e0b\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1706810724,\n \"updated_at\": 1706810724,\n \"customer_info\": {\n \"id\": \"cus_2vE4xnYczpRRVPKfU\",\n \"name\": \"ans\",\n \"email\": \"sns@gmail.com\",\n \"phone\": null\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1706983524,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vME47KNULeV8U3Hy\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"6cbaa90c-a925-42c5-adfa-dddb03e64e0b\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1706983524\n }\n ]\n },\n {\n \"id\": \"6afa4e58-d9ac-44b6-bb27-abc763708f11\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"JENKINS TEST\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1686338766,\n \"updated_at\": 1686338766,\n \"customer_info\": {\n \"id\": \"cus_2u1mGq5pqdgCAVjVA\",\n \"name\": \"Soledad\",\n \"email\": \"Manuela.Barrientos65@gmail.com\",\n \"phone\": \"5555555555\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1686511566,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2u1mGqpeMqEqnmPye\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"6afa4e58-d9ac-44b6-bb27-abc763708f11\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1686511566\n }\n ]\n },\n {\n \"id\": \"55f1d221-8a8b-4a89-b143-2eb974413889\",\n \"amount\": 100,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1710173317,\n \"updated_at\": 1710173317,\n \"customer_info\": {\n \"id\": \"cus_2vXfQGMFcf2uopcFt\",\n \"name\": \"Juanito José\",\n \"email\": \"declinado@conekta.com\",\n \"phone\": \"5556581111\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1710346117,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vZx1XScNGPFyGwrv\",\n \"amount\": 100,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"55f1d221-8a8b-4a89-b143-2eb974413889\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1710346117\n }\n ]\n },\n {\n \"id\": \"3989137f-7c5d-4627-9fe3-36f6e35ce7f6\",\n \"amount\": 300,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1706810740,\n \"updated_at\": 1706810740,\n \"customer_info\": {\n \"id\": \"cus_2vE4xnYczpRRVPKfU\",\n \"name\": \"ans\",\n \"email\": \"sns@gmail.com\",\n \"phone\": null\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1706983540,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vME4K8UoXes8nf8f\",\n \"amount\": 300,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"3989137f-7c5d-4627-9fe3-36f6e35ce7f6\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1706983540\n }\n ]\n },\n {\n \"id\": \"29ac2ca4-be32-4e12-bfe3-cb50b4888ce4\",\n \"amount\": 3000,\n \"currency\": \"\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"JENKINS TEST\",\n \"reference\": \"1025542685000135\",\n \"livemode\": true,\n \"created_at\": 1686339361,\n \"updated_at\": 1686512212,\n \"customer_info\": {\n \"id\": \"cus_2u1mQQMKeFcBFBb1f\",\n \"name\": \"Eduardo\",\n \"email\": \"Antonia_Cardona48@nearbpo.com\",\n \"phone\": \"5555555555\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": -62135596800,\n \"metadata\": {},\n \"status\": \"expired\",\n \"payouts\": [\n {\n \"id\": \"payout_2u1mQR69ATApsTFW9\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"29ac2ca4-be32-4e12-bfe3-cb50b4888ce4\",\n \"livemode\": true,\n \"fee\": 84,\n \"status\": \"expired\",\n \"object\": \"payout\",\n \"expires_at\": 1686512161\n }\n ]\n },\n {\n \"id\": \"15f89482-e01e-425f-a7a3-e7ff376d4761\",\n \"amount\": 1000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1710173321,\n \"updated_at\": 1710173321,\n \"customer_info\": {\n \"id\": \"cus_2vXfQGMFcf2uopcFt\",\n \"name\": \"Juanito José\",\n \"email\": \"declinado@conekta.com\",\n \"phone\": \"5556581111\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1710346121,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vZx1aPtT4drUMbpc\",\n \"amount\": 1000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"15f89482-e01e-425f-a7a3-e7ff376d4761\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1710346121\n }\n ]\n },\n {\n \"id\": \"0121592e-8c70-4b25-97d7-ea551afc74f4\",\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"reference\": null,\n \"livemode\": true,\n \"created_at\": 1710173328,\n \"updated_at\": 1710173328,\n \"customer_info\": {\n \"id\": \"cus_2vXfQGMFcf2uopcFt\",\n \"name\": \"Juanito José\",\n \"email\": \"declinado@conekta.com\",\n \"phone\": \"5556581111\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1710346128,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vZx1fZd6TaPrFFFY\",\n \"amount\": 10000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"0121592e-8c70-4b25-97d7-ea551afc74f4\",\n \"livemode\": true,\n \"fee\": null,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1710346128\n }\n ]\n }\n ]\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [ + { + "target": "header", + "modifier": "Accept-Language", + "value": "es", + "invert": false, + "operator": "equals" + } + ], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": false + } + ], + "enabled": true, + "responseMode": null + }, + { + "uuid": "503ef689-df8a-4330-bbaf-ea07eb343ea6", + "documentation": "create payout_orders", + "method": "post", + "endpoint": "payout_orders", + "responses": [ + { + "uuid": "f919d23d-6fcc-4a76-8dc3-942a3ce094f6", + "body": "{}", + "latency": 0, + "statusCode": 500, + "label": "", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true + }, + { + "uuid": "c35a08a1-9c11-4bb7-8866-f42f31ea82dd", + "body": "{\n \"id\": \"a2a1732a-4f0c-4fda-9dc7-efeec9be044b\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"allowed_payout_methods\": [\n \"cashout\"\n ],\n \"reason\": \"Referencia de retiro en efectivo\",\n \"livemode\": true,\n \"created_at\": 1706810746,\n \"updated_at\": 1706810746,\n \"customer_info\": {\n \"id\": \"cus_2vE4xnYczpRRVPKfU\",\n \"name\": \"ans\",\n \"email\": \"sns@gmail.com\"\n },\n \"object\": \"payout_order\",\n \"expires_at\": 1706983546,\n \"metadata\": {\n \"custom_client_id\": \"12345\"\n },\n \"status\": \"open\",\n \"payouts\": [\n {\n \"id\": \"payout_2vME4PZPvj2ktQe5B\",\n \"amount\": 3000,\n \"currency\": \"MXN\",\n \"payout_order_id\": \"a2a1732a-4f0c-4fda-9dc7-efeec9be044b\",\n \"livemode\": true,\n \"status\": \"open\",\n \"object\": \"payout\",\n \"expires_at\": 1706983546\n }\n ]\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [ + { + "target": "body", + "modifier": "amount", + "value": "3000", + "invert": false, + "operator": "equals" + } + ], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": false + } + ], + "enabled": true, + "responseMode": null + }, + { + "uuid": "ffacf12e-1faa-4076-9368-bf9b64665963", + "documentation": "", + "method": "post", + "endpoint": "orders", + "responses": [ + { + "uuid": "f18efd90-5c4f-48da-b2e8-de9e5369721d", + "body": "{\n \"livemode\": true,\n \"amount\": 2000,\n \"currency\": \"MXN\",\n \"amount_refunded\": 0,\n \"customer_info\": {\n \"email\": \"email@yahoo.com\",\n \"phone\": \"+57314314\",\n \"name\": \"Elio Rincon msi\",\n \"corporate\": false,\n \"customer_id\": \"cus_msi_2o8jK3TDtejmz1sYd\",\n \"object\": \"customer_info\"\n },\n \"shipping_contact\": {\n \"receiver\": \"Marvin Fuller\",\n \"phone\": \"+5215555555555\",\n \"between_streets\": \"Morelos Campeche\",\n \"address\": {\n \"street1\": \"Nuevo Leon 4\",\n \"street2\": \"fake street\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"residential\": true,\n \"object\": \"shipping_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"ship_cont_2tUgccjdQJ7SdBrXZ\",\n \"object\": \"shipping_contact\",\n \"created_at\": 0\n },\n \"channel\": {\n \"segment\": \"Checkout\",\n \"checkout_request_id\": \"8c4e58f7-828e-48cb-960d-c12242ffa319\",\n \"checkout_request_type\": \"Integration\",\n \"id\": \"channel_2tUgccjdQJ7SdBrXc\"\n },\n \"fiscal_entity\": {\n \"tax_id\": \"324234234\",\n \"address\": {\n \"street1\": \"avenida siempre viva\",\n \"street2\": \"fake street\",\n \"external_number\": \"string\",\n \"city\": \"Ciudad de Mexico\",\n \"state\": \"Ciudad de Mexico\",\n \"country\": \"mx\",\n \"object\": \"fiscal_entity_address\",\n \"postal_code\": \"06100\"\n },\n \"id\": \"fis_ent_2tUgccjdQJ7SdBrXa\",\n \"object\": \"fiscal_entity\",\n \"created_at\": 0\n },\n \"checkout\": {\n \"id\": \"521b25bd-04c5-41d2-95e7-b242f9b795cc\",\n \"name\": \"ord-2tUgccjdQJ7SdBrXb\",\n \"livemode\": true,\n \"emails_sent\": 0,\n \"success_url\": \"\",\n \"failure_url\": \"\",\n \"paid_payments_count\": 0,\n \"sms_sent\": 0,\n \"status\": \"Issued\",\n \"type\": \"Integration\",\n \"recurrent\": false,\n \"starts_at\": 1678082400,\n \"expires_at\": 1678381857,\n \"allowed_payment_methods\": [\n \"card\",\n \"cash\",\n \"bank_transfer\"\n ],\n \"redirection_time\" : \"{{body 'checkout.redirection_time' 7}}\",\n \"exclude_card_networks\": [],\n \"needs_shipping_contact\": false,\n \"monthly_installments_options\": [\n 3,\n 6,\n 12\n ],\n \"monthly_installments_enabled\": true,\n \"force_3ds_flow\": false,\n \"metadata\": {},\n \"can_not_expire\": false,\n \"object\": \"checkout\",\n \"on_demand_enabled\": false\n },\n \"object\": \"order\",\n \"id\": \"ord_msi_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {\n \"test\": \"true\"\n },\n \"is_refundable\": false,\n \"created_at\": 1678124707,\n \"updated_at\": 1678124707,\n \"line_items\": {\n \"object\": \"list\",\n \"has_more\": false,\n \"total\": 1,\n \"data\": [\n {\n \"name\": \"Pago Mensualidad\",\n \"description\": \"Mes de Febrero.\",\n \"unit_price\": 2000,\n \"quantity\": 1,\n \"tags\": [\n \"Pago\",\n \"Pago mensualidad\"\n ],\n \"object\": \"line_item\",\n \"id\": \"line_item_2tUgccjdQJ7SdBrXX\",\n \"parent_id\": \"ord_2tUgccjdQJ7SdBrXb\",\n \"metadata\": {},\n \"antifraud_info\": {}\n }\n ]\n }\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [ + { + "key": "content-type", + "value": "application/vnd.conekta-v2.1.0+json; charset=utf-8" + }, + { + "key": "content-length", + "value": "3426" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": false + } + ], + "enabled": true, + "responseMode": null } ], "rootChildren": [ @@ -11324,6 +11686,26 @@ { "type": "route", "uuid": "ead07c85-3adb-40f2-b57b-49e8c3106957" + }, + { + "type": "route", + "uuid": "1b06f728-1985-4bc0-98a4-664ad6e7e604" + }, + { + "type": "route", + "uuid": "3e017e41-4d6d-4490-8c66-c859706bd6eb" + }, + { + "type": "route", + "uuid": "b9656029-f0c2-4920-bc41-13f88a091f4a" + }, + { + "type": "route", + "uuid": "503ef689-df8a-4330-bbaf-ea07eb343ea6" + }, + { + "type": "route", + "uuid": "ffacf12e-1faa-4076-9368-bf9b64665963" } ], "proxyMode": false, diff --git a/parameters/commons/query/charge_id.yml b/parameters/commons/query/charge_id.yml new file mode 100644 index 0000000..aff8448 --- /dev/null +++ b/parameters/commons/query/charge_id.yml @@ -0,0 +1,7 @@ +in: query +name: "charge_id" +description: "id of the charge used for filtering" +required: false +schema: + type: string + example: "65412a893cd69a0001c25892" \ No newline at end of file diff --git a/parameters/commons/query/currency.yml b/parameters/commons/query/currency.yml new file mode 100644 index 0000000..6e97a6b --- /dev/null +++ b/parameters/commons/query/currency.yml @@ -0,0 +1,7 @@ +in: query +name: "currency" +description: "currency of the object to be retrieved" +required: false +schema: + type: string + example: "MXN" \ No newline at end of file diff --git a/parameters/commons/query/id_query.yml b/parameters/commons/query/id_query.yml new file mode 100644 index 0000000..3087955 --- /dev/null +++ b/parameters/commons/query/id_query.yml @@ -0,0 +1,7 @@ +in: query +name: "id" +description: "id of the object to be retrieved" +required: false +schema: + type: string + example: "65412a893cd69a0001c25892" \ No newline at end of file diff --git a/parameters/commons/query/status.yml b/parameters/commons/query/status.yml new file mode 100644 index 0000000..c96084b --- /dev/null +++ b/parameters/commons/query/status.yml @@ -0,0 +1,7 @@ +in: query +name: "status" +description: "status of the object to be retrieved" +required: false +schema: + type: string + example: "pending" \ No newline at end of file diff --git a/parameters/commons/query/type.yml b/parameters/commons/query/type.yml new file mode 100644 index 0000000..8cbbb9f --- /dev/null +++ b/parameters/commons/query/type.yml @@ -0,0 +1,7 @@ +in: query +name: "type" +description: "type of the object to be retrieved" +required: false +schema: + type: string + example: "capture" \ No newline at end of file diff --git a/parameters/commons/query/url.yml b/parameters/commons/query/url.yml new file mode 100644 index 0000000..0ec1630 --- /dev/null +++ b/parameters/commons/query/url.yml @@ -0,0 +1,6 @@ +in: query +name: "url" +description: "url for webhook filter" +required: false +schema: + type: string \ No newline at end of file diff --git a/requestBodies/charges/charge_update.yml b/requestBodies/charges/charge_update.yml new file mode 100644 index 0000000..15f2064 --- /dev/null +++ b/requestBodies/charges/charge_update.yml @@ -0,0 +1,6 @@ +description: requested field for update a charge +content: + application/json: + schema: + $ref: '../../schemas/charges/charge_update_request.yml' +required: true diff --git a/requestBodies/payout_orders/payout_order.yml b/requestBodies/payout_orders/payout_order.yml new file mode 100644 index 0000000..53993f2 --- /dev/null +++ b/requestBodies/payout_orders/payout_order.yml @@ -0,0 +1,6 @@ +description: requested field for payout order +content: + application/json: + schema: + $ref: '../../schemas/payout_orders/payout_order.yml' +required: true diff --git a/resources/charges/update_charge.yml b/resources/charges/update_charge.yml new file mode 100644 index 0000000..3d49eaa --- /dev/null +++ b/resources/charges/update_charge.yml @@ -0,0 +1,51 @@ +put: + tags: + - Charges + operationId: updateCharge + summary: Update a charge + responses: + 200: + description: successful + content: + application/vnd.conekta-v2.1.0+json: + schema: + $ref: '../../schemas/charges/charge_response.yml' + headers: + Date: + description: The date and time that the response was sent + schema: + type: string + example: "Fri, 03 Feb 2023 16:57:48 GMT" + Content-Type: + description: The format of the response body + schema: + type: string + example: "application/json; charset=utf-8" + Content-Length: + description: The length of the response body in bytes + schema: + type: string + example: "2737" + Connection: + description: The type of connection used to transfer the response + schema: + type: string + example: "keep-alive" + Conekta-Media-Type: + schema: + type: string + example: conekta-v2.1.0; format=application/json + 422: + $ref: '../errors/422_whitelist.yml' + 404: + $ref: '../errors/404.yml' + 500: + $ref: '../errors/500.yml' + security: + - bearerAuth: [] + requestBody: + $ref: '../../requestBodies/charges/charge_update.yml' + parameters: + - $ref: '../../parameters/commons/path_param/id.yml' + - $ref: '../../parameters/commons/headers/accept_language.yml' + - $ref: '../../parameters/commons/headers/x_child_company_id.yml' diff --git a/resources/payout_orders/get_payout_order.yml b/resources/payout_orders/get_payout_order.yml new file mode 100644 index 0000000..596cfbb --- /dev/null +++ b/resources/payout_orders/get_payout_order.yml @@ -0,0 +1,24 @@ +get: + tags: + - Payout Orders + operationId: getPayoutOrderById + summary: Get Payout Order + description: 'Gets a payout Order resource that corresponds to a payout order ID.' + responses: + '200': + description: successful operation + content: + application/vnd.conekta-v2.1.0+json: + schema: + $ref: '../../schemas/payout_orders/payout_order_response.yml' + 401: + $ref: '../errors/401.yml' + 404: + $ref: '../errors/404.yml' + 500: + $ref: '../errors/500.yml' + security: + - bearerAuth: [] + parameters: + - $ref: '../../parameters/commons/path_param/id.yml' + - $ref: '../../parameters/commons/headers/accept_language.yml' diff --git a/resources/payout_orders/payout_orders.yml b/resources/payout_orders/payout_orders.yml new file mode 100644 index 0000000..bfef642 --- /dev/null +++ b/resources/payout_orders/payout_orders.yml @@ -0,0 +1,64 @@ +post: + tags: + - Payout Orders + operationId: createPayoutOrder + summary: Create payout order + description: 'Create a new payout order.' + responses: + 200: + description: successful operation + content: + application/vnd.conekta-v2.1.0+json: + schema: + $ref: ../../schemas/payout_orders/payout_order_response.yml + 422: + $ref: '../errors/422.yml' + 401: + $ref: '../errors/401.yml' + 402: + $ref: '../errors/402.yml' + 404: + $ref: '../errors/404.yml' + 500: + $ref: '../errors/500.yml' + security: + - bearerAuth: [] + requestBody: + $ref: '../../requestBodies/payout_orders/payout_order.yml' + parameters: + - $ref: '../../parameters/commons/headers/accept_language.yml' +get: + tags: + - Payout Orders + operationId: getPayoutOrders + summary: Get a list of Payout Orders + description: 'Get Payout order details in the form of a list' + responses: + 200: + description: successful operation + content: + application/vnd.conekta-v2.1.0+json: + schema: + title: payout_orders_response + allOf: + - type: object + properties: + data: + title: payout_orders_data_response + type: array + items: + $ref: '../../schemas/payout_orders/payout_order_response.yml' + - $ref: ../../schemas/pagination/pagination.yml + - $ref: ../../schemas/pagination/page.yml + 401: + $ref: '../errors/401.yml' + 500: + $ref: '../errors/500.yml' + security: + - bearerAuth: [] + parameters: + - $ref: '../../parameters/commons/headers/accept_language.yml' + - $ref: '../../parameters/commons/query/limit.yml' + - $ref: '../../parameters/commons/query/search.yml' + - $ref: '../../parameters/commons/query/next_page.yml' + - $ref: '../../parameters/commons/query/previous_page.yml' diff --git a/resources/transactions/transactions.yml b/resources/transactions/transactions.yml index 4e8fad3..0d615a0 100644 --- a/resources/transactions/transactions.yml +++ b/resources/transactions/transactions.yml @@ -56,6 +56,9 @@ get: - $ref: '../../parameters/commons/headers/accept_language.yml' - $ref: '../../parameters/commons/headers/x_child_company_id.yml' - $ref: '../../parameters/commons/query/limit.yml' - - $ref: '../../parameters/commons/query/search.yml' - $ref: '../../parameters/commons/query/next_page.yml' - $ref: '../../parameters/commons/query/previous_page.yml' + - $ref: '../../parameters/commons/query/id_query.yml' + - $ref: '../../parameters/commons/query/charge_id.yml' + - $ref: '../../parameters/commons/query/type.yml' + - $ref: '../../parameters/commons/query/currency.yml' diff --git a/resources/webhooks/webhooks.yml b/resources/webhooks/webhooks.yml index b47f1d5..90e42b6 100644 --- a/resources/webhooks/webhooks.yml +++ b/resources/webhooks/webhooks.yml @@ -56,6 +56,7 @@ get: - $ref: '../../parameters/commons/headers/x_child_company_id.yml' - $ref: '../../parameters/commons/query/limit.yml' - $ref: '../../parameters/commons/query/search.yml' + - $ref: '../../parameters/commons/query/url.yml' - $ref: '../../parameters/commons/query/next_page.yml' - $ref: '../../parameters/commons/query/previous_page.yml' post: diff --git a/schemas/charges/charge_order_response.yml b/schemas/charges/charge_order_response.yml index bc11926..4d02e87 100644 --- a/schemas/charges/charge_order_response.yml +++ b/schemas/charges/charge_order_response.yml @@ -41,9 +41,6 @@ properties: failure_message: type: string example: "Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso." - fee: - type: integer - example: 1160 id: type: string example: "63efa757cf65380001aec040" diff --git a/schemas/charges/charge_payment_method_card_response.yml b/schemas/charges/charge_payment_method_card_response.yml index fe39d17..6f507e9 100644 --- a/schemas/charges/charge_payment_method_card_response.yml +++ b/schemas/charges/charge_payment_method_card_response.yml @@ -18,8 +18,6 @@ payment_method_card: type: string description: "Id sent for recurrent charges." example: "S781317595" - maxLength: 10 - minLength: 10 country: type: string example: "MX" diff --git a/schemas/charges/charge_request.yml b/schemas/charges/charge_request.yml index 69d0c3d..802e45c 100644 --- a/schemas/charges/charge_request.yml +++ b/schemas/charges/charge_request.yml @@ -6,10 +6,6 @@ properties: amount: type: integer example: 40000 - monthly_installments: - type: integer - format: int8 - description: "How many months without interest to apply, it can be 3, 6, 9, 12 or 18" payment_method: required: - type @@ -22,6 +18,10 @@ properties: format: int64 description: "Method expiration date as unix timestamp" example: 1677196303 + monthly_installments: + type: integer + format: int8 + description: "How many months without interest to apply, it can be 3, 6, 9, 12 or 18" type: type: string example: "card" @@ -35,8 +35,6 @@ properties: type: string description: "Optional id sent to indicate the bank contract for recurrent card charges." example: "S781317595" - maxLength: 10 - minLength: 10 reference_id: description: "Custom reference to add to the charge" type: string diff --git a/schemas/charges/charge_response.yml b/schemas/charges/charge_response.yml index 1152fdd..f4c4092 100644 --- a/schemas/charges/charge_response.yml +++ b/schemas/charges/charge_response.yml @@ -40,9 +40,6 @@ properties: failure_message: type: string example: "Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso." - fee: - type: integer - example: 1160 id: type: string example: "63efa757cf65380001aec040" diff --git a/schemas/charges/charge_update_request.yml b/schemas/charges/charge_update_request.yml new file mode 100644 index 0000000..0782252 --- /dev/null +++ b/schemas/charges/charge_update_request.yml @@ -0,0 +1,7 @@ +title: charge_update_request +description: requested field for update a charge +properties: + reference_id: + type: string + example: "278482642" + description: "custom reference id" diff --git a/schemas/checkouts/checkout_request.yml b/schemas/checkouts/checkout_request.yml index 8f696fb..4f37769 100644 --- a/schemas/checkouts/checkout_request.yml +++ b/schemas/checkouts/checkout_request.yml @@ -32,6 +32,11 @@ properties: on_demand_enabled: type: boolean example: true + redirection_time: + type: integer + format: int8 + description: "number of seconds to wait before redirecting to the success_url" + example: 10 success_url: type: string description: "Redirection url back to the site in case of successful payment, applies only to HostedPayment" diff --git a/schemas/customers/customer_address.yml b/schemas/customers/customer_address.yml index 74c2dd4..2fe1435 100644 --- a/schemas/customers/customer_address.yml +++ b/schemas/customers/customer_address.yml @@ -6,10 +6,10 @@ required: properties: street1: type: string - example: avenida siempre viva + example: Nuevo Leon 254 street2: type: string - example: fake street + example: Departamento 404 postal_code: type: string example: "06100" @@ -26,6 +26,7 @@ properties: residential: type: boolean example: true + default: false external_number: type: string \ No newline at end of file diff --git a/schemas/customers/customer_info_response.yml b/schemas/customers/customer_info_response.yml index eebaf63..2b4ec6f 100644 --- a/schemas/customers/customer_info_response.yml +++ b/schemas/customers/customer_info_response.yml @@ -1,6 +1,11 @@ title: customer_info type: object properties: + custom_reference: + type: string + example: "custom_reference" + description: Custom reference + nullable: true name: type: string example: "DevTest" diff --git a/schemas/customers/customer_response.yml b/schemas/customers/customer_response.yml index 3696d72..435e997 100644 --- a/schemas/customers/customer_response.yml +++ b/schemas/customers/customer_response.yml @@ -6,6 +6,7 @@ required: - livemode - created_at - object + - name properties: antifraud_info: title: customer_antifraud_info_response @@ -21,12 +22,16 @@ properties: format: int64 corporate: type: boolean + description: true if the customer is a company created_at: type: integer format: int64 example: 1485151007 + description: Creation date of the object custom_reference: type: string + example: "custom_reference" + description: Custom reference default_fiscal_entity_id: type: string nullable: true @@ -78,12 +83,19 @@ properties: id: type: string example: "cus_2tHJfJ79KyUwpxTik" + description: Customer's ID livemode: type: boolean example: true + description: true if the object exists in live mode or the value false if the object exists in test mode name: type: string example: Felipe + description: Customer's name + metadata: + type: object + additionalProperties: true + maxProperties: 100 object: type: string example: "customer" @@ -114,6 +126,7 @@ properties: phone: type: string example: "+5215555555555" + description: Customer's phone number shipping_contacts: allOf: - $ref: ../../schemas/pagination/pagination.yml diff --git a/schemas/customers/customer_shipping_contacts.yml b/schemas/customers/customer_shipping_contacts.yml index 0efadea..b103294 100644 --- a/schemas/customers/customer_shipping_contacts.yml +++ b/schemas/customers/customer_shipping_contacts.yml @@ -23,10 +23,10 @@ properties: properties: street1: type: string - example: avenida siempre viva + example: Nuevo Leon 254 street2: type: string - example: fake street + example: Departamento 404 postal_code: type: string example: "06100" @@ -52,4 +52,8 @@ properties: deleted: type: boolean nullable: true - \ No newline at end of file + metadata: + type: object + additionalProperties: true + maxProperties: 100 + description: "Metadata associated with the shipping contact" diff --git a/schemas/customers/customer_shipping_contacts_response.yml b/schemas/customers/customer_shipping_contacts_response.yml index f41c251..6608d79 100644 --- a/schemas/customers/customer_shipping_contacts_response.yml +++ b/schemas/customers/customer_shipping_contacts_response.yml @@ -18,10 +18,10 @@ properties: example: "shipping_address" street1: type: string - example: avenida siempre viva + example: Nuevo Leon 254 street2: type: string - example: fake street + example: Departamento 404 postal_code: type: string example: "06100" @@ -37,6 +37,7 @@ properties: residential: type: boolean example: true + nullable: true parent_id: type: string default: @@ -49,6 +50,11 @@ properties: type: integer format: int64 example: 1675715413 + metadata: + type: object + additionalProperties: true + maxProperties: 100 + description: "Metadata associated with the shipping contact" object: type: string example: "shipping_contact" diff --git a/schemas/customers/customer_update_shipping_contacts.yml b/schemas/customers/customer_update_shipping_contacts.yml index 6f881d6..13ecdc8 100644 --- a/schemas/customers/customer_update_shipping_contacts.yml +++ b/schemas/customers/customer_update_shipping_contacts.yml @@ -21,10 +21,10 @@ properties: properties: street1: type: string - example: avenida siempre viva + example: Nuevo Leon 254 street2: type: string - example: fake street + example: Departamento 404 postal_code: type: string example: "06100" diff --git a/schemas/customers/payment_method_card_request.yml b/schemas/customers/payment_method_card_request.yml index 1438576..e70318f 100644 --- a/schemas/customers/payment_method_card_request.yml +++ b/schemas/customers/payment_method_card_request.yml @@ -1,9 +1,9 @@ title: payment_method_card_request -required: - - token_id allOf: - $ref: './customer_payment_method_request.yml' - type: object + required: + - token_id properties: token_id: type: string diff --git a/schemas/event_types/event_types.yml b/schemas/event_types/event_types.yml new file mode 100644 index 0000000..e861567 --- /dev/null +++ b/schemas/event_types/event_types.yml @@ -0,0 +1,9 @@ +title: event_types +type: string +description: "It is a parameter that allows to identify in the response, the type of event that is being generated." +enum: + - webhook_ping + - order.paid + - order.expired + - order.canceled + - order.pending_payment diff --git a/schemas/orders/fiscal_entity_address.yml b/schemas/orders/fiscal_entity_address.yml new file mode 100644 index 0000000..7ed9cc0 --- /dev/null +++ b/schemas/orders/fiscal_entity_address.yml @@ -0,0 +1,39 @@ +title: order_fiscal_entity_address_request +required: + - street1 + - city + - country + - postal_code + - external_number +type: object +description: "Address of the fiscal entity" +properties: + street1: + type: string + example: Nuevo Leon 254 + description: "Street name and number" + street2: + type: string + example: Departamento 404 + description: "Street name and number" + nullable: true + postal_code: + type: string + example: "06100" + description: "Postal code" + city: + type: string + example: "Ciudad de Mexico" + description: "City" + state: + type: string + example: "Ciudad de Mexico" + description: "State" + country: + type: string + example: MX + description: "this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)" + external_number: + type: string + example: "123" + description: "External number" diff --git a/schemas/orders/order_customer_info_response.yml b/schemas/orders/order_customer_info_response.yml new file mode 100644 index 0000000..d9f4ca6 --- /dev/null +++ b/schemas/orders/order_customer_info_response.yml @@ -0,0 +1,24 @@ +title: order_customer_info_response +type: object +properties: + customer_custom_reference: + type: string + example: "custom_reference" + description: Custom reference + nullable: true + name: + type: string + example: "DevTest" + email: + type: string + format: email + example: test@conekta.com + phone: + type: string + example: "5522997233" + corporate: + default: false + type: boolean + object: + type: string + example: "customer_info" diff --git a/schemas/orders/order_request.yml b/schemas/orders/order_request.yml index 258a6a1..4f4d37f 100644 --- a/schemas/orders/order_request.yml +++ b/schemas/orders/order_request.yml @@ -29,6 +29,38 @@ properties: type: array items: $ref: order_discount_lines_request.yml + fiscal_entity: + title: order_fiscal_entity_request + type: object + description: "Fiscal entity of the order, Currently it is a purely informative field" + required: + - address + properties: + address: + $ref: fiscal_entity_address.yml + email: + type: string + example: "test@gmail.com" + description: "Email of the fiscal entity" + metadata: + type: object + additionalProperties: true + maxProperties: 100 + description: "Metadata associated with the fiscal entity" + name: + type: string + example: "Conekta Inc" + nullable: true + description: "Name of the fiscal entity" + phone: + type: string + example: "+525511223344" + description: "Phone of the fiscal entity" + tax_id: + type: string + example: "AAA010101AAA" + nullable: true + description: "Tax ID of the fiscal entity" line_items: description: "List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product." type: array @@ -51,6 +83,11 @@ properties: type: string description: "Indicates the processing mode for the order, either ecommerce, recurrent or validation." example: "ecommerce" + return_url: + type: string + format: uri + description: "Indicates the redirection callback upon completion of the 3DS2 flow." + example: https://my-website.com shipping_contact: $ref: ../../schemas/customers/customer_shipping_contacts.yml shipping_lines: @@ -63,6 +100,12 @@ properties: type: array items: $ref: order_tax_request.yml - - + three_ds_mode: + type: string + description: "Indicates the 3DS2 mode for the order, either smart or strict." + examples: + - value: "smart" + summary: "Those transactions that Conekta considers to present a risk to commerce will go through an additional verification flow (through 3DS2), provided that the issuing bank is compatible with this technology.If the transaction is not considered risky, it will continue its normal course, without going through 3DS2 authentication." + - value: "strict" + summary: "All transactions will require 3DS2 authentication as a complementary measure for the security of charges, except those that are rejected by our Anti-Fraud. The issuing bank must be compatible with 3DS2 technology." diff --git a/schemas/orders/order_response.yml b/schemas/orders/order_response.yml index 6244847..e97b43f 100644 --- a/schemas/orders/order_response.yml +++ b/schemas/orders/order_response.yml @@ -102,6 +102,12 @@ properties: recurrent: type: boolean example: false + redirection_time: + type: integer + nullable: true + example: 2 + format: int8 + description: "number of seconds to wait before redirecting to the success_url" slug: type: string example: "6fca054a85194c43971ecea35cc519bb" @@ -139,7 +145,7 @@ properties: object: type: string example: "customer_info" - - $ref: ../customers/customer_info_response.yml + - $ref: order_customer_info_response.yml - $ref: ../customers/customer_info_just_customer_id_response.yml discount_lines: allOf: @@ -154,24 +160,62 @@ properties: - $ref: ../../schemas/orders/discount_lines_response.yml fiscal_entity: type: object + title: order_fiscal_entity_response + nullable: true + description: "Fiscal entity of the order, Currently it is a purely informative field" + required: + - address + - id + - object + - created_at properties: address: + title: order_fiscal_entity_address_response + description: "Address of the fiscal entity" allOf: - - $ref: ../customers/customer_address.yml + - $ref: fiscal_entity_address.yml - type: object properties: object: type: string example: "fiscal_entity_address" + email: + type: string + example: "test@gmail.com" + description: "Email of the fiscal entity" + nullable: true + metadata: + type: object + additionalProperties: true + maxProperties: 100 + description: "Metadata associated with the fiscal entity" + name: + type: string + example: "Conekta Inc" + nullable: true + description: "Name of the fiscal entity" tax_id: type: string example: "324234234" + description: "Tax ID of the fiscal entity" + nullable: true id: type: string example: "fis_ent_2tN85VYaSMyDvjB3M" + description: "ID of the fiscal entity" + created_at: + type: integer + format: int64 + example: 1676328434 + description: "The time at which the object was created in seconds since the Unix epoch" object: type: string example: "fiscal_entity" + phone: + type: string + example: "+525511223344" + description: "Phone of the fiscal entity" + nullable: true id: type: string example: "ord_2tMtQQpDvfnNjiuFG" @@ -208,6 +252,29 @@ properties: maxProperties: 100 type: object description: "Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format." + next_action: + title: order_next_action_response + type: object + description: contains the following attributes that will guide to continue the flow + properties: + redirect_to_url: + type: object + description: contains the following attributes that will guide to continue the flow + properties: + url: + type: string + format: uri + description: pay.conekta.com/{id} Indicates the url of the Conekta component to authenticate the flow through 3DS2. + example: https://pay.conekta.com/6fca054a85194c43971ecea35cc519bb + return_url: + type: string + format: uri + description: Indicates the url to which the 3DS2 flow returns at the end, when the integration is redirected. + example: https://my-website.com" + type: + type: string + example: "redirect_to_url" + description: Indicates the type of action to be taken object: type: string example: "order" diff --git a/schemas/orders/order_update_request.yml b/schemas/orders/order_update_request.yml index fcd408a..e0a2c13 100644 --- a/schemas/orders/order_update_request.yml +++ b/schemas/orders/order_update_request.yml @@ -23,6 +23,38 @@ properties: type: array items: $ref: order_discount_lines_request.yml + fiscal_entity: + title: order_update_fiscal_entity_request + type: object + description: "Fiscal entity of the order, Currently it is a purely informative field" + required: + - address + properties: + address: + $ref: fiscal_entity_address.yml + email: + type: string + example: "test@gmail.com" + description: "Email of the fiscal entity" + name: + type: string + example: "Conekta Inc" + nullable: true + description: "Name of the fiscal entity" + metadata: + type: object + additionalProperties: true + maxProperties: 100 + description: "Metadata associated with the fiscal entity" + phone: + type: string + example: "+525511223344" + description: "Phone of the fiscal entity" + tax_id: + type: string + example: "AAA010101AAA" + nullable: true + description: "Tax ID of the fiscal entity" line_items: description: "List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product." type: array diff --git a/schemas/orders/request_examples/order_with_charges.yml b/schemas/orders/request_examples/order_with_charges.yml index 32ad342..3aaf27b 100644 --- a/schemas/orders/request_examples/order_with_charges.yml +++ b/schemas/orders/request_examples/order_with_charges.yml @@ -16,6 +16,22 @@ value: phone: '5522997233' corporate: false object: customer_info + fiscal_entity: + tax_id: '1234567890' + name: Conekta Inc + email: "test@gmail.com" + phone: "525511223344" + metadata: + test: true + company_id: '123' + address: + street1: Nuevo Leon 254 + street2: Departamento 404 + postal_code: '06100' + city: Ciudad de Mexico + state: Ciudad de Mexico + country: MX + external_number: '123' discount_lines: - amount: 500 code: '123' @@ -38,17 +54,19 @@ value: additionalProp2: string additionalProp3: string metadata: - additionalProp1: string - additionalProp2: string - additionalProp3: string + test: true + company_id: '123' pre_authorize: false shipping_contact: phone: '525511223344' receiver: Marvin Fuller between_streets: Ackerman Crescent + metadata: + test: true + company_id: '123' address: - street1: avenida siempre viva - street2: fake street + street1: Nuevo Leon 254 + street2: Departamento 404 postal_code: '06100' city: Ciudad de Mexico state: Ciudad de Mexico diff --git a/schemas/orders/request_examples/order_with_checkout.yml b/schemas/orders/request_examples/order_with_checkout.yml index c920115..8a7ccdd 100644 --- a/schemas/orders/request_examples/order_with_checkout.yml +++ b/schemas/orders/request_examples/order_with_checkout.yml @@ -50,8 +50,8 @@ value: receiver: Marvin Fuller between_streets: Ackerman Crescent address: - street1: avenida siempre viva - street2: fake street + street1: Nuevo Leon 254 + street2: Departamento 404 postal_code: '06100' city: Ciudad de Mexico state: Ciudad de Mexico diff --git a/schemas/payout_orders/payout_order.yml b/schemas/payout_orders/payout_order.yml new file mode 100644 index 0000000..a169a22 --- /dev/null +++ b/schemas/payout_orders/payout_order.yml @@ -0,0 +1,57 @@ +title: payout order request +description: a payout order +type: object +required: + - allowed_payout_methods + - amount + - currency + - customer_info + - payout + - reason +properties: + allowed_payout_methods: + type: array + description: "The payout methods that are allowed for the payout order." + items: + type: string + example: ["cashout"] + amount: + type: integer + description: "The amount of the payout order." + example: 100 + currency: + type: string + description: "The currency in which the payout order is made." + example: "MXN" + default: "MXN" + customer_info: + description: "The customer information to whom the payout order is made." + $ref: '../../schemas/customers/customer_info_just_customer_id.yml' + metadata: + type: object + description: "The metadata of the payout order." + additionalProperties: true + maxProperties: 100 + example: {"custom_client_id": "12345"} + payout: + title: payout + required: + - payout_method + type: object + description: "The payout information of the payout order." + properties: + payout_method: + title: payout_method + required: + - type + type: object + description: "The payout method of the payout order." + properties: + type: + type: string + description: "The type of the payout method." + example: "cashout" + reason: + type: string + description: "The reason for the payout order." + example: "Payout order for the customer" diff --git a/schemas/payout_orders/payout_order_response.yml b/schemas/payout_orders/payout_order_response.yml new file mode 100644 index 0000000..3477633 --- /dev/null +++ b/schemas/payout_orders/payout_order_response.yml @@ -0,0 +1,132 @@ +title: payout_order_response +description: payout order model response +type: object +required: + - allowed_payout_methods + - amount + - created_at + - currency + - customer_info + - id + - livemode + - object + - payouts + - reason + - updated_at +properties: + allowed_payout_methods: + type: array + description: "The payout methods that are allowed for the payout order." + items: + type: string + example: ["cashout"] + minItems: 1 + amount: + type: integer + description: "The amount of the payout order." + example: 100 + created_at: + type: integer + description: "The creation date of the payout order." + example: 1677626837 + format: int64 + currency: + type: string + description: "The currency in which the payout order is made." + example: "MXN" + default: "MXN" + customer_info: + description: "The customer information of the payout order." + allOf: + - type: object + required: + - id + properties: + id: + type: string + example: "cus_23874283647" + description: "The id of the customer." + - $ref: ../orders/order_customer_info_response.yml + expires_at: + type: integer + description: "The expiration date of the payout order." + format: int64 + example: 1677626837 + id: + type: string + description: "The id of the payout order." + example: "f2654d66-d740-457a-9a8c-f96b5196f44e" + livemode: + type: boolean + description: "The live mode of the payout order." + example: true + object: + type: string + description: "The object of the payout order." + example: "payout_order" + metadata: + type: object + description: "The metadata of the payout order." + additionalProperties: true + maxProperties: 100 + example: {"custom_client_id": "12345"} + payouts: + type: array + description: "The payout information of the payout order." + title: payout_order_payouts + items: + type: object + title: payout_order_payouts_item + required: + - id + - amount + - currency + - livemode + - object + properties: + amount: + type: integer + description: "The amount of the payout." + example: 3000 + currency: + type: string + description: "The currency in which the payout is made." + example: "MXN" + expires_at: + format: int64 + type: integer + description: "The expiration date of the payout." + example: 1677626837 + id: + type: string + description: "The id of the payout." + example: "payout_2vZwsRAhhGp2dFDJx" + livemode: + type: boolean + description: "The live mode of the payout." + example: true + object: + type: string + description: "The object of the payout." + example: "payout" + payout_order_id: + type: string + description: "The id of the payout order." + example: "f2654d66-d740-457a-9a8c-f96b5196f44e" + status: + type: string + description: "The status of the payout." + example: "open" + reason: + type: string + description: "The reason for the payout order." + example: "Payout order for the customer" + status: + type: string + description: "The status of the payout order." + example: "open" + updated_at: + type: integer + description: "The update date of the payout order." + example: 1677626837 + format: int64 diff --git a/templates/dart/VERSION.mustache b/templates/dart/VERSION.mustache deleted file mode 100644 index 653cae5..0000000 --- a/templates/dart/VERSION.mustache +++ /dev/null @@ -1 +0,0 @@ -{{pubVersion}} diff --git a/templates/dart/api.mustache b/templates/dart/api.mustache deleted file mode 100644 index cd22fe9..0000000 --- a/templates/dart/api.mustache +++ /dev/null @@ -1,169 +0,0 @@ -{{>header}} -import 'dart:async'; - -{{#includeLibraryTemplate}}api/imports{{/includeLibraryTemplate}} -import 'package:dio/dio.dart'; - -{{#operations}} -{{#imports}}import '{{.}}'; -{{/imports}} -import 'package:conekta/src/utils/utils.dart'; - -class {{classname}} { - - final Dio _dio; - -{{#includeLibraryTemplate}}api/constructor{{/includeLibraryTemplate}} - - {{#operation}} - /// {{summary}}{{^summary}}{{nickname}}{{/summary}} - /// {{notes}} - /// - /// Parameters: - {{#allParams}} - /// * [{{paramName}}] {{#description}}- {{{.}}}{{/description}} - {{/allParams}} - /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation - /// * [headers] - Can be used to add additional headers to the request - /// * [extras] - Can be used to add flags to the request - /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response - /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress - /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress - /// - /// Returns a [Future]{{#returnType}} containing a [Response] with a [{{{.}}}] as data{{/returnType}} - /// Throws [DioError] if API call or serialization fails - {{#externalDocs}} - /// {{description}} - /// Also see [{{summary}} Documentation]({{url}}) - {{/externalDocs}} - {{#isDeprecated}} - @Deprecated('This operation has been deprecated') - {{/isDeprecated}} - Future> {{nickname}}({ {{#allParams}}{{#isPathParam}} - {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}required {{{dataType}}} {{paramName}},{{/isPathParam}}{{#isQueryParam}} - {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isQueryParam}}{{#isHeaderParam}} - {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isHeaderParam}}{{#isBodyParam}} - {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isBodyParam}}{{#isFormParam}} - {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isFormParam}}{{/allParams}} - CancelToken? cancelToken, - Map? headers, - Map? extra, - ValidateStatus? validateStatus, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress, - }) async { - - // to determine the Accept header - List _contentTypes = [ - {{#consumes}} - "{{{mediaType}}}"{{^-last}},{{/-last}} - {{/consumes}} - ]; - var localVarContentType = selectHeaderContentType(_contentTypes); - - // to determine the Accept header - List _accepts = [ - {{#produces}} - "{{{mediaType}}}"{{^-last}},{{/-last}} - {{/produces}} - ]; - final localVarAccept = selectHeaderAccept(_accepts); - - final _path = r'{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{{baseName}}}' '}', {{{paramName}}}.toString()){{/pathParams}}; - final _options = Options( - method: r'{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}', - {{#isResponseFile}} - responseType: ResponseType.bytes, - {{/isResponseFile}} - headers: { - {{#httpUserAgent}} - r'User-Agent': r'{{{.}}}/{{pubVersion}}', - {{/httpUserAgent}} - {{#headerParams}} - {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{paramName}}, - {{/headerParams}} - if (localVarAccept != null) r'Accept': localVarAccept, - if (localVarContentType != null) r'Content-Type': localVarContentType, - r'X-Conekta-Client-User-Agent' : getConektaClientUserAgent(), - ...?headers, - }, - extra: { - 'secure': >[{{^hasAuthMethods}}],{{/hasAuthMethods}}{{#hasAuthMethods}} - {{#authMethods}}{ - 'type': '{{type}}',{{#scheme}} - 'scheme': '{{.}}',{{/scheme}} - 'name': '{{name}}',{{#isApiKey}} - 'keyName': '{{keyParamName}}', - 'where': '{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}',{{/isApiKey}} - },{{/authMethods}} - ],{{/hasAuthMethods}} - ...?extra, - },{{#hasConsumes}} - contentType: '{{#prioritizedContentTypes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/prioritizedContentTypes}}',{{/hasConsumes}} - validateStatus: validateStatus, - );{{#hasQueryParams}} - - final _queryParameters = { - {{#queryParams}} - {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{#includeLibraryTemplate}}api/query_param{{/includeLibraryTemplate}}, - {{/queryParams}} - };{{/hasQueryParams}}{{#hasBodyOrFormParams}} - - dynamic _bodyData; - - try { -{{#includeLibraryTemplate}}api/serialize{{/includeLibraryTemplate}} - } catch(error, stackTrace) { - throw DioError( - requestOptions: _options.compose( - _dio.options, - _path,{{#hasQueryParams}} - queryParameters: _queryParameters,{{/hasQueryParams}} - ), - type: DioErrorType.unknown, - error: error, - stackTrace: stackTrace, - ); - }{{/hasBodyOrFormParams}} - - final _response = await _dio.request( - _path,{{#hasBodyOrFormParams}} - data: _bodyData,{{/hasBodyOrFormParams}} - options: _options,{{#hasQueryParams}} - queryParameters: _queryParameters,{{/hasQueryParams}} - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - {{#returnType}} - - {{{.}}}? _responseData; - - try { -{{#includeLibraryTemplate}}api/deserialize{{/includeLibraryTemplate}} - } catch (error, stackTrace) { - throw DioError( - requestOptions: _response.requestOptions, - response: _response, - type: DioErrorType.unknown, - error: error, - stackTrace: stackTrace, - ); - } - - return Response<{{{returnType}}}>( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - requestOptions: _response.requestOptions, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - );{{/returnType}}{{^returnType}} - return _response;{{/returnType}} - } - - {{/operation}} -} -{{/operations}} diff --git a/templates/dart/utils.mustache b/templates/dart/utils.mustache deleted file mode 100644 index fae35f9..0000000 --- a/templates/dart/utils.mustache +++ /dev/null @@ -1,90 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -final String UnknownPlatform = "unknown platform"; - -/// Provides a case-insensitive check that a provided content type is a known JSON-like content type. -final RegExp jsonRegex = RegExp(r"(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t](;.)?$"); - -String cachedUserClient = ""; - -/// Select the Accept header's value from the given accepts list: -/// if JSON exists in the given list, use it; -/// otherwise use all of them (joining into a string) -String? selectHeaderAccept(List accepts) { - if (accepts.isEmpty) { - return null; - } - - if (accepts.contains("application/json")) { - return "application/json"; - } - - return accepts.join(","); -} - -/// Selects the Content-Type header's value from the given content-type array: -/// If a JSON type exists in the given array, it is used; -/// Otherwise, the first one defined in 'consumes' is used. -/// -/// Parameters: -/// - contentTypes: The Content-Type array to select from. -/// -/// Returns: -/// The Content-Type header to use. -String? selectHeaderContentType(List contentTypes) { - if (contentTypes.isEmpty) { - return null; - } - - for (var contentType in contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - - return contentTypes[0]; // Use the first content type specified in 'consumes' -} - -/// Checks if the given MIME is a JSON MIME. -/// -/// JSON MIME examples: -/// - application/json -/// - application/json; charset=UTF8 -/// - APPLICATION/JSON -/// - application/vnd.company+json -/// -/// Returns true if the MIME type is JSON. -bool isJsonMime(String mime) { - if (mime.trim().isEmpty) { - return false; - } - - return jsonRegex.hasMatch(mime) || mime.toLowerCase() == "application/json-patch+json"; -} - -String getConektaClientUserAgent() { - if (!cachedUserClient.isEmpty) { - return cachedUserClient; - } - Map cachedData = { - "bindings_version": "6.0.0-beta.1", - "lang": "Dart", - "publisher": "conekta", - "lang_version": Platform.version.split(' ')[0], - "uname": getUname(), - }; - - cachedUserClient = JsonEncoder().convert(cachedData); - return cachedUserClient; -} - -String getUname() { - var unameResult = Process.runSync('uname', ['-a']); - - if (unameResult.exitCode != 0) { - return UnknownPlatform; - } - - return unameResult.stdout.toString(); -} diff --git a/templates/go/README.mustache b/templates/go/README.mustache deleted file mode 100644 index 7cf2407..0000000 --- a/templates/go/README.mustache +++ /dev/null @@ -1,267 +0,0 @@ -![GO api]({{gitUserId}}.png) -# {{packageName}} Go API Library -[![Go Reference](https://pkg.go.dev/badge/github.com/{{gitUserId}}/{{gitRepoId}}.svg)](https://pkg.go.dev/github.com/{{gitUserId}}/{{gitRepoId}}) - -{{#appDescriptionWithNewLines}} -{{{.}}} -{{/appDescriptionWithNewLines}} - -## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. - -- API version: {{appVersion}} -- Package version: {{packageVersion}} -{{^hideGenerationTimestamp}} -- Build date: {{generatedDate}} -{{/hideGenerationTimestamp}} -- Build package: {{generatorClass}} -{{#infoUrl}} -For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -## Prerequisites -- [Conekta account](https://panel.conekta.com/) -- [API key](https://developers.conekta.com/docs/como-obtener-tus-api-keys). your API credential . - -## Installation -Download conekta-go package: -``` -go get -u github.com/conekta/conekta-go -``` -## Using the library - -In order to submit http request to Conekta API you need to initialize the client. The following example makes a order request: -```go -package main - -import ( - "context" - "net/http" - - "github.com/conekta/conekta-go" -) - -func main() { - // Create a OrderRequest - const acceptLanguage = "es" - const accessToken = "Your merchant XAPI key" - - // create the http client - config := conekta.NewConfiguration() - client := conekta.NewAPIClient(config) - - ctx := context.WithValue(context.TODO(), conekta.ContextAccessToken, accessToken) - - // create customer - customer := conekta.Customer{ - Name: "test go", - Phone: "+573143159063", - Email: "test@conekta.com", - } - customerResponse, httpResponse, err := client.CustomersApi.CreateCustomer(ctx). - Customer(customer). - AcceptLanguage(acceptLanguage). - Execute() - if err != nil { - panic(err) - } - if httpResponse.StatusCode != http.StatusCreated { - panic("invalid response statusCode") - } - - // Create OrderRequest - chargeRequest := conekta.ChargeRequest{ - Amount: conekta.PtrInt32(1555), - PaymentMethod: *conekta.NewChargeRequestPaymentMethod("cash"), - } - productLine := conekta.Product{ - Name: "toshiba", - Quantity: 1, - UnitPrice: 1555, - } - orderRequest := conekta.OrderRequest{ - Charges: []conekta.ChargeRequest{ - chargeRequest, - }, - Currency: "MXN", - CustomerInfo: conekta.OrderRequestCustomerInfo{ - CustomerInfoJustCustomerId: conekta.NewCustomerInfoJustCustomerId(customerResponse.Id), - }, - LineItems: []conekta.Product{ - productLine, - }, - } - - //Make the call to the service. This example code makes a call to /orders - orderResponse, httpResponse, err := client.OrdersApi.CreateOrder(ctx). - OrderRequest(orderRequest). - AcceptLanguage(acceptLanguage). - Execute() - if err != nil { - panic(err) - } - if httpResponse.StatusCode != http.StatusCreated { - panic("invalid response statusCode") - } - println(*orderResponse) -} -``` - -## Running tests -Navigate to conekta-go folder and run the following commands. -``` -docker-compose up -d -go test -v --race ./... -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation For Models - -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) -{{/model}}{{/models}} - -## Documentation For Authorization - -{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} -{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} -{{#authMethods}} -### {{{name}}} - -{{#isApiKey}} -- **Type**: API key -- **API key parameter name**: {{{keyParamName}}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - -Note, each API key must be added to a map of `map[string]APIKey` where the key is: {{keyParamName}} and passed in as the auth context for each request. - -Example - -```golang -auth := context.WithValue( - context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ - "{{keyParamName}}": {Key: "API_KEY_STRING"}, - }, - ) -r, err := client.Service.Operation(auth, args) -``` - -{{/isApiKey}} -{{#isBasic}} -{{#isBasicBearer}} -- **Type**: HTTP Bearer token authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") -r, err := client.Service.Operation(auth, args) -``` - -{{/isBasicBearer}} -{{#isBasicBasic}} -- **Type**: HTTP basic authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ - UserName: "username", - Password: "password", -}) -r, err := client.Service.Operation(auth, args) -``` - -{{/isBasicBasic}} -{{#isHttpSignature}} -- **Type**: HTTP signature authentication - -Example - -```golang - authConfig := client.HttpSignatureAuth{ - KeyId: "my-key-id", - PrivateKeyPath: "rsa.pem", - Passphrase: "my-passphrase", - SigningScheme: sw.HttpSigningSchemeHs2019, - SignedHeaders: []string{ - sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. - sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. - "Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number. - "Date", // The date and time at which the message was originated. - "Content-Type", // The Media type of the body of the request. - "Digest", // A cryptographic digest of the request body. - }, - SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS, - SignatureMaxValidity: 5 * time.Minute, - } - var authCtx context.Context - var err error - if authCtx, err = authConfig.ContextWithValue(context.Background()); err != nil { - // Process error - } - r, err = client.Service.Operation(auth, args) - -``` -{{/isHttpSignature}} -{{/isBasic}} -{{#isOAuth}} - -- **Type**: OAuth -- **Flow**: {{{flow}}} -- **Authorization URL**: {{{authorizationUrl}}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - **{{{scope}}}**: {{{description}}} -{{/scopes}} - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") -r, err := client.Service.Operation(auth, args) -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. - -```golang -import "golang.org/x/oauth2" - -/* Perform OAuth2 round trip request and obtain a token */ - -tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) -r, err := client.Service.Operation(auth, args) -``` - -{{/isOAuth}} -{{/authMethods}} - -## Documentation for Utility Methods - -Due to the fact that model structure members are all pointers, this package contains -a number of utility functions to easily obtain pointers to values of basic types. -Each of these functions takes a value of the given basic type and returns a pointer to it: - -* `PtrBool` -* `PtrInt` -* `PtrInt32` -* `PtrInt64` -* `PtrFloat` -* `PtrFloat32` -* `PtrFloat64` -* `PtrString` -* `PtrTime` - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} \ No newline at end of file diff --git a/templates/go/client.mustache b/templates/go/client.mustache deleted file mode 100644 index 1b4db77..0000000 --- a/templates/go/client.mustache +++ /dev/null @@ -1,788 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -import ( - "bytes" - "context" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "log" - "mime/multipart" - "net/http" - "net/http/httputil" - "net/url" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "time" - "unicode/utf8" - "runtime" - "os/exec" - - {{#hasOAuthMethods}} - "golang.org/x/oauth2" - {{/hasOAuthMethods}} - {{#withAWSV4Signature}} - awsv4 "github.com/aws/aws-sdk-go/aws/signer/v4" - awscredentials "github.com/aws/aws-sdk-go/aws/credentials" - {{/withAWSV4Signature}} -) - -var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) - queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) - queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) - encodedConektaUserAgent string -) -const ( - // UnknownPlatform is the string returned as the system name if we couldn't get - // one from `uname`. - UnknownPlatform string = "unknown platform" -) - -// APIClient manages communication with the {{appName}} API v{{version}} -// In most cases there should be only one, shared, APIClient. -type APIClient struct { - cfg *Configuration - common service // Reuse a single struct instead of allocating one for each service on the heap. - - // API Services -{{#apiInfo}} -{{#apis}} -{{#operations}} - - {{classname}} {{#generateInterfaces}}{{classname}}{{/generateInterfaces}}{{^generateInterfaces}}*{{classname}}Service{{/generateInterfaces}} -{{/operations}} -{{/apis}} -{{/apiInfo}} -} - - -func init() { - initUserAgent() -} - -func initUserAgent() { - data := map[string]string{ - "bindings_version": "{{{packageVersion}}}", - "lang": "go", - "lang_version": runtime.Version(), - "publisher": "conekta", - "uname": getUname(), - } - - r, _ := json.Marshal(data) - encodedConektaUserAgent = string(r) -} - -// getUname tries to get an uname from the system, but not that hard. It tries -// to execute `uname -a`, but swallows any errors in case that didn't work -// (i.e. non-Unix non-Mac system or some other reason). -func getUname() string { - path, err := exec.LookPath("uname") - if err != nil { - return UnknownPlatform - } - - cmd := exec.Command(path, "-a") - var out bytes.Buffer - cmd.Stderr = nil // goes to os.DevNull - cmd.Stdout = &out - err = cmd.Run() - if err != nil { - return UnknownPlatform - } - - return out.String() -} -type service struct { - client *APIClient -} - -// NewAPIClient creates a new API client. Requires a userAgent string describing your application. -// optionally a custom http.Client to allow for advanced features such as caching. -func NewAPIClient(cfg *Configuration) *APIClient { - if cfg.HTTPClient == nil { - cfg.HTTPClient = http.DefaultClient - } - - c := &APIClient{} - c.cfg = cfg - c.common.client = c - -{{#apiInfo}} - // API Services -{{#apis}} -{{#operations}} - c.{{classname}} = (*{{classname}}Service)(&c.common) -{{/operations}} -{{/apis}} -{{/apiInfo}} - - return c -} - -func atoi(in string) (int, error) { - return strconv.Atoi(in) -} - -// selectHeaderContentType select a content type from the available list. -func selectHeaderContentType(contentTypes []string) string { - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -// selectHeaderAccept join all accept types and return -func selectHeaderAccept(accepts []string) string { - if len(accepts) == 0 { - return "" - } - - if contains(accepts, "application/json") { - return "application/json" - } - - return strings.Join(accepts, ",") -} - -// contains is a case insensitive match, finding needle in a haystack -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.EqualFold(a, needle) { - return true - } - } - return false -} - -// Verify optional parameters are of the correct type. -func typeCheckParameter(obj interface{}, expected string, name string) error { - // Make sure there is an object. - if obj == nil { - return nil - } - - // Check the type is as expected. - if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) - } - return nil -} - -func parameterValueToString( obj interface{}, key string ) string { - if reflect.TypeOf(obj).Kind() != reflect.Ptr { - return fmt.Sprintf("%v", obj) - } - var param,ok = obj.(MappedNullable) - if !ok { - return "" - } - dataMap,err := param.ToMap() - if err != nil { - return "" - } - return fmt.Sprintf("%v", dataMap[key]) -} - -// parameterAddToHeaderOrQuery adds the provided object to the request header or url query -// supporting deep object syntax -func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { - var v = reflect.ValueOf(obj) - var value = "" - if v == reflect.ValueOf(nil) { - value = "null" - } else { - switch v.Kind() { - case reflect.Invalid: - value = "invalid" - - case reflect.Struct: - if t,ok := obj.(MappedNullable); ok { - dataMap,err := t.ToMap() - if err != nil { - return - } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) - return - } - if t, ok := obj.(time.Time); ok { - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) - return - } - value = v.Type().String() + " value" - case reflect.Slice: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { - return - } - var lenIndValue = indValue.Len() - for i:=0;i 0 || (len(formFiles) > 0) { - if body != nil { - return nil, errors.New("Cannot specify postBody and multipart form at the same time.") - } - body = &bytes.Buffer{} - w := multipart.NewWriter(body) - - for k, v := range formParams { - for _, iv := range v { - if strings.HasPrefix(k, "@") { // file - err = addFile(w, k[1:], iv) - if err != nil { - return nil, err - } - } else { // form value - w.WriteField(k, iv) - } - } - } - for _, formFile := range formFiles { - if len(formFile.fileBytes) > 0 && formFile.fileName != "" { - w.Boundary() - part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) - if err != nil { - return nil, err - } - _, err = part.Write(formFile.fileBytes) - if err != nil { - return nil, err - } - } - } - - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() - - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - w.Close() - } - - if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { - if body != nil { - return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") - } - body = &bytes.Buffer{} - body.WriteString(formParams.Encode()) - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - } - - // Setup path and query parameters - url, err := url.Parse(path) - if err != nil { - return nil, err - } - - // Override request host, if applicable - if c.cfg.Host != "" { - url.Host = c.cfg.Host - } - - // Override request scheme, if applicable - if c.cfg.Scheme != "" { - url.Scheme = c.cfg.Scheme - } - - // Adding Query Param - query := url.Query() - for k, v := range queryParams { - for _, iv := range v { - query.Add(k, iv) - } - } - - // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { - pieces := strings.Split(s, "=") - pieces[0] = queryDescape.Replace(pieces[0]) - return strings.Join(pieces, "=") - }) - - // Generate a new request - if body != nil { - localVarRequest, err = http.NewRequest(method, url.String(), body) - } else { - localVarRequest, err = http.NewRequest(method, url.String(), nil) - } - if err != nil { - return nil, err - } - - // add header parameters, if any - if len(headerParams) > 0 { - headers := http.Header{} - for h, v := range headerParams { - headers[h] = []string{v} - } - localVarRequest.Header = headers - } - - // Add the user agent to the request. - localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) - - if ctx != nil { - // add context to the request - localVarRequest = localVarRequest.WithContext(ctx) - - // Walk through any authentication. - - {{#hasOAuthMethods}} - // OAuth2 authentication - if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { - // We were able to grab an oauth2 token from the context - var latestToken *oauth2.Token - if latestToken, err = tok.Token(); err != nil { - return nil, err - } - - latestToken.SetAuthHeader(localVarRequest) - } - - {{/hasOAuthMethods}} - {{#hasHttpBasicMethods}} - // Basic HTTP Authentication - if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { - localVarRequest.SetBasicAuth(auth.UserName, auth.Password) - } - - {{/hasHttpBasicMethods}} - {{#hasHttpBearerMethods}} - // AccessToken Authentication - if auth, ok := ctx.Value(ContextAccessToken).(string); ok { - localVarRequest.Header.Add("Authorization", "Bearer "+auth) - } - - {{/hasHttpBearerMethods}} - {{#withAWSV4Signature}} - // AWS Signature v4 Authentication - if auth, ok := ctx.Value(ContextAWSv4).(AWSv4); ok { - creds := awscredentials.NewStaticCredentials(auth.AccessKey, auth.SecretKey, auth.SessionToken) - signer := awsv4.NewSigner(creds) - var reader *strings.Reader - if body == nil { - reader = strings.NewReader("") - } else { - reader = strings.NewReader(body.String()) - } - - // Define default values for region and service to maintain backward compatibility - region := auth.Region - if region == "" { - region = "eu-west-2" - } - service := auth.Service - if service == "" { - service = "oapi" - } - - timestamp := time.Now() - _, err := signer.Sign(localVarRequest, reader, service, region, timestamp) - if err != nil { - return nil, err - } - } - {{/withAWSV4Signature}} - } - - for header, value := range c.cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } -{{#withCustomMiddlewareFunction}} - - if c.cfg.Middleware != nil { - c.cfg.Middleware(localVarRequest) - } - -{{/withCustomMiddlewareFunction}} -{{#hasHttpSignatureMethods}} - if ctx != nil { - // HTTP Signature Authentication. All request headers must be set (including default headers) - // because the headers may be included in the signature. - if auth, ok := ctx.Value(ContextHttpSignatureAuth).(HttpSignatureAuth); ok { - err = SignRequest(ctx, localVarRequest, auth) - if err != nil { - return nil, err - } - } - } -{{/hasHttpSignatureMethods}} - return localVarRequest, nil -} - -func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { - if len(b) == 0 { - return nil - } - if s, ok := v.(*string); ok { - *s = string(b) - return nil - } - if f, ok := v.(*os.File); ok { - f, err = os.CreateTemp("", "HttpClientFile") - if err != nil { - return - } - _, err = f.Write(b) - if err != nil { - return - } - _, err = f.Seek(0, io.SeekStart) - return - } - if f, ok := v.(**os.File); ok { - *f, err = os.CreateTemp("", "HttpClientFile") - if err != nil { - return - } - _, err = (*f).Write(b) - if err != nil { - return - } - _, err = (*f).Seek(0, io.SeekStart) - return - } - if xmlCheck.MatchString(contentType) { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } - if jsonCheck.MatchString(contentType) { - if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas - if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined - if err = unmarshalObj.UnmarshalJSON(b); err != nil { - return err - } - } else { - return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") - } - } else if err = json.Unmarshal(b, v); err != nil { // simple model - return err - } - return nil - } - return errors.New("undefined response type") -} - -// Add a file to the multipart request -func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(filepath.Clean(path)) - if err != nil { - return err - } - err = file.Close() - if err != nil { - return err - } - - part, err := w.CreateFormFile(fieldName, filepath.Base(path)) - if err != nil { - return err - } - _, err = io.Copy(part, file) - - return err -} - -// Prevent trying to import "fmt" -func reportError(format string, a ...interface{}) error { - return fmt.Errorf(format, a...) -} - -// A wrapper for strict JSON decoding -func newStrictDecoder(data []byte) *json.Decoder { - dec := json.NewDecoder(bytes.NewBuffer(data)) - dec.DisallowUnknownFields() - return dec -} - -// Set request body from an interface{} -func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { - if bodyBuf == nil { - bodyBuf = &bytes.Buffer{} - } - - if reader, ok := body.(io.Reader); ok { - _, err = bodyBuf.ReadFrom(reader) - } else if fp, ok := body.(*os.File); ok { - _, err = bodyBuf.ReadFrom(fp) - } else if b, ok := body.([]byte); ok { - _, err = bodyBuf.Write(b) - } else if s, ok := body.(string); ok { - _, err = bodyBuf.WriteString(s) - } else if s, ok := body.(*string); ok { - _, err = bodyBuf.WriteString(*s) - } else if jsonCheck.MatchString(contentType) { - err = json.NewEncoder(bodyBuf).Encode(body) - } else if xmlCheck.MatchString(contentType) { - err = xml.NewEncoder(bodyBuf).Encode(body) - } - - if err != nil { - return nil, err - } - - if bodyBuf.Len() == 0 { - err = fmt.Errorf("invalid body type %s\n", contentType) - return nil, err - } - return bodyBuf, nil -} - -// detectContentType method is used to figure out `Request.Body` content type for request header -func detectContentType(body interface{}) string { - contentType := "text/plain; charset=utf-8" - kind := reflect.TypeOf(body).Kind() - - switch kind { - case reflect.Struct, reflect.Map, reflect.Ptr: - contentType = "application/json; charset=utf-8" - case reflect.String: - contentType = "text/plain; charset=utf-8" - default: - if b, ok := body.([]byte); ok { - contentType = http.DetectContentType(b) - } else if kind == reflect.Slice { - contentType = "application/json; charset=utf-8" - } - } - - return contentType -} - -// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go -type cacheControl map[string]string - -func parseCacheControl(headers http.Header) cacheControl { - cc := cacheControl{} - ccHeader := headers.Get("Cache-Control") - for _, part := range strings.Split(ccHeader, ",") { - part = strings.Trim(part, " ") - if part == "" { - continue - } - if strings.ContainsRune(part, '=') { - keyval := strings.Split(part, "=") - cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") - } else { - cc[part] = "" - } - } - return cc -} - -// CacheExpires helper function to determine remaining time before repeating a request. -func CacheExpires(r *http.Response) time.Time { - // Figure out when the cache expires. - var expires time.Time - now, err := time.Parse(time.RFC1123, r.Header.Get("date")) - if err != nil { - return time.Now() - } - respCacheControl := parseCacheControl(r.Header) - - if maxAge, ok := respCacheControl["max-age"]; ok { - lifetime, err := time.ParseDuration(maxAge + "s") - if err != nil { - expires = now - } else { - expires = now.Add(lifetime) - } - } else { - expiresHeader := r.Header.Get("Expires") - if expiresHeader != "" { - expires, err = time.Parse(time.RFC1123, expiresHeader) - if err != nil { - expires = now - } - } - } - return expires -} - -func strlen(s string) int { - return utf8.RuneCountInString(s) -} - -// GenericOpenAPIError Provides access to the body, error and model on returned errors. -type GenericOpenAPIError struct { - body []byte - error string - model interface{} -} - -// Error returns non-empty string if there was an error. -func (e GenericOpenAPIError) Error() string { - return e.error -} - -// Body returns the raw bytes of the response -func (e GenericOpenAPIError) Body() []byte { - return e.body -} - -// Model returns the unpacked model of the error -func (e GenericOpenAPIError) Model() interface{} { - return e.model -} - -// format error message using title and detail when model implements rfc7807 -func formatErrorMessage(status string, v interface{}) string { - str := "" - metaValue := reflect.ValueOf(v).Elem() - - field := metaValue.FieldByName("Title") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s", field.Interface()) - } - - field = metaValue.FieldByName("Detail") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s (%s)", str, field.Interface()) - } - - // status title (detail) - return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) -} diff --git a/templates/java/jersey3/ApiClient.mustache b/templates/java/jersey3/ApiClient.mustache deleted file mode 100644 index feb0787..0000000 --- a/templates/java/jersey3/ApiClient.mustache +++ /dev/null @@ -1,1501 +0,0 @@ -package {{invokerPackage}}; - -import {{javaxPackage}}.ws.rs.client.Client; -import {{javaxPackage}}.ws.rs.client.ClientBuilder; -import {{javaxPackage}}.ws.rs.client.Entity; -import {{javaxPackage}}.ws.rs.client.Invocation; -import {{javaxPackage}}.ws.rs.client.WebTarget; -import {{javaxPackage}}.ws.rs.core.Form; -import {{javaxPackage}}.ws.rs.core.GenericType; -import {{javaxPackage}}.ws.rs.core.MediaType; -import {{javaxPackage}}.ws.rs.core.Response; -import {{javaxPackage}}.ws.rs.core.Response.Status; -import org.json.JSONObject; - -{{#hasOAuthMethods}} -import com.github.scribejava.core.model.OAuth2AccessToken; -{{/hasOAuthMethods}} -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.client.HttpUrlConnectorProvider; -import org.glassfish.jersey.jackson.JacksonFeature; -import org.glassfish.jersey.media.multipart.FormDataBodyPart; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.MultiPart; -import org.glassfish.jersey.media.multipart.MultiPartFeature; - -import java.io.IOException; -import java.io.InputStream; - -import java.net.URI; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.security.cert.X509Certificate; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import org.glassfish.jersey.logging.LoggingFeature; -import java.util.AbstractMap.SimpleEntry; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Map.Entry; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Date; -import java.util.stream.Collectors; -import java.util.stream.Stream; -{{#jsr310}} -import java.time.OffsetDateTime; -{{/jsr310}} - -import java.net.URLEncoder; - -import java.io.File; -import java.io.UnsupportedEncodingException; - -import java.text.DateFormat; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import {{invokerPackage}}.auth.Authentication; -import {{invokerPackage}}.auth.HttpBasicAuth; -import {{invokerPackage}}.auth.HttpBearerAuth; -{{#hasHttpSignatureMethods}} -import {{invokerPackage}}.auth.HttpSignatureAuth; -{{/hasHttpSignatureMethods}} -import {{invokerPackage}}.auth.ApiKeyAuth; -{{#hasOAuthMethods}} -import {{invokerPackage}}.auth.OAuth; -{{/hasOAuthMethods}} - -/** - *

ApiClient class.

- */ -{{>generatedAnnotation}} -public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { - private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); - - protected Map defaultHeaderMap = new HashMap<>(); - protected Map defaultCookieMap = new HashMap<>(); - protected String basePath = "{{{basePath}}}"; - protected String userAgent; - private static final Logger log = Logger.getLogger(ApiClient.class.getName()); - - JSONObject conektaUserAgent = getConektaUserAgent(); - - private JSONObject getConektaUserAgent() { - JSONObject userAgent = new JSONObject(); - userAgent.put("bindings_version", "{{artifactVersion}}"); - userAgent.put("lang", "java"); - userAgent.put("lang_version", System.getProperty("java.version")); - userAgent.put("publisher", "conekta"); - return userAgent; - } - - protected List servers = new ArrayList<>({{#servers}}{{#-first}}Arrays.asList( -{{/-first}} new ServerConfiguration( - "{{{url}}}", - "{{{description}}}{{^description}}No description provided{{/description}}", - {{^variables}} - new LinkedHashMap<>() - {{/variables}} - {{#variables}} - {{#-first}} - Stream.>of( - {{/-first}} - new SimpleEntry<>("{{{name}}}", new ServerVariable( - "{{{description}}}{{^description}}No description provided{{/description}}", - "{{{defaultValue}}}", - new LinkedHashSet<>({{#enumValues}}{{#-first}}Arrays.asList({{/-first}} - "{{{.}}}"{{^-last}},{{/-last}}{{#-last}} - ){{/-last}}{{/enumValues}}) - )){{^-last}},{{/-last}} - {{#-last}} - ).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (a, b) -> a, LinkedHashMap::new)) - {{/-last}} - {{/variables}} - ){{^-last}},{{/-last}} - {{#-last}} - ){{/-last}}{{/servers}}); - protected Integer serverIndex = 0; - protected Map serverVariables = null; - {{^hasOperationServers}} - protected Map> operationServers = new LinkedHashMap<>(); - {{/hasOperationServers}} - {{#hasOperationServers}} - protected Map> operationServers; - - { - Map> operationServers = new LinkedHashMap<>(); - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#servers}} - {{#-first}} - operationServers.put("{{{classname}}}.{{{operationId}}}", new ArrayList<>(Arrays.asList( - {{/-first}} - new ServerConfiguration( - "{{{url}}}", - "{{{description}}}{{^description}}No description provided{{/description}}", - {{^variables}} - new LinkedHashMap<>() - {{/variables}} - {{#variables}} - {{#-first}} - Stream.>of( - {{/-first}} - new SimpleEntry<>("{{{name}}}", new ServerVariable( - "{{{description}}}{{^description}}No description provided{{/description}}", - "{{{defaultValue}}}", - new LinkedHashSet<>({{#enumValues}}{{#-first}}Arrays.asList({{/-first}} - "{{{.}}}"{{^-last}},{{/-last}}{{#-last}} - ){{/-last}}{{/enumValues}}) - )){{^-last}},{{/-last}} - {{#-last}} - ).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (a, b) -> a, LinkedHashMap::new)) - {{/-last}} - {{/variables}} - ){{^-last}},{{/-last}} - {{#-last}} - ))); - {{/-last}} - {{/servers}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} - this.operationServers = operationServers; - } - - {{/hasOperationServers}} - protected Map operationServerIndex = new HashMap<>(); - protected Map> operationServerVariables = new HashMap<>(); - protected boolean debugging = false; - protected ClientConfig clientConfig; - protected int connectionTimeout = 0; - private int readTimeout = 0; - - protected Client httpClient; - protected JSON json; - protected String tempFolderPath = null; - - protected Map authentications; - protected Map authenticationLookup; - - protected DateFormat dateFormat; - - /** - * Constructs a new ApiClient with default parameters. - */ - public ApiClient() { - this(null); - } - - /** - * Constructs a new ApiClient with the specified authentication parameters. - * - * @param authMap A hash map containing authentication parameters. - */ - public ApiClient(Map authMap) { - json = new JSON(); - httpClient = buildHttpClient(); - - this.dateFormat = new RFC3339DateFormat(); - - // Set default User-Agent. - setUserAgent("{{{httpUserAgent}}}{{artifactVersion}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); - - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap<>(); - Authentication auth = null; - {{#authMethods}} - if (authMap != null) { - auth = authMap.get("{{name}}"); - } - {{#isBasic}} - {{#isBasicBasic}} - if (auth instanceof HttpBasicAuth) { - authentications.put("{{name}}", auth); - } else { - authentications.put("{{name}}", new HttpBasicAuth()); - } - {{/isBasicBasic}} - {{#isBasicBearer}} - if (auth instanceof HttpBearerAuth) { - authentications.put("{{name}}", auth); - } else { - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}")); - } - {{/isBasicBearer}} - {{#isHttpSignature}} - if (auth instanceof HttpSignatureAuth) { - authentications.put("{{name}}", auth); - } - {{/isHttpSignature}} - {{/isBasic}} - {{#isApiKey}} - if (auth instanceof ApiKeyAuth) { - authentications.put("{{name}}", auth); - } else { - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}")); - } - {{/isApiKey}} - {{#isOAuth}} - if (auth instanceof OAuth) { - authentications.put("{{name}}", auth); - } else { - authentications.put("{{name}}", new OAuth(basePath, "{{{tokenUrl}}}")); - } - {{/isOAuth}} - {{/authMethods}} - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - - // Setup authentication lookup (key: authentication alias, value: authentication name) - authenticationLookup = new HashMap<>();{{#authMethods}}{{#vendorExtensions.x-auth-id-alias}} - authenticationLookup.put("{{name}}", "{{.}}");{{/vendorExtensions.x-auth-id-alias}}{{/authMethods}} - } - - /** - * Gets the JSON instance to do JSON serialization and deserialization. - * - * @return JSON - */ - public JSON getJSON() { - return json; - } - - /** - *

Getter for the field httpClient.

- * - * @return a {@link {{javaxPackage}}.ws.rs.client.Client} object. - */ - public Client getHttpClient() { - return httpClient; - } - - /** - *

Setter for the field httpClient.

- * - * @param httpClient a {@link {{javaxPackage}}.ws.rs.client.Client} object. - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setHttpClient(Client httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Returns the base URL to the location where the OpenAPI document is being served. - * - * @return The base URL to the target host. - */ - public String getBasePath() { - return basePath; - } - - /** - * Sets the base URL to the location where the OpenAPI document is being served. - * - * @param basePath The base URL to the target host. - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - {{#hasOAuthMethods}} - setOauthBasePath(basePath); - {{/hasOAuthMethods}} - return this; - } - - /** - *

Getter for the field servers.

- * - * @return a {@link java.util.List} of servers. - */ - public List getServers() { - return servers; - } - - /** - *

Setter for the field servers.

- * - * @param servers a {@link java.util.List} of servers. - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setServers(List servers) { - this.servers = servers; - updateBasePath(); - return this; - } - - /** - *

Getter for the field serverIndex.

- * - * @return a {@link java.lang.Integer} object. - */ - public Integer getServerIndex() { - return serverIndex; - } - - /** - *

Setter for the field serverIndex.

- * - * @param serverIndex the server index - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setServerIndex(Integer serverIndex) { - this.serverIndex = serverIndex; - updateBasePath(); - return this; - } - - /** - *

Getter for the field serverVariables.

- * - * @return a {@link java.util.Map} of server variables. - */ - public Map getServerVariables() { - return serverVariables; - } - - /** - *

Setter for the field serverVariables.

- * - * @param serverVariables a {@link java.util.Map} of server variables. - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setServerVariables(Map serverVariables) { - this.serverVariables = serverVariables; - updateBasePath(); - return this; - } - - private void updateBasePath() { - if (serverIndex != null) { - setBasePath(servers.get(serverIndex).URL(serverVariables)); - } - } - - {{#hasOAuthMethods}} - private void setOauthBasePath(String basePath) { - for(Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setBasePath(basePath); - } - } - } - - {{/hasOAuthMethods}} - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication object - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - * - * @param username Username - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return this; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - * - * @param password Password - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return this; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - * - * @param apiKey API key - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return this; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to configure authentications which respects aliases of API keys. - * - * @param secrets Hash map from authentication name to its secret. - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient configureApiKeys(Map secrets) { - for (Map.Entry authEntry : authentications.entrySet()) { - Authentication auth = authEntry.getValue(); - if (auth instanceof ApiKeyAuth) { - String name = authEntry.getKey(); - // respect x-auth-id-alias property - name = authenticationLookup.getOrDefault(name, name); - String secret = secrets.get(name); - if (secret != null) { - ((ApiKeyAuth) auth).setApiKey(secret); - } - } - } - return this; - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * - * @param apiKeyPrefix API key prefix - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return this; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set bearer token for the first Bearer authentication. - * - * @param bearerToken Bearer token - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setBearerToken(String bearerToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBearerAuth) { - ((HttpBearerAuth) auth).setBearerToken(bearerToken); - return this; - } - } - throw new RuntimeException("No Bearer authentication configured!"); - } - - {{#hasOAuthMethods}} - /** - * Helper method to set access token for the first OAuth2 authentication. - * - * @param accessToken Access token - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setAccessToken(String accessToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set the credentials for the first OAuth2 authentication. - * - * @param clientId the client ID - * @param clientSecret the client secret - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setOauthCredentials(String clientId, String clientSecret) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setCredentials(clientId, clientSecret, isDebugging()); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set the credentials of a public client for the first OAuth2 authentication. - * - * @param clientId the client ID - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setOauthCredentialsForPublicClient(String clientId) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setCredentialsForPublicClient(clientId, isDebugging()); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set the password flow for the first OAuth2 authentication. - * - * @param username the user name - * @param password the user password - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setOauthPasswordFlow(String username, String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).usePasswordFlow(username, password); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set the authorization code flow for the first OAuth2 authentication. - * - * @param code the authorization code - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setOauthAuthorizationCodeFlow(String code) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).useAuthorizationCodeFlow(code); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Helper method to set the scopes for the first OAuth2 authentication. - * - * @param scope the oauth scope - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setOauthScope(String scope) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setScope(scope); - return this; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - {{/hasOAuthMethods}} - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent Http user agent - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setUserAgent(String userAgent) { - this.userAgent = userAgent; - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Get the User-Agent header's value. - * - * @return User-Agent string - */ - public String getUserAgent(){ - return userAgent; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key The cookie's key - * @param value The cookie's value - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient addDefaultCookie(String key, String value) { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Gets the client config. - * - * @return Client config - */ - public ClientConfig getClientConfig() { - return clientConfig; - } - - /** - * Set the client config. - * - * @param clientConfig Set the client config - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setClientConfig(ClientConfig clientConfig) { - this.clientConfig = clientConfig; - // Rebuild HTTP Client according to the new "clientConfig" value. - this.httpClient = buildHttpClient(); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is switched on - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setDebugging(boolean debugging) { - this.debugging = debugging; - // Rebuild HTTP Client according to the new "debugging" value. - this.httpClient = buildHttpClient(); - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default temporary folder. - * - * @return Temp folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set temp folder path - * - * @param tempFolderPath Temp folder path - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Connect timeout (in milliseconds). - * - * @return Connection timeout - */ - public int getConnectTimeout() { - return connectionTimeout; - } - - /** - * Set the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param connectionTimeout Connection timeout in milliseconds - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - this.connectionTimeout = connectionTimeout; - httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); - return this; - } - - /** - * read timeout (in milliseconds). - * - * @return Read timeout - */ - public int getReadTimeout() { - return readTimeout; - } - - /** - * Set the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param readTimeout Read timeout in milliseconds - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setReadTimeout(int readTimeout) { - this.readTimeout = readTimeout; - httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); - return this; - } - - /** - * Get the date format used to parse/format date parameters. - * - * @return Date format - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - * Set the date format used to parse/format date parameters. - * - * @param dateFormat Date format - * @return a {@link {{apiPackage}}.ApiClient} object. - */ - public ApiClient setDateFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - // also set the date format for model (de)serialization with Date properties - this.json.setDateFormat((DateFormat) dateFormat.clone()); - return this; - } - - /** - * Parse the given string into Date object. - * - * @param str String - * @return Date - */ - public Date parseDate(String str) { - try { - return dateFormat.parse(str); - } catch (java.text.ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * Format the given Date object into string. - * - * @param date Date - * @return Date in string format - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } - - /** - * Format the given parameter object into string. - * - * @param param Object - * @return Object in string format - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDate((Date) param); - } {{#jsr310}}else if (param instanceof OffsetDateTime) { - return formatOffsetDateTime((OffsetDateTime) param); - } {{/jsr310}}else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { - if(b.length() > 0) { - b.append(','); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /* - * Format to {@code Pair} objects. - * - * @param collectionFormat Collection format - * @param name Name - * @param value Value - * @return List of pairs - */ - public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList<>(); - - // preconditions - if (name == null || name.isEmpty() || value == null) return params; - - Collection valueCollection; - if (value instanceof Collection) { - valueCollection = (Collection) value; - } else { - params.add(new Pair(name, parameterToString(value))); - return params; - } - - if (valueCollection.isEmpty()){ - return params; - } - - // get the collection format (default: csv) - String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); - - // create the params based on the collection format - if ("multi".equals(format)) { - for (Object item : valueCollection) { - params.add(new Pair(name, parameterToString(item))); - } - - return params; - } - - String delimiter = ","; - - if ("csv".equals(format)) { - delimiter = ","; - } else if ("ssv".equals(format)) { - delimiter = " "; - } else if ("tsv".equals(format)) { - delimiter = "\t"; - } else if ("pipes".equals(format)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : valueCollection) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - params.add(new Pair(name, sb.substring(1))); - - return params; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "*{@literal /}*" is also considered JSON by this method. - * - * @param mime MIME - * @return True if the MIME type is JSON - */ - public boolean isJsonMime(String mime) { - return mime != null && (mime.equals("*/*") || JSON_MIME_PATTERN.matcher(mime).matches()); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String... accepts) { - if (accepts == null || accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. - */ - public String selectHeaderContentType(String... contentTypes) { - if (contentTypes == null || contentTypes.length == 0) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - * - * @param str String - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Serialize the given Java object into string entity according the given - * Content-Type (only JSON is supported for now). - * - * @param obj Object - * @param formParams Form parameters - * @param contentType Context type - * @return Entity - * @throws ApiException API exception - */ - public Entity serialize(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { - Entity entity; - if (contentType.startsWith("multipart/form-data")) { - MultiPart multiPart = new MultiPart(); - for (Entry param: formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) - .fileName(file.getName()).size(file.length()).build(); - - // Attempt to probe the content type for the file so that the form part is more correctly - // and precisely identified, but fall back to application/octet-stream if that fails. - MediaType type; - try { - type = MediaType.valueOf(Files.probeContentType(file.toPath())); - } catch (IOException | IllegalArgumentException e) { - type = MediaType.APPLICATION_OCTET_STREAM_TYPE; - } - - multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, type)); - } else { - FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); - multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); - } - } - entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); - } else if (contentType.startsWith("application/x-www-form-urlencoded")) { - Form form = new Form(); - for (Entry param: formParams.entrySet()) { - form.param(param.getKey(), parameterToString(param.getValue())); - } - entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); - } else { - // We let jersey handle the serialization - if (isBodyNullable) { // payload is nullable - if (obj instanceof String) { - entity = Entity.entity(obj == null ? "null" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); - } else { - entity = Entity.entity(obj == null ? "null" : obj, contentType); - } - } else { - if (obj instanceof String) { - entity = Entity.entity(obj == null ? "" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); - } else { - entity = Entity.entity(obj == null ? "" : obj, contentType); - } - } - } - return entity; - } - - /** - * Serialize the given Java object into string according the given - * Content-Type (only JSON, HTTP form is supported for now). - * - * @param obj Object - * @param formParams Form parameters - * @param contentType Context type - * @param isBodyNullable True if the body is nullable - * @return String - * @throws ApiException API exception - */ - public String serializeToString(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { - try { - if (contentType.startsWith("multipart/form-data")) { - throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); - } else if (contentType.startsWith("application/x-www-form-urlencoded")) { - String formString = ""; - for (Entry param : formParams.entrySet()) { - formString = param.getKey() + "=" + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + "&"; - } - - if (formString.length() == 0) { // empty string - return formString; - } else { - return formString.substring(0, formString.length() - 1); - } - } else { - if (isBodyNullable) { - return obj == null ? "null" : json.getMapper().writeValueAsString(obj); - } else { - return obj == null ? "" : json.getMapper().writeValueAsString(obj); - } - } - } catch (Exception ex) { - throw new ApiException("Failed to perform serializeToString: " + ex.toString()); - } - } - - /** - * Deserialize response body to Java object according to the Content-Type. - * - * @param Type - * @param response Response - * @param returnType Return type - * @return Deserialize object - * @throws ApiException API exception - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, GenericType returnType) throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - return (T) response.readEntity(byte[].class); - } else if (returnType.getRawType() == File.class) { - // Handle file downloading. - T file = (T) downloadFileFromResponse(response); - return file; - } - - // read the entity stream multiple times - response.bufferEntity(); - - return response.readEntity(returnType); - } - - /** - * Download file from the given response. - * - * @param response Response - * @return File - * @throws ApiException If fail to read file content from response and write to disk - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - *

Prepare the file for download from the response.

- * - * @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object. - * @return a {@link java.io.File} object. - * @throws java.io.IOException if any. - */ - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) - filename = matcher.group(1); - } - - String prefix; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf('.'); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; - } - - if (tempFolderPath == null) - return Files.createTempFile(prefix, suffix).toFile(); - else - return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); - } - - /** - * Invoke API by sending HTTP request with the given options. - * - * @param Type - * @param operation The qualified name of the operation - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param accept The request's Accept header - * @param contentType The request's Content-Type header - * @param authNames The authentications to apply - * @param returnType The return type into which to deserialize the response - * @param isBodyNullable True if the body is nullable - * @return The response body in type of string - * @throws ApiException API exception - */ - public ApiResponse invokeAPI( - String operation, - String path, - String method, - List queryParams, - Object body, - Map headerParams, - Map cookieParams, - Map formParams, - String accept, - String contentType, - String[] authNames, - GenericType returnType, - boolean isBodyNullable) - throws ApiException { - - String targetURL; - List serverConfigurations; - if (serverIndex != null && (serverConfigurations = operationServers.get(operation)) != null) { - int index = operationServerIndex.getOrDefault(operation, serverIndex).intValue(); - Map variables = operationServerVariables.getOrDefault(operation, serverVariables); - if (index < 0 || index >= serverConfigurations.size()) { - throw new ArrayIndexOutOfBoundsException( - String.format( - "Invalid index %d when selecting the host settings. Must be less than %d", - index, serverConfigurations.size())); - } - targetURL = serverConfigurations.get(index).URL(variables) + path; - } else { - targetURL = this.basePath + path; - } - // Not using `.target(targetURL).path(path)` below, - // to support (constant) query string in `path`, e.g. "/posts?draft=1" - WebTarget target = httpClient.target(targetURL); - - if (queryParams != null) { - for (Pair queryParam : queryParams) { - if (queryParam.getValue() != null) { - target = target.queryParam(queryParam.getName(), escapeString(queryParam.getValue())); - } - } - } - - Invocation.Builder invocationBuilder = target.request(); - - if (accept != null) { - invocationBuilder = invocationBuilder.accept(accept); - } - - for (Entry entry : cookieParams.entrySet()) { - String value = entry.getValue(); - if (value != null) { - invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); - } - } - - for (Entry entry : defaultCookieMap.entrySet()) { - String value = entry.getValue(); - if (value != null) { - invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); - } - } - - Entity entity = serialize(body, formParams, contentType, isBodyNullable); - - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - allHeaderParams.put("X-Conekta-Client-User-Agent", conektaUserAgent.toString()); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - {{#hasHttpSignatureMethods}} - serializeToString(body, formParams, contentType, isBodyNullable), - {{/hasHttpSignatureMethods}} - {{^hasHttpSignatureMethods}} - null, - {{/hasHttpSignatureMethods}} - method, - target.getUri()); - } - - for (Entry entry : allHeaderParams.entrySet()) { - String value = entry.getValue(); - if (value != null) { - invocationBuilder = invocationBuilder.header(entry.getKey(), value); - } - } - - Response response = null; - - try { - response = sendRequest(method, invocationBuilder, entity); - - final int statusCode = response.getStatusInfo().getStatusCode(); - - {{#hasOAuthMethods}} - // If OAuth is used and a status 401 is received, renew the access token and retry the request - if (authNames != null && statusCode == Status.UNAUTHORIZED.getStatusCode()) { - for (String authName : authNames) { - Authentication authentication = authentications.get(authName); - if (authentication instanceof OAuth) { - OAuth2AccessToken accessToken = ((OAuth) authentication).renewAccessToken(); - if (accessToken != null) { - invocationBuilder.header("Authorization", null); - invocationBuilder.header("Authorization", "Bearer " + accessToken.getAccessToken()); - response = sendRequest(method, invocationBuilder, entity); - } - break; - } - } - } - - {{/hasOAuthMethods}} - Map> responseHeaders = buildResponseHeaders(response); - - if (statusCode == Status.NO_CONTENT.getStatusCode()) { - return new ApiResponse(statusCode, responseHeaders); - } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { - if (returnType == null) { - return new ApiResponse(statusCode, responseHeaders); - } else { - return new ApiResponse(statusCode, responseHeaders, deserialize(response, returnType)); - } - } else { - String message = "error"; - String respBody = null; - if (response.hasEntity()) { - try { - respBody = String.valueOf(response.readEntity(String.class)); - message = respBody; - } catch (RuntimeException e) { - // e.printStackTrace(); - } - } - throw new ApiException( - response.getStatus(), message, buildResponseHeaders(response), respBody); - } - } finally { - try { - response.close(); - } catch (Exception e) { - // it's not critical, since the response object is local in method invokeAPI; that's fine, - // just continue - } - } - } - - private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity entity) { - Response response; - if ("POST".equals(method)) { - response = invocationBuilder.post(entity); - } else if ("PUT".equals(method)) { - response = invocationBuilder.put(entity); - } else if ("DELETE".equals(method)) { - response = invocationBuilder.method("DELETE", entity); - } else if ("PATCH".equals(method)) { - response = invocationBuilder.method("PATCH", entity); - } else { - response = invocationBuilder.method(method); - } - return response; - } - - /** - * @deprecated Add qualified name of the operation as a first parameter. - */ - @Deprecated - public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, boolean isBodyNullable) throws ApiException { - return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable); - } - - /** - * Build the Client used to make HTTP requests. - * - * @return Client - */ - protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); - - ClientBuilder clientBuilder = ClientBuilder.newBuilder(); - customizeClientBuilder(clientBuilder); - clientBuilder = clientBuilder.withConfig(clientConfig); - return clientBuilder.build(); - } - - /** - * Get the default client config. - * - * @return Client config - */ - public ClientConfig getDefaultClientConfig() { - ClientConfig clientConfig = new ClientConfig(); - clientConfig.register(MultiPartFeature.class); - clientConfig.register(json); - clientConfig.register(JacksonFeature.class); - clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); - // turn off compliance validation to be able to send payloads with DELETE calls - clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); - if (debugging) { - clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); - clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); - // Set logger to ALL - java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL); - } else { - // suppress warnings for payloads with DELETE calls: - java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); - } - - return clientConfig; - } - - /** - * Customize the client builder. - * - * This method can be overridden to customize the API client. For example, this can be used to: - * 1. Set the hostname verifier to be used by the client to verify the endpoint's hostname - * against its identification information. - * 2. Set the client-side key store. - * 3. Set the SSL context that will be used when creating secured transport connections to - * server endpoints from web targets created by the client instance that is using this SSL context. - * 4. Set the client-side trust store. - * - * To completely disable certificate validation (at your own risk), you can - * override this method and invoke disableCertificateValidation(clientBuilder). - * - * @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object. - */ - protected void customizeClientBuilder(ClientBuilder clientBuilder) { - // No-op extension point - } - - /** - * Disable X.509 certificate validation in TLS connections. - * - * Please note that trusting all certificates is extremely risky. - * This may be useful in a development environment with self-signed certificates. - * - * @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object. - * @throws java.security.KeyManagementException if any. - * @throws java.security.NoSuchAlgorithmException if any. - */ - protected void disableCertificateValidation(ClientBuilder clientBuilder) throws KeyManagementException, NoSuchAlgorithmException { - TrustManager[] trustAllCerts = new X509TrustManager[] { - new X509TrustManager() { - @Override - public X509Certificate[] getAcceptedIssuers() { - return null; - } - @Override - public void checkClientTrusted(X509Certificate[] certs, String authType) { - } - @Override - public void checkServerTrusted(X509Certificate[] certs, String authType) { - } - } - }; - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(null, trustAllCerts, new SecureRandom()); - clientBuilder.sslContext(sslContext); - } - - /** - *

Build the response headers.

- * - * @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object. - * @return a {@link java.util.Map} of response headers. - */ - protected Map> buildResponseHeaders(Response response) { - Map> responseHeaders = new HashMap<>(); - for (Entry> entry: response.getHeaders().entrySet()) { - List values = entry.getValue(); - List headers = new ArrayList<>(); - for (Object o : values) { - headers.add(String.valueOf(o)); - } - responseHeaders.put(entry.getKey(), headers); - } - return responseHeaders; - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - * @param method HTTP method (e.g. POST) - * @param uri HTTP URI - */ - protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, - Map cookieParams, String payload, String method, URI uri) throws ApiException { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) { - continue; - } - auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); - } - } -} \ No newline at end of file diff --git a/templates/java/jersey3/JSON.mustache b/templates/java/jersey3/JSON.mustache deleted file mode 100644 index 8ab90e4..0000000 --- a/templates/java/jersey3/JSON.mustache +++ /dev/null @@ -1,261 +0,0 @@ -package {{invokerPackage}}; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.json.JsonMapper; -{{#openApiNullable}} -import org.openapitools.jackson.nullable.JsonNullableModule; -{{/openApiNullable}} -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -{{#joda}} -import com.fasterxml.jackson.datatype.joda.JodaModule; -{{/joda}} -{{#models.0}} -import {{modelPackage}}.*; -{{/models.0}} - -import java.text.DateFormat; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import {{javaxPackage}}.ws.rs.core.GenericType; -import {{javaxPackage}}.ws.rs.ext.ContextResolver; - -{{>generatedAnnotation}} -public class JSON implements ContextResolver { - private ObjectMapper mapper; - - public JSON() { - mapper = JsonMapper.builder() - .serializationInclusion(JsonInclude.Include.NON_NULL) - .configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false) - .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) - .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true) - .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) - .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) - .defaultDateFormat(new RFC3339DateFormat()) - .addModule(new JavaTimeModule()) - {{#joda}} - .addModule(new JodaModule()) - {{/joda}} - {{#openApiNullable}} - .addModule(new JsonNullableModule()) - {{/openApiNullable}} - .build(); - } - - /** - * Set the date format for JSON (de)serialization with Date properties. - * @param dateFormat Date format - */ - public void setDateFormat(DateFormat dateFormat) { - mapper.setDateFormat(dateFormat); - } - - @Override - public ObjectMapper getContext(Class type) { - return mapper; - } - - /** - * Get the object mapper - * - * @return object mapper - */ - public ObjectMapper getMapper() { return mapper; } - - /** - * Returns the target model class that should be used to deserialize the input data. - * The discriminator mappings are used to determine the target model class. - * - * @param node The input data. - * @param modelClass The class that contains the discriminator mappings. - */ - public static Class getClassForElement(JsonNode node, Class modelClass) { - ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); - if (cdm != null) { - return cdm.getClassForElement(node, new HashSet>()); - } - return null; - } - - /** - * Helper class to register the discriminator mappings. - */ - private static class ClassDiscriminatorMapping { - // The model class name. - Class modelClass; - // The name of the discriminator property. - String discriminatorName; - // The discriminator mappings for a model class. - Map> discriminatorMappings; - - // Constructs a new class discriminator. - ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { - modelClass = cls; - discriminatorName = propertyName; - discriminatorMappings = new HashMap>(); - if (mappings != null) { - discriminatorMappings.putAll(mappings); - } - } - - // Return the name of the discriminator property for this model class. - String getDiscriminatorPropertyName() { - return discriminatorName; - } - - // Return the discriminator value or null if the discriminator is not - // present in the payload. - String getDiscriminatorValue(JsonNode node) { - // Determine the value of the discriminator property in the input data. - if (discriminatorName != null) { - // Get the value of the discriminator property, if present in the input payload. - node = node.get(discriminatorName); - if (node != null && node.isValueNode()) { - String discrValue = node.asText(); - if (discrValue != null) { - return discrValue; - } - } - } - return null; - } - - /** - * Returns the target model class that should be used to deserialize the input data. - * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. - * The discriminator mappings are used to determine the target model class. - * - * @param node The input data. - * @param visitedClasses The set of classes that have already been visited. - */ - Class getClassForElement(JsonNode node, Set> visitedClasses) { - if (visitedClasses.contains(modelClass)) { - // Class has already been visited. - return null; - } - // Determine the value of the discriminator property in the input data. - String discrValue = getDiscriminatorValue(node); - if (discrValue == null) { - return null; - } - Class cls = discriminatorMappings.get(discrValue); - // It may not be sufficient to return this cls directly because that target class - // may itself be a composed schema, possibly with its own discriminator. - visitedClasses.add(modelClass); - for (Class childClass : discriminatorMappings.values()) { - ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); - if (childCdm == null) { - continue; - } - if (!discriminatorName.equals(childCdm.discriminatorName)) { - discrValue = getDiscriminatorValue(node); - if (discrValue == null) { - continue; - } - } - if (childCdm != null) { - // Recursively traverse the discriminator mappings. - Class childDiscr = childCdm.getClassForElement(node, visitedClasses); - if (childDiscr != null) { - return childDiscr; - } - } - } - return cls; - } - } - - /** - * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. - * - * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, - * so it's not possible to use the instanceof keyword. - * - * @param modelClass A OpenAPI model class. - * @param inst The instance object. - */ - public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { - if (modelClass.isInstance(inst)) { - // This handles the 'allOf' use case with single parent inheritance. - return true; - } - if (visitedClasses.contains(modelClass)) { - // This is to prevent infinite recursion when the composed schemas have - // a circular dependency. - return false; - } - visitedClasses.add(modelClass); - - // Traverse the oneOf/anyOf composed schemas. - Map descendants = modelDescendants.get(modelClass); - if (descendants != null) { - for (GenericType childType : descendants.values()) { - if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) { - return true; - } - } - } - return false; - } - - /** - * A map of discriminators for all model classes. - */ - private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap, ClassDiscriminatorMapping>(); - - /** - * A map of oneOf/anyOf descendants for each model class. - */ - private static Map, Map> modelDescendants = new HashMap, Map>(); - - /** - * Register a model class discriminator. - * - * @param modelClass the model class - * @param discriminatorPropertyName the name of the discriminator property - * @param mappings a map with the discriminator mappings. - */ - public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { - ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); - modelDiscriminators.put(modelClass, m); - } - - /** - * Register the oneOf/anyOf descendants of the modelClass. - * - * @param modelClass the model class - * @param descendants a map of oneOf/anyOf descendants. - */ - public static void registerDescendants(Class modelClass, Map descendants) { - modelDescendants.put(modelClass, descendants); - } - - private static JSON json; - - static - { - json = new JSON(); - } - - /** - * Get the default JSON instance. - * - * @return the default JSON instance - */ - public static JSON getDefault() { - return json; - } - - /** - * Set the default JSON instance. - * - * @param json JSON instance to be used - */ - public static void setDefault(JSON json) { - JSON.json = json; - } -} diff --git a/templates/java/jersey3/README.mustache b/templates/java/jersey3/README.mustache deleted file mode 100644 index d9a45a1..0000000 --- a/templates/java/jersey3/README.mustache +++ /dev/null @@ -1,219 +0,0 @@ -# {{artifactId}} - -{{appName}} - -- API version: {{appVersion}} -{{^hideGenerationTimestamp}} - -- Build date: {{generatedDate}} -{{/hideGenerationTimestamp}} - -{{{appDescriptionWithNewLines}}} - -{{#infoUrl}} - For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* - -## Requirements - -Building the API client library requires: - -1. Java 1.11+ -{{#jersey2}} -2. Maven (3.8.3+)/Gradle (7.2+) -{{/jersey2}} -{{^jersey2}} -2. Maven/Gradle -{{/jersey2}} - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn clean install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn clean deploy -``` - -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. - -### Maven users - -Add this dependency to your project's POM: - -```xml - - {{{groupId}}} - {{{artifactId}}} - {{{artifactVersion}}} - compile - -``` - -### Gradle users - -Add this dependency to your project's build file: - -```groovy - repositories { - mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven central. - mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo. - } - - dependencies { - implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" - } -``` - -### Others - -At first generate the JAR by executing: - -```shell -mvn clean package -``` - -Then manually install the following JARs: - -- `target/{{{artifactId}}}-{{{artifactVersion}}}.jar` -- `target/lib/*.jar` - -{{#jersey2}} -## Usage - -To add a HTTP proxy for the API client, use `ClientConfig`: -```java -import com.conekta.*; -import com.conekta.auth.*; -import com.conekta.model.*; -import com.conekta.CustomersApi; - -public class CustomersApiExample { - - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - - // Configure HTTP bearer authorization: bearerAuth - HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); - bearerAuth.setBearerToken("API_KEY"); - - CustomersApi apiInstance = new CustomersApi(defaultClient); - Customer customer = new Customer(); // Customer | requested field for customer - customer.setName("Customer Name"); - customer.setEmail("customer@mail.com"); - customer.setPhone("55454545454"); - String acceptLanguage = "es"; // String | Use for knowing which language to use - try { - CustomerResponse result = apiInstance.createCustomer(customer, acceptLanguage,null); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling CustomersApi#createCustomer"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -{{/jersey2}} -## Getting Started - -Please follow the [installation](#installation) instruction and execute the following Java code: - -```java -import com.conekta.*; -import com.conekta.auth.*; -import com.conekta.model.*; -import com.conekta.CustomersApi; - -public class CustomersApiExample { - - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - - // Configure HTTP bearer authorization: bearerAuth - HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); - bearerAuth.setBearerToken("API_KEY"); - - CustomersApi apiInstance = new CustomersApi(defaultClient); - Customer customer = new Customer(); // Customer | requested field for customer - customer.setName("Customer Name"); - customer.setEmail("customer@mail.com"); - customer.setPhone("55454545454"); - String acceptLanguage = "es"; // String | Use for knowing which language to use - try { - CustomerResponse result = apiInstance.createCustomer(customer, acceptLanguage,null); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling CustomersApi#createCustomer"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation for Models - -{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) -{{/model}}{{/models}} - - -## Documentation for Authorization - -{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} -{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} -{{#authMethods}} - -### {{name}} - -{{#isApiKey}} - -- **Type**: API key -- **API key parameter name**: {{keyParamName}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} -{{/isApiKey}} -{{#isBasic}} - -- **Type**: HTTP basic authentication -{{/isBasic}} -{{#isOAuth}} - -- **Type**: OAuth -- **Flow**: {{flow}} -- **Authorization URL**: {{authorizationUrl}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - {{scope}}: {{description}} -{{/scopes}} -{{/isOAuth}} - -{{/authMethods}} - -## Recommendation - -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} \ No newline at end of file diff --git a/templates/java/jersey3/pom.mustache b/templates/java/jersey3/pom.mustache deleted file mode 100644 index 9422009..0000000 --- a/templates/java/jersey3/pom.mustache +++ /dev/null @@ -1,419 +0,0 @@ - - 4.0.0 - {{groupId}} - {{artifactId}} - jar - {{artifactId}} - {{artifactVersion}} - {{artifactUrl}} - {{artifactDescription}} - - {{scmConnection}} - {{scmDeveloperConnection}} - {{scmUrl}} - HEAD - - -{{#parentOverridden}} - - {{{parentGroupId}}} - {{{parentArtifactId}}} - {{{parentVersion}}} - -{{/parentOverridden}} - - - - {{licenseName}} - {{licenseUrl}} - repo - - - - - - {{developerName}} - {{developerEmail}} - {{developerOrganization}} - {{developerOrganizationUrl}} - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.2 - - - - test-jar - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.3.0 - - - add_sources - generate-sources - - add-source - - - - src/main/java - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.10.1 - - {{javaMinVersion}} - {{javaMinVersion}} - true - 128m - 512m - - -Xlint:all - -J-Xss4m - - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0 - - - enforce-maven - - enforce - - - - - 2.2.0 - - - - - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory}/lib - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.0 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.3.2 - - - attach-javadocs - - jar - - - - - none - {{javaMinVersion}} - - - http.response.details - a - Http Response Details: - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 3.0.1 - - - sign-artifacts - verify - - sign - - - 0x5F8EB601 - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 - true - - ossrh - https://oss.sonatype.org/ - true - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M5 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - 10 - false - - - - com.diffplug.spotless - spotless-maven-plugin - ${spotless.version} - - - - - - - .gitignore - - - - - - true - 4 - - - - - - - - - - {{javaMinVersion}} - - true - - - - - - - - - - - - org.json - json - ${org-json.version} - - {{#swagger1AnnotationLibrary}} - - io.swagger - swagger-annotations - ${swagger-annotations-version} - - {{/swagger1AnnotationLibrary}} - - - - com.google.code.findbugs - jsr305 - 3.0.2 - - - - - org.glassfish.jersey.core - jersey-client - ${jersey-version} - - - org.glassfish.jersey.inject - jersey-hk2 - ${jersey-version} - - - org.glassfish.jersey.media - jersey-media-multipart - ${jersey-version} - - - org.glassfish.jersey.media - jersey-media-json-jackson - ${jersey-version} - - - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind-version} - - {{#openApiNullable}} - - org.openapitools - jackson-databind-nullable - ${jackson-databind-nullable-version} - - {{/openApiNullable}} - {{#withXml}} - - - org.glassfish.jersey.media - jersey-media-jaxb - ${jersey-version} - - {{/withXml}} - {{#joda}} - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - - {{/joda}} - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} - - {{#hasHttpSignatureMethods}} - - org.tomitribe - tomitribe-http-signatures - ${http-signature-version} - - {{/hasHttpSignatureMethods}} - {{#hasOAuthMethods}} - - com.github.scribejava - scribejava-apis - ${scribejava-apis-version} - - {{/hasOAuthMethods}} - {{#useBeanValidation}} - - - jakarta.validation - jakarta.validation-api - ${beanvalidation-version} - provided - - {{/useBeanValidation}} - - jakarta.annotation - jakarta.annotation-api - ${jakarta-annotation-version} - provided - - - org.glassfish.jersey.connectors - jersey-apache-connector - ${jersey-version} - - - - org.junit.jupiter - junit-jupiter-api - ${junit-version} - test - - - - {{javaMinVersion}} - UTF-8 - 1.6.6 - 3.0.4 - 2.13.4 - 2.13.4.2 - 0.2.4 - 2.1.0 - {{#useBeanValidation}} - 2.0.2 - {{/useBeanValidation}} - 5.8.2 - {{#hasHttpSignatureMethods}} - 1.7 - {{/hasHttpSignatureMethods}} - {{#hasOAuthMethods}} - 8.3.1 - {{/hasOAuthMethods}} - 2.21.0 - 20230227 - - diff --git a/templates/netcore/ApiClient.mustache b/templates/netcore/ApiClient.mustache deleted file mode 100644 index 7c0b4bd..0000000 --- a/templates/netcore/ApiClient.mustache +++ /dev/null @@ -1,915 +0,0 @@ -{{>partial_header}} - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters; -using System.Text; -using System.Threading; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -{{^netStandard}} -using System.Web; -{{/netStandard}} -using Conekta.net.Utils; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using RestSharp; -using RestSharp.Serializers; -using RestSharpMethod = RestSharp.Method; -{{#supportsRetry}} -using Polly; -{{/supportsRetry}} -{{#hasOAuthMethods}} -using {{packageName}}.Client.Auth; -{{/hasOAuthMethods}} - -namespace {{packageName}}.Client -{ - /// - /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. - /// - internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer - { - private readonly IReadableConfiguration _configuration; - private static readonly string _contentType = "application/json"; - private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - public CustomJsonCodec(IReadableConfiguration configuration) - { - _configuration = configuration; - } - - public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) - { - _serializerSettings = serializerSettings; - _configuration = configuration; - } - - /// - /// Serialize the object into a JSON string. - /// - /// Object to be serialized. - /// A JSON string. - public string Serialize(object obj) - { - if (obj != null && obj is {{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema) - { - // the object to be serialized is an oneOf/anyOf schema - return (({{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema)obj).ToJson(); - } - else - { - return JsonConvert.SerializeObject(obj, _serializerSettings); - } - } - - public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); - - public T Deserialize(RestResponse response) - { - var result = (T)Deserialize(response, typeof(T)); - return result; - } - - /// - /// Deserialize the JSON string into a proper object. - /// - /// The HTTP response. - /// Object type. - /// Object representation of the JSON string. - internal object Deserialize(RestResponse response, Type type) - { - if (type == typeof(byte[])) // return byte array - { - return response.RawBytes; - } - - // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) - if (type == typeof(Stream)) - { - var bytes = response.RawBytes; - if (response.Headers != null) - { - var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) - ? Path.GetTempPath() - : _configuration.TempFolderPath; - var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); - foreach (var header in response.Headers) - { - var match = regex.Match(header.ToString()); - if (match.Success) - { - string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); - File.WriteAllBytes(fileName, bytes); - return new FileStream(fileName, FileMode.Open); - } - } - } - var stream = new MemoryStream(bytes); - return stream; - } - - if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object - { - return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind); - } - - if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type - { - return Convert.ChangeType(response.Content, type); - } - - // at this point, it must be a model (json) - try - { - return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); - } - catch (Exception e) - { - throw new ApiException(500, e.Message); - } - } - - public ISerializer Serializer => this; - public IDeserializer Deserializer => this; - - public string[] AcceptedContentTypes => RestSharp.Serializers.ContentType.JsonAccept; - - public SupportsContentType SupportsContentType => contentType => - contentType.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || - contentType.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); - - public string ContentType - { - get { return _contentType; } - set { throw new InvalidOperationException("Not allowed to set content type."); } - } - - public DataFormat DataFormat => DataFormat.Json; - } - {{! NOTE: Any changes related to RestSharp should be done in this class. All other client classes are for extensibility by consumers.}} - /// - /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), - /// encapsulating general REST accessor use cases. - /// - {{>visibility}} partial class ApiClient : ISynchronousClient{{#supportsAsync}}, IAsynchronousClient{{/supportsAsync}} - { - private readonly string _baseUrl; - private readonly string _conektaUserAgent; - - /// - /// Specifies the settings on a object. - /// These settings can be adjusted to accommodate custom serialization rules. - /// - public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - /// - /// Allows for extending request processing for generated code. - /// - /// The RestSharp request object - partial void InterceptRequest(RestRequest request); - - /// - /// Allows for extending response processing for generated code. - /// - /// The RestSharp request object - /// The RestSharp response object - partial void InterceptResponse(RestRequest request, RestResponse response); - - private string GetConektaUserAgent() - { - var values = new Dictionary - { - { "bindings_version", Configuration.Version }, - { "lang", ".net" }, - { "publisher", "conekta" }, - { "conekta_net_target_framework", RuntimeInformation.ConektaNetTargetFramework }, - }; - try - { - values.Add("lang_version", RuntimeInformation.GetRuntimeVersion()); - } - catch (Exception) - { - values.Add("lang_version", "(unknown)"); - } - - try - { - values.Add("os_version", RuntimeInformation.GetOsVersion()); - } - catch (Exception) - { - values.Add("os_version", "(unknown)"); - } - - try - { - values.Add("newtonsoft_json_version", RuntimeInformation.GetNewtonsoftJsonVersion()); - } - catch (Exception) - { - values.Add("newtonsoft_json_version", "(unknown)"); - } - - return Newtonsoft.Json.JsonConvert.SerializeObject(values, Formatting.None); - } - - /// - /// Initializes a new instance of the , defaulting to the global configurations' base url. - /// - public ApiClient() - { - _baseUrl = {{packageName}}.Client.GlobalConfiguration.Instance.BasePath; - _conektaUserAgent = GetConektaUserAgent(); - } - - /// - /// Initializes a new instance of the - /// - /// The target service's base path in URL format. - /// - public ApiClient(string basePath) - { - if (string.IsNullOrEmpty(basePath)) - throw new ArgumentException("basePath cannot be empty"); - - _baseUrl = basePath; - _conektaUserAgent = GetConektaUserAgent(); - } - - /// - /// Constructs the RestSharp version of an http method - /// - /// Swagger Client Custom HttpMethod - /// RestSharp's HttpMethod instance. - /// - private RestSharpMethod Method(HttpMethod method) - { - RestSharpMethod other; - switch (method) - { - case HttpMethod.Get: - other = RestSharpMethod.Get; - break; - case HttpMethod.Post: - other = RestSharpMethod.Post; - break; - case HttpMethod.Put: - other = RestSharpMethod.Put; - break; - case HttpMethod.Delete: - other = RestSharpMethod.Delete; - break; - case HttpMethod.Head: - other = RestSharpMethod.Head; - break; - case HttpMethod.Options: - other = RestSharpMethod.Options; - break; - case HttpMethod.Patch: - other = RestSharpMethod.Patch; - break; - default: - throw new ArgumentOutOfRangeException("method", method, null); - } - - return other; - } - - /// - /// Provides all logic for constructing a new RestSharp . - /// At this point, all information for querying the service is known. Here, it is simply - /// mapped into the RestSharp request. - /// - /// The http verb. - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// [private] A new RestRequest instance. - /// - private RestRequest NewRequest( - HttpMethod method, - string path, - RequestOptions options, - IReadableConfiguration configuration) - { - if (path == null) throw new ArgumentNullException("path"); - if (options == null) throw new ArgumentNullException("options"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - RestRequest request = new RestRequest(path, Method(method)); - request.AddHeader("X-Conekta-Client-User-Agent", _conektaUserAgent); - if (options.PathParameters != null) - { - foreach (var pathParam in options.PathParameters) - { - request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); - } - } - - if (options.QueryParameters != null) - { - foreach (var queryParam in options.QueryParameters) - { - foreach (var value in queryParam.Value) - { - request.AddQueryParameter(queryParam.Key, value); - } - } - } - - if (configuration.DefaultHeaders != null) - { - foreach (var headerParam in configuration.DefaultHeaders) - { - request.AddHeader(headerParam.Key, headerParam.Value); - } - } - - if (options.HeaderParameters != null) - { - foreach (var headerParam in options.HeaderParameters) - { - foreach (var value in headerParam.Value) - { - request.AddHeader(headerParam.Key, value); - } - } - } - - if (options.FormParameters != null) - { - foreach (var formParam in options.FormParameters) - { - request.AddParameter(formParam.Key, formParam.Value); - } - } - - if (options.Data != null) - { - if (options.Data is Stream stream) - { - var contentType = "application/octet-stream"; - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - contentType = contentTypes[0]; - } - - var bytes = ClientUtils.ReadAsBytes(stream); - request.AddParameter(contentType, bytes, ParameterType.RequestBody); - } - else - { - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) - { - request.RequestFormat = DataFormat.Json; - } - else - { - // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. - } - } - else - { - // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. - request.RequestFormat = DataFormat.Json; - } - - request.AddJsonBody(options.Data); - } - } - - if (options.FileParameters != null) - { - foreach (var fileParam in options.FileParameters) - { - foreach (var file in fileParam.Value) - { - var bytes = ClientUtils.ReadAsBytes(file); - var fileStream = file as FileStream; - if (fileStream != null) - request.AddFile(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name)); - else - request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); - } - } - } - - return request; - } - - private ApiResponse ToApiResponse(RestResponse response) - { - T result = response.Data; - string rawContent = response.Content; - - var transformed = new ApiResponse(response.StatusCode, new Multimap({{#caseInsensitiveResponseHeaders}}StringComparer.OrdinalIgnoreCase{{/caseInsensitiveResponseHeaders}}), result, rawContent) - { - ErrorText = response.ErrorMessage, - Cookies = new List() - }; - - if (response.Headers != null) - { - foreach (var responseHeader in response.Headers) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.ContentHeaders != null) - { - foreach (var responseHeader in response.ContentHeaders) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.Cookies != null) - { - foreach (var responseCookies in response.Cookies.Cast()) - { - transformed.Cookies.Add( - new Cookie( - responseCookies.Name, - responseCookies.Value, - responseCookies.Path, - responseCookies.Domain) - ); - } - } - - return transformed; - } - - private ApiResponse Exec(RestRequest req, RequestOptions options, IReadableConfiguration configuration) - { - var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; - - var cookies = new CookieContainer(); - - if (options.Cookies != null && options.Cookies.Count > 0) - { - foreach (var cookie in options.Cookies) - { - cookies.Add(new Cookie(cookie.Name, cookie.Value)); - } - } - - var clientOptions = new RestClientOptions(baseUrl) - { - ClientCertificates = configuration.ClientCertificates, - CookieContainer = cookies, - MaxTimeout = configuration.Timeout, - Proxy = configuration.Proxy, - UserAgent = configuration.UserAgent - }; - - RestClient client = new RestClient(clientOptions) - .UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)); - - {{#hasOAuthMethods}} - if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(configuration.OAuthClientId) && - !string.IsNullOrEmpty(configuration.OAuthClientSecret) && - configuration.OAuthFlow != null) - { - client = client.UseAuthenticator(new OAuthAuthenticator( - configuration.OAuthTokenUrl, - configuration.OAuthClientId, - configuration.OAuthClientSecret, - configuration.OAuthFlow, - SerializerSettings, - configuration)); - } - - {{/hasOAuthMethods}} - InterceptRequest(req); - - RestResponse response; - if (RetryConfiguration.RetryPolicy != null) - { - var policy = RetryConfiguration.RetryPolicy; - var policyResult = policy.ExecuteAndCapture(() => client.Execute(req)); - response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse - { - Request = req, - ErrorException = policyResult.FinalException - }; - } - else - { - response = client.Execute(req); - } - - // if the response type is oneOf/anyOf, call FromJSON to deserialize the data - if (typeof({{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) - { - try - { - response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); - } - catch (Exception ex) - { - throw ex.InnerException != null ? ex.InnerException : ex; - } - } - else if (typeof(T).Name == "Stream") // for binary response - { - response.Data = (T)(object)new MemoryStream(response.RawBytes); - } - else if (typeof(T).Name == "Byte[]") // for byte response - { - response.Data = (T)(object)response.RawBytes; - } - else if (typeof(T).Name == "String") // for string response - { - response.Data = (T)(object)response.Content; - } - - InterceptResponse(req, response); - - var result = ToApiResponse(response); - if (response.ErrorMessage != null) - { - result.ErrorText = response.ErrorMessage; - } - - if (response.Cookies != null && response.Cookies.Count > 0) - { - if (result.Cookies == null) result.Cookies = new List(); - foreach (var restResponseCookie in response.Cookies.Cast()) - { - var cookie = new Cookie( - restResponseCookie.Name, - restResponseCookie.Value, - restResponseCookie.Path, - restResponseCookie.Domain - ) - { - Comment = restResponseCookie.Comment, - CommentUri = restResponseCookie.CommentUri, - Discard = restResponseCookie.Discard, - Expired = restResponseCookie.Expired, - Expires = restResponseCookie.Expires, - HttpOnly = restResponseCookie.HttpOnly, - Port = restResponseCookie.Port, - Secure = restResponseCookie.Secure, - Version = restResponseCookie.Version - }; - - result.Cookies.Add(cookie); - } - } - return result; - } - - {{#supportsAsync}} - private async Task> ExecAsync(RestRequest req, RequestOptions options, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; - - var clientOptions = new RestClientOptions(baseUrl) - { - ClientCertificates = configuration.ClientCertificates, - MaxTimeout = configuration.Timeout, - Proxy = configuration.Proxy, - UserAgent = configuration.UserAgent - }; - - RestClient client = new RestClient(clientOptions) - .UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)); - - {{#hasOAuthMethods}} - if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(configuration.OAuthClientId) && - !string.IsNullOrEmpty(configuration.OAuthClientSecret) && - configuration.OAuthFlow != null) - { - client = client.UseAuthenticator(new OAuthAuthenticator( - configuration.OAuthTokenUrl, - configuration.OAuthClientId, - configuration.OAuthClientSecret, - configuration.OAuthFlow, - SerializerSettings, - configuration)); - } - - {{/hasOAuthMethods}} - InterceptRequest(req); - - RestResponse response; - {{#supportsRetry}} - if (RetryConfiguration.AsyncRetryPolicy != null) - { - var policy = RetryConfiguration.AsyncRetryPolicy; - var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(req, ct), cancellationToken).ConfigureAwait(false); - response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse - { - Request = req, - ErrorException = policyResult.FinalException - }; - } - else - { - {{/supportsRetry}} - response = await client.ExecuteAsync(req, cancellationToken).ConfigureAwait(false); - {{#supportsRetry}} - } - {{/supportsRetry}} - - // if the response type is oneOf/anyOf, call FromJSON to deserialize the data - if (typeof({{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) - { - response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); - } - else if (typeof(T).Name == "Stream") // for binary response - { - response.Data = (T)(object)new MemoryStream(response.RawBytes); - } - else if (typeof(T).Name == "Byte[]") // for byte response - { - response.Data = (T)(object)response.RawBytes; - } - - InterceptResponse(req, response); - - var result = ToApiResponse(response); - if (response.ErrorMessage != null) - { - result.ErrorText = response.ErrorMessage; - } - - if (response.Cookies != null && response.Cookies.Count > 0) - { - if (result.Cookies == null) result.Cookies = new List(); - foreach (var restResponseCookie in response.Cookies.Cast()) - { - var cookie = new Cookie( - restResponseCookie.Name, - restResponseCookie.Value, - restResponseCookie.Path, - restResponseCookie.Domain - ) - { - Comment = restResponseCookie.Comment, - CommentUri = restResponseCookie.CommentUri, - Discard = restResponseCookie.Discard, - Expired = restResponseCookie.Expired, - Expires = restResponseCookie.Expires, - HttpOnly = restResponseCookie.HttpOnly, - Port = restResponseCookie.Port, - Secure = restResponseCookie.Secure, - Version = restResponseCookie.Version - }; - - result.Cookies.Add(cookie); - } - } - return result; - } - - #region IAsynchronousClient - /// - /// Make a HTTP GET request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP POST request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PUT request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP DELETE request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP HEAD request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP OPTION request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PATCH request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); - } - #endregion IAsynchronousClient - {{/supportsAsync}} - - #region ISynchronousClient - /// - /// Make a HTTP GET request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); - } - - /// - /// Make a HTTP POST request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); - } - - /// - /// Make a HTTP PUT request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); - } - - /// - /// Make a HTTP DELETE request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); - } - - /// - /// Make a HTTP HEAD request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); - } - - /// - /// Make a HTTP OPTION request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); - } - - /// - /// Make a HTTP PATCH request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); - } - #endregion ISynchronousClient - } -} diff --git a/templates/netcore/Configuration.mustache b/templates/netcore/Configuration.mustache deleted file mode 100644 index 974a012..0000000 --- a/templates/netcore/Configuration.mustache +++ /dev/null @@ -1,710 +0,0 @@ -{{>partial_header}} - -using System; -{{^net35}} -using System.Collections.Concurrent; -{{/net35}} -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Net.Http; -{{#useRestSharp}} -{{#hasOAuthMethods}}using {{packageName}}.Client.Auth; -{{/hasOAuthMethods}} -{{/useRestSharp}} - -namespace {{packageName}}.Client -{ - /// - /// Represents a set of configuration settings - /// - {{>visibility}} class Configuration : IReadableConfiguration - { - #region Constants - - /// - /// Version of the package. - /// - /// Version of the package. - public const string Version = "{{packageVersion}}"; - - /// - /// Identifier for ISO 8601 DateTime Format - /// - /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. - // ReSharper disable once InconsistentNaming - public const string ISO8601_DATETIME_FORMAT = "o"; - - #endregion Constants - - #region Static Members - - /// - /// Default creation of exceptions for a given method name and response object - /// - public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => - { - var status = (int)response.StatusCode; - if (status >= 400) - { - return new ApiException(status, - string.Format("Error calling {0}: {1}", methodName, response.RawContent), - response.RawContent, response.Headers); - } - {{^netStandard}} - if (status == 0) - { - return new ApiException(status, - string.Format("Error calling {0}: {1}", methodName, response.ErrorText), response.ErrorText); - } - {{/netStandard}} - return null; - }; - - #endregion Static Members - - #region Private Members - - /// - /// Defines the base path of the target API server. - /// Example: http://localhost:3000/v1/ - /// - private string _basePath; - - /// - /// Gets or sets the API key based on the authentication name. - /// This is the key and value comprising the "secret" for accessing an API. - /// - /// The API key. - private IDictionary _apiKey; - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// The prefix of the API key. - private IDictionary _apiKeyPrefix; - - private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; - private string _tempFolderPath = Path.GetTempPath(); - {{#servers.0}} - - /// - /// Gets or sets the servers defined in the OpenAPI spec. - /// - /// The servers - private IList> _servers; - {{/servers.0}} - - /// - /// Gets or sets the operation servers defined in the OpenAPI spec. - /// - /// The operation servers - private IReadOnlyDictionary>> _operationServers; - - {{#hasHttpSignatureMethods}} - - /// - /// HttpSigning configuration - /// - private HttpSigningConfiguration _HttpSigningConfiguration = null; - {{/hasHttpSignatureMethods}} - #endregion Private Members - - #region Constructors - - /// - /// Initializes a new instance of the class - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] - public Configuration() - { - Proxy = null; - UserAgent = "{{httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{packageVersion}}/csharp{{/httpUserAgent}}/" + Version; - BasePath = "{{{basePath}}}"; - DefaultHeaders = new {{^net35}}Concurrent{{/net35}}Dictionary(); - ApiKey = new {{^net35}}Concurrent{{/net35}}Dictionary(); - ApiKeyPrefix = new {{^net35}}Concurrent{{/net35}}Dictionary(); - {{#servers}} - {{#-first}} - Servers = new List>() - { - {{/-first}} - { - new Dictionary { - {"url", "{{{url}}}"}, - {"description", "{{{description}}}{{^description}}No description provided{{/description}}"}, - {{#variables}} - {{#-first}} - { - "variables", new Dictionary { - {{/-first}} - { - "{{{name}}}", new Dictionary { - {"description", "{{{description}}}{{^description}}No description provided{{/description}}"}, - {"default_value", "{{{defaultValue}}}"}, - {{#enumValues}} - {{#-first}} - { - "enum_values", new List() { - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - } - } - {{/-last}} - {{/enumValues}} - } - }{{^-last}},{{/-last}} - {{#-last}} - } - } - {{/-last}} - {{/variables}} - } - }{{^-last}},{{/-last}} - {{#-last}} - }; - {{/-last}} - {{/servers}} - OperationServers = new Dictionary>>() - { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#servers.0}} - { - "{{{classname}}}.{{{nickname}}}", new List> - { - {{#servers}} - { - new Dictionary - { - {"url", "{{{url}}}"}, - {"description", "{{{description}}}{{^description}}No description provided{{/description}}"} - } - }, - {{/servers}} - } - }, - {{/servers.0}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} - }; - - // Setting Timeout has side effects (forces ApiClient creation). - Timeout = 100000; - } - - /// - /// Initializes a new instance of the class - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] - public Configuration( - IDictionary defaultHeaders, - IDictionary apiKey, - IDictionary apiKeyPrefix, - string basePath = "{{{basePath}}}") : this() - { - if (string.{{^net35}}IsNullOrWhiteSpace{{/net35}}{{#net35}}IsNullOrEmpty{{/net35}}(basePath)) - throw new ArgumentException("The provided basePath is invalid.", "basePath"); - if (defaultHeaders == null) - throw new ArgumentNullException("defaultHeaders"); - if (apiKey == null) - throw new ArgumentNullException("apiKey"); - if (apiKeyPrefix == null) - throw new ArgumentNullException("apiKeyPrefix"); - - BasePath = basePath; - - foreach (var keyValuePair in defaultHeaders) - { - DefaultHeaders.Add(keyValuePair); - } - - foreach (var keyValuePair in apiKey) - { - ApiKey.Add(keyValuePair); - } - - foreach (var keyValuePair in apiKeyPrefix) - { - ApiKeyPrefix.Add(keyValuePair); - } - } - - #endregion Constructors - - #region Properties - - /// - /// Gets or sets the base path for API access. - /// - public virtual string BasePath { - get { return _basePath; } - set { _basePath = value; } - } - - /// - /// Gets or sets the default header. - /// - [Obsolete("Use DefaultHeaders instead.")] - public virtual IDictionary DefaultHeader - { - get - { - return DefaultHeaders; - } - set - { - DefaultHeaders = value; - } - } - - /// - /// Gets or sets the default headers. - /// - public virtual IDictionary DefaultHeaders { get; set; } - - /// - /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. - /// - public virtual int Timeout { get; set; } - - /// - /// Gets or sets the proxy - /// - /// Proxy. - public virtual WebProxy Proxy { get; set; } - - /// - /// Gets or sets the HTTP user agent. - /// - /// Http user agent. - public virtual string UserAgent { get; set; } - - /// - /// Gets or sets the username (HTTP basic authentication). - /// - /// The username. - public virtual string Username { get; set; } - - /// - /// Gets or sets the password (HTTP basic authentication). - /// - /// The password. - public virtual string Password { get; set; } - - /// - /// Gets the API key with prefix. - /// - /// API key identifier (authentication scheme). - /// API key with prefix. - public string GetApiKeyWithPrefix(string apiKeyIdentifier) - { - string apiKeyValue; - ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); - string apiKeyPrefix; - if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) - { - return apiKeyPrefix + " " + apiKeyValue; - } - - return apiKeyValue; - } - - /// - /// Gets or sets certificate collection to be sent with requests. - /// - /// X509 Certificate collection. - public X509CertificateCollection ClientCertificates { get; set; } - - /// - /// Gets or sets the access token for OAuth2 authentication. - /// - /// This helper property simplifies code generation. - /// - /// The access token. - public virtual string AccessToken { get; set; } - - {{#useRestSharp}} - {{#hasOAuthMethods}} - /// - /// Gets or sets the token URL for OAuth2 authentication. - /// - /// The OAuth Token URL. - public virtual string OAuthTokenUrl { get; set; } - - /// - /// Gets or sets the client ID for OAuth2 authentication. - /// - /// The OAuth Client ID. - public virtual string OAuthClientId { get; set; } - - /// - /// Gets or sets the client secret for OAuth2 authentication. - /// - /// The OAuth Client Secret. - public virtual string OAuthClientSecret { get; set; } - - /// - /// Gets or sets the flow for OAuth2 authentication. - /// - /// The OAuth Flow. - public virtual OAuthFlow? OAuthFlow { get; set; } - - {{/hasOAuthMethods}} - {{/useRestSharp}} - /// - /// Gets or sets the temporary folder path to store the files downloaded from the server. - /// - /// Folder path. - public virtual string TempFolderPath - { - get { return _tempFolderPath; } - - set - { - if (string.IsNullOrEmpty(value)) - { - _tempFolderPath = Path.GetTempPath(); - return; - } - - // create the directory if it does not exist - if (!Directory.Exists(value)) - { - Directory.CreateDirectory(value); - } - - // check if the path contains directory separator at the end - if (value[value.Length - 1] == Path.DirectorySeparatorChar) - { - _tempFolderPath = value; - } - else - { - _tempFolderPath = value + Path.DirectorySeparatorChar; - } - } - } - - /// - /// Gets or sets the date time format used when serializing in the ApiClient - /// By default, it's set to ISO 8601 - "o", for others see: - /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx - /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx - /// No validation is done to ensure that the string you're providing is valid - /// - /// The DateTimeFormat string - public virtual string DateTimeFormat - { - get { return _dateTimeFormat; } - set - { - if (string.IsNullOrEmpty(value)) - { - // Never allow a blank or null string, go back to the default - _dateTimeFormat = ISO8601_DATETIME_FORMAT; - return; - } - - // Caution, no validation when you choose date time format other than ISO 8601 - // Take a look at the above links - _dateTimeFormat = value; - } - } - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// Whatever you set here will be prepended to the value defined in AddApiKey. - /// - /// An example invocation here might be: - /// - /// ApiKeyPrefix["Authorization"] = "Bearer"; - /// - /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. - /// - /// - /// OAuth2 workflows should set tokens via AccessToken. - /// - /// - /// The prefix of the API key. - public virtual IDictionary ApiKeyPrefix - { - get { return _apiKeyPrefix; } - set - { - if (value == null) - { - throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); - } - _apiKeyPrefix = value; - } - } - - /// - /// Gets or sets the API key based on the authentication name. - /// - /// The API key. - public virtual IDictionary ApiKey - { - get { return _apiKey; } - set - { - if (value == null) - { - throw new InvalidOperationException("ApiKey collection may not be null."); - } - _apiKey = value; - } - } - {{#servers.0}} - - /// - /// Gets or sets the servers. - /// - /// The servers. - public virtual IList> Servers - { - get { return _servers; } - set - { - if (value == null) - { - throw new InvalidOperationException("Servers may not be null."); - } - _servers = value; - } - } - - /// - /// Gets or sets the operation servers. - /// - /// The operation servers. - public virtual IReadOnlyDictionary>> OperationServers - { - get { return _operationServers; } - set - { - if (value == null) - { - throw new InvalidOperationException("Operation servers may not be null."); - } - _operationServers = value; - } - } - - /// - /// Returns URL based on server settings without providing values - /// for the variables - /// - /// Array index of the server settings. - /// The server URL. - public string GetServerUrl(int index) - { - return GetServerUrl(Servers, index, null); - } - - /// - /// Returns URL based on server settings. - /// - /// Array index of the server settings. - /// Dictionary of the variables and the corresponding values. - /// The server URL. - public string GetServerUrl(int index, Dictionary inputVariables) - { - return GetServerUrl(Servers, index, inputVariables); - } - - /// - /// Returns URL based on operation server settings. - /// - /// Operation associated with the request path. - /// Array index of the server settings. - /// The operation server URL. - public string GetOperationServerUrl(string operation, int index) - { - return GetOperationServerUrl(operation, index, null); - } - - /// - /// Returns URL based on operation server settings. - /// - /// Operation associated with the request path. - /// Array index of the server settings. - /// Dictionary of the variables and the corresponding values. - /// The operation server URL. - public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) - { - if (OperationServers.TryGetValue(operation, out var operationServer)) - { - return GetServerUrl(operationServer, index, inputVariables); - } - - return null; - } - - /// - /// Returns URL based on server settings. - /// - /// Dictionary of server settings. - /// Array index of the server settings. - /// Dictionary of the variables and the corresponding values. - /// The server URL. - private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) - { - if (index < 0 || index >= servers.Count) - { - throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); - } - - if (inputVariables == null) - { - inputVariables = new Dictionary(); - } - - IReadOnlyDictionary server = servers[index]; - string url = (string)server["url"]; - - if (server.ContainsKey("variables")) - { - // go through each variable and assign a value - foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) - { - - IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); - - if (inputVariables.ContainsKey(variable.Key)) - { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) - { - url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); - } - else - { - throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); - } - } - else - { - // use default value - url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); - } - } - } - - return url; - } - {{/servers.0}} - {{#hasHttpSignatureMethods}} - - /// - /// Gets and Sets the HttpSigningConfiguration - /// - public HttpSigningConfiguration HttpSigningConfiguration - { - get { return _HttpSigningConfiguration; } - set { _HttpSigningConfiguration = value; } - } - {{/hasHttpSignatureMethods}} - - #endregion Properties - - #region Methods - - /// - /// Returns a string with essential information for debugging. - /// - public static string ToDebugReport() - { - string report = "C# SDK ({{{packageName}}}) Debug Report:\n"; - report += " OS: " + System.Environment.OSVersion + "\n"; - report += " .NET Framework Version: " + System.Environment.Version + "\n"; - report += " Version of the API: {{{version}}}\n"; - report += " SDK Package Version: {{{packageVersion}}}\n"; - - return report; - } - - /// - /// Add Api Key Header. - /// - /// Api Key name. - /// Api Key value. - /// - public void AddApiKey(string key, string value) - { - ApiKey[key] = value; - } - - /// - /// Sets the API key prefix. - /// - /// Api Key name. - /// Api Key value. - public void AddApiKeyPrefix(string key, string value) - { - ApiKeyPrefix[key] = value; - } - - #endregion Methods - - #region Static Members - /// - /// Merge configurations. - /// - /// First configuration. - /// Second configuration. - /// Merged configuration. - public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) - { - if (second == null) return first ?? GlobalConfiguration.Instance; - - Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - - foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; - foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; - foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; - - var config = new Configuration - { - ApiKey = apiKey, - ApiKeyPrefix = apiKeyPrefix, - DefaultHeaders = defaultHeaders, - BasePath = second.BasePath ?? first.BasePath, - Timeout = second.Timeout, - Proxy = second.Proxy ?? first.Proxy, - UserAgent = second.UserAgent ?? first.UserAgent, - Username = second.Username ?? first.Username, - Password = second.Password ?? first.Password, - AccessToken = second.AccessToken ?? first.AccessToken, - {{#useRestSharp}} - {{#hasOAuthMethods}} - OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, - OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, - OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, - OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, - {{/hasOAuthMethods}} - {{/useRestSharp}} - {{#hasHttpSignatureMethods}} - HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration, - {{/hasHttpSignatureMethods}} - TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, - DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, - ClientCertificates = second.ClientCertificates ?? first.ClientCertificates, - }; - return config; - } - #endregion Static Members - } -} diff --git a/templates/netcore/EnumValueDataType.mustache b/templates/netcore/EnumValueDataType.mustache deleted file mode 100644 index a788123..0000000 --- a/templates/netcore/EnumValueDataType.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isString}}{{^isNumeric}}string{{/isNumeric}}{{/isString}}{{#isNumeric}}{{#isLong}}long{{/isLong}}{{#isFloat}}float{{/isFloat}}{{#isDouble}}double{{/isDouble}}{{#isDecimal}}decimal{{/isDecimal}}{{^isLong}}{{^isFloat}}{{^isDouble}}{{^isDecimal}}int{{/isDecimal}}{{/isDouble}}{{/isFloat}}{{/isLong}}{{/isNumeric}} \ No newline at end of file diff --git a/templates/netcore/RuntimeInformation.mustache b/templates/netcore/RuntimeInformation.mustache deleted file mode 100644 index 3e200c0..0000000 --- a/templates/netcore/RuntimeInformation.mustache +++ /dev/null @@ -1,273 +0,0 @@ -namespace {{packageName}}.Utils -{ - using System; - using System.Diagnostics; - using System.IO; - using System.Linq; - using System.Reflection; - using System.Runtime.Versioning; - using static System.Runtime.InteropServices.RuntimeInformation; - - /// - /// This class is used to gather information about the runtime environment. This is actually a - /// non-trivial task. The code below is largely borrowed from the - /// BenchmarkDotNet project. - /// - internal static class RuntimeInformation - { - public const string ConektaNetTargetFramework = - #if NET6_0 - "net6.0" - #elif NETSTANDARD2_0 - "netstandard2.0" - #elif NET47 - "net47" - #elif NET462 - "net462" - #else - "unknown" - #endif - ; - private const string Unknown = "?"; - - private static bool IsMono { get; } = Type.GetType("Mono.Runtime") != null; - - private static bool IsFullFramework => FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase); - - private static bool IsNetCore - => ((Environment.Version.Major >= 5) || FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase)) - && !string.IsNullOrEmpty(typeof(object).Assembly.Location); - - /// - /// "The north star for CoreRT is to be a flavor of .NET Core" -> CoreRT reports .NET Core everywhere. - /// - private static bool IsCoreRt - => ((Environment.Version.Major >= 5) || FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase)) - && string.IsNullOrEmpty(typeof(object).Assembly.Location); // but it's merged to a single .exe and .Location returns null here ;) - - private static bool IsRunningInContainer => string.Equals(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER"), "true"); - - /// Returns a string that describes the operating system on which the app is running. - /// A string that describes the operating system on which the app is running. - public static string GetOsVersion() - { - return OSDescription; - } - - /// Returns a string that indicates the name of the .NET installation on which an app is running. - /// A string that indicates the name of the .NET installation on which an app is running. - public static string GetRuntimeVersion() - { - if (IsMono) - { - return GetMonoVersion(); - } - else if (IsFullFramework) - { - return GetFullFrameworkVersion(); - } - else if (IsNetCore) - { - return GetNetCoreVersion(); - } - else if (IsCoreRt) - { - return FrameworkDescription.Replace("Core ", "CoreRT "); - } - - return Unknown; - } - - /// Returns a string with the Newtonsoft.Json assembly version number. - /// A string with the Newtonsoft.Json assembly version number. - public static string GetNewtonsoftJsonVersion() - { - var assembly = Assembly.GetAssembly(typeof(Newtonsoft.Json.JsonConvert)); - var fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location); - return fileVersion.FileVersion; - } - - private static string GetMonoVersion() - { - var monoRuntimeType = Type.GetType("Mono.Runtime"); - var monoDisplayName = monoRuntimeType?.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); - if (monoDisplayName != null) - { - string version = monoDisplayName.Invoke(null, null)?.ToString(); - if (version != null) - { - int bracket1 = version.IndexOf('('), bracket2 = version.IndexOf(')'); - if (bracket1 != -1 && bracket2 != -1) - { - string comment = version.Substring(bracket1 + 1, bracket2 - bracket1 - 1); - var commentParts = comment.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - if (commentParts.Length > 2) - { - version = version.Substring(0, bracket1) + "(" + commentParts[0] + " " + commentParts[1] + ")"; - } - } - } - - return "Mono " + version; - } - - return Unknown; - } - - private static string GetFullFrameworkVersion() - { - var fullName = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; // sth like .NET Framework 4.7.3324.0 - var servicingVersion = new string(fullName.SkipWhile(c => !char.IsDigit(c)).ToArray()); - var releaseVersion = MapToReleaseVersion(servicingVersion); - - return $".NET Framework {releaseVersion}"; - } - - private static string MapToReleaseVersion(string servicingVersion) - { - // the following code assumes that .NET {{targetFramework}} is the oldest supported version - if (string.Compare(servicingVersion, "4.7.1") < 0) - { - return "4.7"; - } - - if (string.Compare(servicingVersion, "4.7.2") < 0) - { - return "4.7.1"; - } - - if (string.Compare(servicingVersion, "4.8") < 0) - { - return "4.7.2"; - } - - return "4.8"; // most probably the last major release of Full .NET Framework - } - - private static string GetNetCoreVersion() - { - if (TryGetCoreRuntimeVersion(out var version) && version >= new Version(5, 0)) - { - return $".NET {version}"; - } - else - { - string runtimeVersion = version != default ? version.ToString() : "?"; - - return $".NET Core {runtimeVersion}"; - } - } - - private static bool TryGetCoreRuntimeVersion(out Version version) - { - // we can't just use System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription - // because it can be null and it reports versions like 4.6.* for .NET Core 2.* - - // for .NET 5+ we can use Environment.Version - if (Environment.Version.Major >= 5) - { - version = Environment.Version; - return true; - } - - string runtimeDirectory = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(); - if (TryGetVersionFromRuntimeDirectory(runtimeDirectory, out version)) - { - return true; - } - - // systemPrivateCoreLib.Product*Part properties return 0 so we have to implement some ugly parsing... - var systemPrivateCoreLib = FileVersionInfo.GetVersionInfo(typeof(object).Assembly.Location); - if (TryGetVersionFromProductInfo(systemPrivateCoreLib.ProductVersion, systemPrivateCoreLib.ProductName, out version)) - { - return true; - } - - string frameworkName = Assembly.GetEntryAssembly()?.GetCustomAttribute()?.FrameworkName; - if (TryGetVersionFromFrameworkName(frameworkName, out version)) - { - return true; - } - - if (IsRunningInContainer) - { - return Version.TryParse(Environment.GetEnvironmentVariable("DOTNET_VERSION"), out version) - || Version.TryParse(Environment.GetEnvironmentVariable("ASPNETCORE_VERSION"), out version); - } - - version = null; - return false; - } - - // sample input: - // for dotnet run: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.12\ - // for dotnet publish: C:\Users\adsitnik\source\repos\ConsoleApp25\ConsoleApp25\bin\Release\netcoreapp2.0\win-x64\publish\ - private static bool TryGetVersionFromRuntimeDirectory(string runtimeDirectory, out Version version) - { - if (!string.IsNullOrEmpty(runtimeDirectory) && Version.TryParse(GetParsableVersionPart(new DirectoryInfo(runtimeDirectory).Name), out version)) - { - return true; - } - - version = null; - return false; - } - - // sample input: - // 2.0: 4.6.26614.01 @BuiltBy: dlab14-DDVSOWINAGE018 @Commit: a536e7eec55c538c94639cefe295aa672996bf9b, Microsoft .NET Framework - // 2.1: 4.6.27817.01 @BuiltBy: dlab14-DDVSOWINAGE101 @Branch: release/2.1 @SrcCode: https://github.com/dotnet/coreclr/tree/6f78fbb3f964b4f407a2efb713a186384a167e5c, Microsoft .NET Framework - // 2.2: 4.6.27817.03 @BuiltBy: dlab14-DDVSOWINAGE101 @Branch: release/2.2 @SrcCode: https://github.com/dotnet/coreclr/tree/ce1d090d33b400a25620c0145046471495067cc7, Microsoft .NET Framework - // 3.0: 3.0.0-preview8.19379.2+ac25be694a5385a6a1496db40de932df0689b742, Microsoft .NET Core - // 5.0: 5.0.0-alpha1.19413.7+0ecefa44c9d66adb8a997d5778dc6c246ad393a7, Microsoft .NET Core - private static bool TryGetVersionFromProductInfo(string productVersion, string productName, out Version version) - { - if (!string.IsNullOrEmpty(productVersion) && !string.IsNullOrEmpty(productName)) - { - if (productName.IndexOf(".NET Core", StringComparison.OrdinalIgnoreCase) >= 0) - { - string parsableVersion = GetParsableVersionPart(productVersion); - if (Version.TryParse(productVersion, out version) || Version.TryParse(parsableVersion, out version)) - { - return true; - } - } - - // yes, .NET Core 2.X has a product name == .NET Framework... - if (productName.IndexOf(".NET Framework", StringComparison.OrdinalIgnoreCase) >= 0) - { - const string releaseVersionPrefix = "release/"; - int releaseVersionIndex = productVersion.IndexOf(releaseVersionPrefix); - if (releaseVersionIndex > 0) - { - string releaseVersion = GetParsableVersionPart(productVersion.Substring(releaseVersionIndex + releaseVersionPrefix.Length)); - - return Version.TryParse(releaseVersion, out version); - } - } - } - - version = null; - return false; - } - - // sample input: - // .NETCoreApp,Version=v2.0 - // .NETCoreApp,Version=v2.1 - private static bool TryGetVersionFromFrameworkName(string frameworkName, out Version version) - { - const string versionPrefix = ".NETCoreApp,Version=v"; - if (!string.IsNullOrEmpty(frameworkName) && frameworkName.StartsWith(versionPrefix)) - { - string frameworkVersion = GetParsableVersionPart(frameworkName.Substring(versionPrefix.Length)); - - return Version.TryParse(frameworkVersion, out version); - } - - version = null; - return false; - } - - // Version.TryParse does not handle thing like 3.0.0-WORD - private static string GetParsableVersionPart(string fullVersionName) => new string(fullVersionName.TakeWhile(c => char.IsDigit(c) || c == '.').ToArray()); - } -} diff --git a/templates/netcore/VERSION.mustache b/templates/netcore/VERSION.mustache deleted file mode 100644 index f28b7af..0000000 --- a/templates/netcore/VERSION.mustache +++ /dev/null @@ -1 +0,0 @@ -{{packageVersion}} diff --git a/templates/netcore/gitignore.mustache b/templates/netcore/gitignore.mustache deleted file mode 100644 index 7cb9fe0..0000000 --- a/templates/netcore/gitignore.mustache +++ /dev/null @@ -1,364 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd -.idea/ -coverage/ diff --git a/templates/netcore/netcore_project.additions.mustache b/templates/netcore/netcore_project.additions.mustache deleted file mode 100644 index 872f9ee..0000000 --- a/templates/netcore/netcore_project.additions.mustache +++ /dev/null @@ -1,14 +0,0 @@ -{{! if needed users can add this file to their templates folder to append to the csproj }} - - LICENSE - conekta;payment;credit;cards;money;gateway; - conekta.png - true - README.md - https://github.com/conekta/conekta-.net - - - - - - \ No newline at end of file diff --git a/templates/netcore/netcore_testproject.additions.mustache b/templates/netcore/netcore_testproject.additions.mustache deleted file mode 100644 index 0be119c..0000000 --- a/templates/netcore/netcore_testproject.additions.mustache +++ /dev/null @@ -1,17 +0,0 @@ -{{! if needed users can add this file to their templates folder to append to the csproj }} - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - true - diff --git a/templates/node/VERSION.mustache b/templates/node/VERSION.mustache deleted file mode 100644 index 3cb778a..0000000 --- a/templates/node/VERSION.mustache +++ /dev/null @@ -1 +0,0 @@ -{{npmVersion}} diff --git a/templates/node/common.mustache b/templates/node/common.mustache deleted file mode 100644 index ac63db1..0000000 --- a/templates/node/common.mustache +++ /dev/null @@ -1,176 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -{{>licenseInfo}} - -import type { Configuration } from "./configuration"; -import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; -import { RequiredError } from "./base"; -{{#withNodeImports}} -import { URL, URLSearchParams } from 'url'; -{{/withNodeImports}} -import {arch, platform, release} from 'os'; -import * as fs from 'fs'; -import * as https from 'https'; -import * as path from 'path'; -/** - * - * @export - */ -export const DUMMY_BASE_URL = 'https://example.com' - -/** - * - * @export - */ -export const conektaHeaders = { - bindings_version: ['Conekta::', "{{npmVersion}}"].join(''), - lang: 'node', - lang_version: process.version, - publisher: 'conekta', - uname: [arch, platform, release].join(' ') - } - -/** - * - * @throws {RequiredError} - * @export - */ -export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { - if (paramValue === null || paramValue === undefined) { - throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); - } -} - -/** - * - * @export - */ -export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey(keyParamName) - : await configuration.apiKey; - object[keyParamName] = localVarApiKeyValue; - } -} - -/** - * - * @export - */ -export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { - if (configuration && (configuration.username || configuration.password)) { - object["auth"] = { username: configuration.username, password: configuration.password }; - } -} - -/** - * - * @export - */ -export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { - if (configuration && configuration.accessToken) { - const accessToken = typeof configuration.accessToken === 'function' - ? await configuration.accessToken() - : await configuration.accessToken; - object["Authorization"] = "Bearer " + accessToken; - } - setCommonHeaders(object); -} - -/** - * - * @export - */ -export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken(name, scopes) - : await configuration.accessToken; - object["Authorization"] = "Bearer " + localVarAccessTokenValue; - } -} - -function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { - if (parameter == null) return; - if (typeof parameter === "object") { - if (Array.isArray(parameter)) { - (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); - } - else { - Object.keys(parameter).forEach(currentKey => - setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) - ); - } - } - else { - if (urlSearchParams.has(key)) { - urlSearchParams.append(key, parameter); - } - else { - urlSearchParams.set(key, parameter); - } - } -} - -/** - * - * @export - */ -export const setSearchParams = function (url: URL, ...objects: any[]) { - const searchParams = new URLSearchParams(url.search); - setFlattenedQueryParams(searchParams, objects); - url.search = searchParams.toString(); -} - -/** - * - * @export - */ -export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { - const nonString = typeof value !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(requestOptions.headers['Content-Type']) - : nonString; - return needsSerialization - ? JSON.stringify(value !== undefined ? value : {}) - : (value || ""); -} - -/** - * - * @export - */ -export const toPathString = function (url: URL) { - return url.pathname + url.search + url.hash -} - -/** - * - * @export - */ -export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - if (!axiosArgs.options.httpsAgent) { - const certPath = path.join(__dirname, '/cert/ca_bundle.crt') - - axiosArgs.options.httpsAgent = new https.Agent({ - ca: fs.readFileSync(certPath), - rejectUnauthorized: false - }) - } - - const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); - }; -} -/** - * - * @export - */ -export const setCommonHeaders = async function (object: any) { - object["User-Agent"] = "Conekta/v2 NodeBindings/" + "{{npmVersion}}"; - object["X-Conekta-Client-User-Agent"] = JSON.stringify(conektaHeaders); - object["Accept"] = "{{apiVersion}}"; -} diff --git a/templates/node/gitignore b/templates/node/gitignore deleted file mode 100644 index 4334e78..0000000 --- a/templates/node/gitignore +++ /dev/null @@ -1,5 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist -coverage/ diff --git a/templates/node/package.mustache b/templates/node/package.mustache deleted file mode 100644 index 7c2b6f6..0000000 --- a/templates/node/package.mustache +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "{{npmName}}", - "version": "{{npmVersion}}", - "description": "OpenAPI client for {{npmName}}", - "author": "engineering conekta", - "repository": { - "type": "git", - "url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git" - }, - "engines": { - "node": ">=14" - }, - "keywords": [ - "{{npmName}}", - "wrapper", - "spei", - "oxxo", - "credit card", - "payment", - "payout", - "subscription", - "api", - "nodejs" - ], - "bugs": { - "url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/issues" - }, - "homepage": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}#readme", - "license": "MIT", - "main": "./dist/index.js", - "typings": "./dist/index.d.ts", -{{#supportsES6}} - "module": "./dist/esm/index.js", - "sideEffects": false, -{{/supportsES6}} - "scripts": { - "postbuild": "cp -r cert dist/cert", - "build": "tsc {{#supportsES6}}&& tsc -p tsconfig.esm.json{{/supportsES6}}", - "prepare": "npm run build", - "test": "jest --coverage", - "clean": "rm -rf node_modules && rm -rf dist && rm -rf coverage" - }, - "dependencies": { - "axios": "1.4.0" - }, - "devDependencies": { - "@types/node": "^12.11.5", - "typescript": "^4.0", - "@types/jest": "^29.5.1", - "jest": "^29.5.0", - "ts-jest": "^29.1.0", - "ttypescript": "^1.5.10" - }{{#npmRepository}},{{/npmRepository}} -{{#npmRepository}} - "publishConfig": { - "access": "public" - } -{{/npmRepository}} -} diff --git a/templates/php/Configuration.mustache b/templates/php/Configuration.mustache deleted file mode 100644 index 96b4dc4..0000000 --- a/templates/php/Configuration.mustache +++ /dev/null @@ -1,570 +0,0 @@ -partial_header}} -/** - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -namespace {{invokerPackage}}; - -/** - * Configuration Class Doc Comment - * PHP version 7.4 - * - * @category Class - * @package {{invokerPackage}} - * @author OpenAPI Generator team - * @link https://openapi-generator.tech - */ -class Configuration -{ - public const BOOLEAN_FORMAT_INT = 'int'; - public const BOOLEAN_FORMAT_STRING = 'string'; - - /** - * @var Configuration - */ - private static $defaultConfiguration; - - /** - * Associate array to store API key(s) - * - * @var string[] - */ - protected $apiKeys = []; - - /** - * Associate array to store API prefix (e.g. Bearer) - * - * @var string[] - */ - protected $apiKeyPrefixes = []; - - /** - * Access token for OAuth/Bearer authentication - * - * @var string - */ - protected $accessToken = ''; - - /** - * Boolean format for query string - * - * @var string - */ - protected $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT; - - /** - * Username for HTTP basic authentication - * - * @var string - */ - protected $username = ''; - - /** - * Password for HTTP basic authentication - * - * @var string - */ - protected $password = ''; - - /** - * The host - * - * @var string - */ - protected $host = '{{basePath}}'; - - /** - * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default - * - * @var string - */ - protected $userAgent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}{{^artifactVersion}}1.0.0{{/artifactVersion}}/PHP{{/httpUserAgent}}'; - - /** - * Debug switch (default set to false) - * - * @var bool - */ - protected $debug = false; - - /** - * Debug file location (log to STDOUT by default) - * - * @var string - */ - protected $debugFile = 'php://output'; - - /** - * Debug file location (log to STDOUT by default) - * - * @var string - */ - protected $tempFolderPath; - - /** - * Constructor - */ - public function __construct() - { - $this->tempFolderPath = sys_get_temp_dir(); - } - - /** - * Sets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $key API key or token - * - * @return $this - */ - public function setApiKey($apiKeyIdentifier, $key) - { - $this->apiKeys[$apiKeyIdentifier] = $key; - return $this; - } - - /** - * Gets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return null|string API key or token - */ - public function getApiKey($apiKeyIdentifier) - { - return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; - } - - /** - * Sets the prefix for API key (e.g. Bearer) - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $prefix API key prefix, e.g. Bearer - * - * @return $this - */ - public function setApiKeyPrefix($apiKeyIdentifier, $prefix) - { - $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; - return $this; - } - - /** - * Gets API key prefix - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return null|string - */ - public function getApiKeyPrefix($apiKeyIdentifier) - { - return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; - } - - /** - * Sets the access token for OAuth - * - * @param string $accessToken Token for OAuth - * - * @return $this - */ - public function setAccessToken($accessToken) - { - $this->accessToken = $accessToken; - return $this; - } - - /** - * Gets the access token for OAuth - * - * @return string Access token for OAuth - */ - public function getAccessToken() - { - return $this->accessToken; - } - - /** - * Sets boolean format for query string. - * - * @param string $booleanFormatForQueryString Boolean format for query string - * - * @return $this - */ - public function setBooleanFormatForQueryString(string $booleanFormat) - { - $this->booleanFormatForQueryString = $booleanFormat; - - return $this; - } - - /** - * Gets boolean format for query string. - * - * @return string Boolean format for query string - */ - public function getBooleanFormatForQueryString(): string - { - return $this->booleanFormatForQueryString; - } - - /** - * Sets the username for HTTP basic authentication - * - * @param string $username Username for HTTP basic authentication - * - * @return $this - */ - public function setUsername($username) - { - $this->username = $username; - return $this; - } - - /** - * Gets the username for HTTP basic authentication - * - * @return string Username for HTTP basic authentication - */ - public function getUsername() - { - return $this->username; - } - - /** - * Sets the password for HTTP basic authentication - * - * @param string $password Password for HTTP basic authentication - * - * @return $this - */ - public function setPassword($password) - { - $this->password = $password; - return $this; - } - - /** - * Gets the password for HTTP basic authentication - * - * @return string Password for HTTP basic authentication - */ - public function getPassword() - { - return $this->password; - } - - /** - * Sets the host - * - * @param string $host Host - * - * @return $this - */ - public function setHost($host) - { - $this->host = $host; - return $this; - } - - /** - * Gets the host - * - * @return string Host - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the user agent of the api client - * - * @param string $userAgent the user agent of the api client - * - * @throws \InvalidArgumentException - * @return $this - */ - public function setUserAgent($userAgent) - { - if (!is_string($userAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - - $this->userAgent = $userAgent; - return $this; - } - - /** - * Gets the user agent of the api client - * - * @return string user agent - */ - public function getUserAgent() - { - return $this->userAgent; - } - - /** - * Sets debug flag - * - * @param bool $debug Debug flag - * - * @return $this - */ - public function setDebug($debug) - { - $this->debug = $debug; - return $this; - } - - /** - * Gets the debug flag - * - * @return bool - */ - public function getDebug() - { - return $this->debug; - } - - /** - * Sets the debug file - * - * @param string $debugFile Debug file - * - * @return $this - */ - public function setDebugFile($debugFile) - { - $this->debugFile = $debugFile; - return $this; - } - - /** - * Gets the debug file - * - * @return string - */ - public function getDebugFile() - { - return $this->debugFile; - } - - /** - * Sets the temp folder path - * - * @param string $tempFolderPath Temp folder path - * - * @return $this - */ - public function setTempFolderPath($tempFolderPath) - { - $this->tempFolderPath = $tempFolderPath; - return $this; - } - - /** - * Gets the temp folder path - * - * @return string Temp folder path - */ - public function getTempFolderPath() - { - return $this->tempFolderPath; - } - - /** - * Gets the default configuration instance - * - * @return Configuration - */ - public static function getDefaultConfiguration() - { - if (self::$defaultConfiguration === null) { - self::$defaultConfiguration = new Configuration(); - } - - return self::$defaultConfiguration; - } - - /** - * Sets the default configuration instance - * - * @param Configuration $config An instance of the Configuration Object - * - * @return void - */ - public static function setDefaultConfiguration(Configuration $config) - { - self::$defaultConfiguration = $config; - } - - /** - * @static - * - * @param string $disableFunctionsOutput - String value of the 'disable_function' setting, as output by \ini_get('disable_functions') - * @param string $functionName - Name of the function we are interesting in seeing whether or not it is disabled - * - * @return bool - */ - private static function _isDisabled($disableFunctionsOutput, $functionName) - { - $disabledFunctions = \explode(',', $disableFunctionsOutput); - foreach ($disabledFunctions as $disabledFunction) { - if (\trim($disabledFunction) === $functionName) { - return true; - } - } - - return false; - } - - /** - * Gets the essential information for debugging - * - * @return string The report for debugging - */ - public static function toDebugReport() - { - $uname_disabled = self::_isDisabled(\ini_get('disable_functions'), 'php_uname'); - $uname = $uname_disabled ? '(disabled)' : \php_uname(); - $report = 'PHP SDK ({{invokerPackage}}) Debug Report:' . PHP_EOL; - $report .= ' OS: ' . $uname . PHP_EOL; - $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' The version of the OpenAPI document: {{version}}' . PHP_EOL; - {{#artifactVersion}} - $report .= ' SDK Package Version: {{.}}' . PHP_EOL; - {{/artifactVersion}} - $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; - - return $report; - } - - /** - * Get API key (with prefix if set) - * - * @param string $apiKeyIdentifier name of apikey - * - * @return null|string API key with the prefix - */ - public function getApiKeyWithPrefix($apiKeyIdentifier) - { - $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); - $apiKey = $this->getApiKey($apiKeyIdentifier); - - if ($apiKey === null) { - return null; - } - - if ($prefix === null) { - $keyWithPrefix = $apiKey; - } else { - $keyWithPrefix = $prefix . ' ' . $apiKey; - } - - return $keyWithPrefix; - } - - /** - * Returns an array of host settings - * - * @return array an array of host settings - */ - public function getHostSettings() - { - return [ - {{#servers}} - [ - "url" => "{{{url}}}", - "description" => "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - "variables" => [ - {{/-first}} - "{{{name}}}" => [ - "description" => "{{{description}}}{{^description}}No description provided{{/description}}", - "default_value" => "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - "enum_values" => [ - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/enumValues}} - ]{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/variables}} - ]{{^-last}},{{/-last}} - {{/servers}} - ]; - } - - /** - * Returns URL based on host settings, index and variables - * - * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients - * @param int $hostIndex index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null) - { - if (null === $variables) { - $variables = []; - } - - // check array index out of bound - if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) { - throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings)); - } - - $host = $hostsSettings[$hostIndex]; - $url = $host["url"]; - - // go through variable and assign a value - foreach ($host["variables"] ?? [] as $name => $variable) { - if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum - $url = str_replace("{".$name."}", $variables[$name], $url); - } else { - throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); - } - } else { - // use default value - $url = str_replace("{".$name."}", $variable["default_value"], $url); - } - } - - return $url; - } - - /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) - { - return self::getHostString($this->getHostSettings(), $index, $variables); - } -} diff --git a/templates/php/HeaderSelector.mustache b/templates/php/HeaderSelector.mustache deleted file mode 100644 index 7dfa357..0000000 --- a/templates/php/HeaderSelector.mustache +++ /dev/null @@ -1,266 +0,0 @@ -partial_header}} -/** - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -namespace {{invokerPackage}}; - -/** - * HeaderSelector Class Doc Comment - * - * @category Class - * @package {{invokerPackage}} - * @author OpenAPI Generator team - * @link https://openapi-generator.tech - */ -class HeaderSelector -{ - - - private static function _isDisabled($disableFunctionsOutput, $functionName) - { - $disabledFunctions = \explode(',', $disableFunctionsOutput); - foreach ($disabledFunctions as $disabledFunction) { - if (\trim($disabledFunction) === $functionName) { - return true; - } - } - - return false; - } - /** - * @param string[] $accept - * @param string $contentType - * @param bool $isMultipart - * @return string[] - */ - public function selectHeaders(array $accept, string $contentType, bool $isMultipart): array - { - $headers = []; - - $accept = $this->selectAcceptHeader($accept); - if ($accept !== null) { - $headers['Accept'] = $accept; - } - - if (!$isMultipart) { - if($contentType === '') { - $contentType = 'application/json'; - } - - $headers['Content-Type'] = $contentType; - } - - return $headers; - } - - /** - * Return the header 'Accept' based on an array of Accept provided. - * - * @param string[] $accept Array of header - * - * @return null|string Accept (e.g. application/json) - */ - private function selectAcceptHeader(array $accept): ?string - { - # filter out empty entries - $accept = array_filter($accept); - - if (count($accept) === 0) { - return null; - } - - # If there's only one Accept header, just use it - if (count($accept) === 1) { - return reset($accept); - } - - # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); - if (count($headersWithJson) === 0) { - return implode(',', $accept); - } - - # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, - # to give the highest priority to json-like headers - recalculating the existing ones, if needed - return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); - } - - /** - * Create an Accept header string from the given "Accept" headers array, recalculating all weights - * - * @param string[] $accept Array of Accept Headers - * @param string[] $headersWithJson Array of Accept Headers of type "json" - * - * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") - */ - private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string - { - $processedHeaders = [ - 'withApplicationJson' => [], - 'withJson' => [], - 'withoutJson' => [], - ]; - - foreach ($accept as $header) { - - $headerData = $this->getHeaderAndWeight($header); - - if (stripos($headerData['header'], 'application/json') === 0) { - $processedHeaders['withApplicationJson'][] = $headerData; - } elseif (in_array($header, $headersWithJson, true)) { - $processedHeaders['withJson'][] = $headerData; - } else { - $processedHeaders['withoutJson'][] = $headerData; - } - } - - $acceptHeaders = []; - $currentWeight = 1000; - - $hasMoreThan28Headers = count($accept) > 28; - - foreach($processedHeaders as $headers) { - if (count($headers) > 0) { - $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); - } - } - - $acceptHeaders = array_merge(...$acceptHeaders); - - return implode(',', $acceptHeaders); - } - - /** - * Given an Accept header, returns an associative array splitting the header and its weight - * - * @param string $header "Accept" Header - * - * @return array with the header and its weight - */ - private function getHeaderAndWeight(string $header): array - { - # matches headers with weight, splitting the header and the weight in $outputArray - if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { - $headerData = [ - 'header' => $outputArray[1], - 'weight' => (int)($outputArray[2] * 1000), - ]; - } else { - $headerData = [ - 'header' => trim($header), - 'weight' => 1000, - ]; - } - - return $headerData; - } - - /** - * @param array[] $headers - * @param float $currentWeight - * @param bool $hasMoreThan28Headers - * @return string[] array of adjusted "Accept" headers - */ - private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array - { - usort($headers, function (array $a, array $b) { - return $b['weight'] - $a['weight']; - }); - - $acceptHeaders = []; - foreach ($headers as $index => $header) { - if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) - { - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - } - - $weight = $currentWeight; - - $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); - } - - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - - return $acceptHeaders; - } - - /** - * @param string $header - * @param int $weight - * @return string - */ - private function buildAcceptHeader(string $header, int $weight): string - { - if($weight === 1000) { - return $header; - } - - return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); - } - - /** - * Calculate the next weight, based on the current one. - * - * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the - * following formula: - * - * next weight = current weight - 10 ^ (floor(log(current weight - 1))) - * - * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) - * - * Starting from 1000, this generates the following series: - * - * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - * - * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works - * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 - * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. - * - * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) - * @param bool $hasMoreThan28Headers - * @return int - */ - public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int - { - if ($currentWeight <= 1) { - return 1; - } - - if ($hasMoreThan28Headers) { - return $currentWeight - 1; - } - - return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); - } - public function getConektaUserAgent(): array - { - $uname_disabled = self::_isDisabled(\ini_get('disable_functions'), 'php_uname'); - $uname = $uname_disabled ? '(disabled)' : \php_uname(); - - $userAgent = [ - 'bindings_version' => "{{{artifactVersion}}}", - 'lang' => 'php', - 'lang_version' => phpversion(), - 'publisher' => 'conekta', - 'uname' => $uname, - ]; - $headers = []; - $headers['X-Conekta-Client-User-Agent'] = json_encode($userAgent); - - return $headers; - } -} diff --git a/templates/php/VERSION.mustache b/templates/php/VERSION.mustache deleted file mode 100644 index 97c87ec..0000000 --- a/templates/php/VERSION.mustache +++ /dev/null @@ -1 +0,0 @@ -{{artifactVersion}} diff --git a/templates/php/api.mustache b/templates/php/api.mustache deleted file mode 100644 index 0a79399..0000000 --- a/templates/php/api.mustache +++ /dev/null @@ -1,840 +0,0 @@ -partial_header}} -/** - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -namespace {{apiPackage}}; - -use GuzzleHttp\Client; -use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; -use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; -use GuzzleHttp\Psr7\Request; -use GuzzleHttp\RequestOptions; -use {{invokerPackage}}\ApiException; -use {{invokerPackage}}\Configuration; -use {{invokerPackage}}\HeaderSelector; -use {{invokerPackage}}\ObjectSerializer; - -/** - * {{classname}} Class Doc Comment - * - * @category Class - * @package {{invokerPackage}} - * @author OpenAPI Generator team - * @link https://openapi-generator.tech - */ -{{#operations}}class {{classname}} -{ - /** - * @var ClientInterface - */ - protected $client; - - /** - * @var Configuration - */ - protected $config; - - /** - * @var HeaderSelector - */ - protected $headerSelector; - - /** - * @var int Host index - */ - protected $hostIndex; - - /** @var string[] $contentTypes **/ - public const contentTypes = [{{#operation}} - '{{{operationId}}}' => [{{#consumes}} - '{{{mediaType}}}',{{/consumes}} - {{^consumes}} - 'application/json', -{{/consumes}} ],{{/operation}} - ]; - -/** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - -{{#operation}} - /** - * Operation {{{operationId}}} -{{#summary}} - * - * {{.}} -{{/summary}} - * -{{#description}} - * {{.}} - * -{{/description}} -{{#vendorExtensions.x-group-parameters}} - * Note: the input parameter is an associative array with the keys listed as the parameter name below - * -{{/vendorExtensions.x-group-parameters}} -{{#servers}} -{{#-first}} - * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. - * if needed, use the 'variables' parameter to pass variables to the host. -{{/-first}} - * URL: {{{url}}} -{{#variables}} -{{#-first}} - * Variables: -{{/-first}} - * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} -{{#-first}} - * Allowed values: -{{/-first}} - * - {{{.}}}{{/enumValues}} -{{/variables}} -{{#-last}} - * -{{/-last}} -{{/servers}} -{{#allParams}} - * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} -{{/allParams}} -{{#servers}} -{{#-first}} - * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead - * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. -{{/-first}} -{{/servers}} - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation - * - * @throws \{{invokerPackage}}\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) - { - {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} - return $response;{{/returnType}} - } - - /** - * Operation {{{operationId}}}WithHttpInfo -{{#summary}} - * - * {{.}} -{{/summary}} - * -{{#description}} - * {{.}} - * -{{/description}} -{{#vendorExtensions.x-group-parameters}} - * Note: the input parameter is an associative array with the keys listed as the parameter name below - * -{{/vendorExtensions.x-group-parameters}} -{{#servers}} -{{#-first}} - * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. - * if needed, use the 'variables' parameter to pass variables to the host. -{{/-first}} - * URL: {{{url}}} -{{#variables}} -{{#-first}} - * Variables: -{{/-first}} - * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} -{{#-first}} - * Allowed values: -{{/-first}} - * - {{{.}}}{{/enumValues}} -{{/variables}} -{{#-last}} - * -{{/-last}} -{{/servers}} -{{#allParams}} - * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} -{{/allParams}} -{{#servers}} -{{#-first}} - * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead - * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. -{{/-first}} -{{/servers}} - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation - * - * @throws \{{invokerPackage}}\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) - { - $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - {{#returnType}} - {{#responses}} - {{#-first}} - - switch($statusCode) { - {{/-first}} - {{#dataType}} - {{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} - if ('{{{dataType}}}' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('{{{dataType}}}' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '{{{dataType}}}', []), - $response->getStatusCode(), - $response->getHeaders() - ];{{/isRange}} - {{/dataType}} - {{#-last}} - } - {{/-last}} - {{/responses}} - - $returnType = '{{{returnType}}}'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - {{/returnType}} - {{^returnType}} - - return [null, $statusCode, $response->getHeaders()]; - {{/returnType}} - - } catch (ApiException $e) { - switch ($e->getCode()) { - {{#responses}} - {{#dataType}} - {{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '{{{dataType}}}', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break;{{/isRange}} - {{/dataType}} - {{/responses}} - } - throw $e; - } - } - - /** - * Operation {{{operationId}}}Async - * -{{#summary}} - * {{.}} - * -{{/summary}} -{{#description}} - * {{.}} - * -{{/description}} -{{#vendorExtensions.x-group-parameters}} - * Note: the input parameter is an associative array with the keys listed as the parameter name below - * -{{/vendorExtensions.x-group-parameters}} -{{#servers}} -{{#-first}} - * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. - * if needed, use the 'variables' parameter to pass variables to the host. -{{/-first}} - * URL: {{{url}}} -{{#variables}} -{{#-first}} - * Variables: -{{/-first}} - * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} -{{#-first}} - * Allowed values: -{{/-first}} - * - {{{.}}}{{/enumValues}} -{{/variables}} -{{#-last}} - * -{{/-last}} -{{/servers}} -{{#allParams}} - * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} -{{/allParams}} -{{#servers}} -{{#-first}} - * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead - * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. -{{/-first}} -{{/servers}} - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) - { - return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation {{{operationId}}}AsyncWithHttpInfo - * -{{#summary}} - * {{.}} - * -{{/summary}} -{{#description}} - * {{.}} - * -{{/description}} -{{#vendorExtensions.x-group-parameters}} - * Note: the input parameter is an associative array with the keys listed as the parameter name below - * -{{/vendorExtensions.x-group-parameters}} -{{#servers}} -{{#-first}} - * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. - * if needed, use the 'variables' parameter to pass variables to the host. -{{/-first}} - * URL: {{{url}}} -{{#variables}} -{{#-first}} - * Variables: -{{/-first}} - * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} -{{#-first}} - * Allowed values: -{{/-first}} - * - {{{.}}}{{/enumValues}} -{{/variables}} -{{#-last}} - * -{{/-last}} -{{/servers}} -{{#allParams}} - * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} -{{/allParams}} -{{#servers}} -{{#-first}} - * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead - * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. -{{/-first}} -{{/servers}} - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) - { - $returnType = '{{{returnType}}}'; - $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - {{#returnType}} - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - {{/returnType}} - {{^returnType}} - return [null, $response->getStatusCode(), $response->getHeaders()]; - {{/returnType}} - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation '{{{operationId}}}' - * -{{#vendorExtensions.x-group-parameters}} - * Note: the input parameter is an associative array with the keys listed as the parameter name below - * -{{/vendorExtensions.x-group-parameters}} -{{#servers}} -{{#-first}} - * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. - * if needed, use the 'variables' parameter to pass variables to the host. -{{/-first}} - * URL: {{{url}}} -{{#variables}} -{{#-first}} - * Variables: -{{/-first}} - * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} -{{#-first}} - * Allowed values: -{{/-first}} - * - {{{.}}}{{/enumValues}} -{{/variables}} -{{#-last}} - * -{{/-last}} -{{/servers}} -{{#allParams}} - * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} -{{/allParams}} -{{#servers}} -{{#-first}} - * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead - * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. -{{/-first}} -{{/servers}} - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) - { - {{#vendorExtensions.x-group-parameters}} - // unbox the parameters from the associative array -{{#allParams}} - ${{paramName}} = array_key_exists('{{paramName}}', $associative_array) ? $associative_array['{{paramName}}'] : {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}; -{{/allParams}}{{#servers.0}} - $hostIndex = $associative_array['hostIndex']; - $variables = array_key_exists('variables', $associative_array) ? $associative_array['variables'] : []; -{{/servers.0}} - $contentType = $associative_array['contentType'] ?? self::contentTypes['{{{operationId}}}'][0]; - {{/vendorExtensions.x-group-parameters}}{{#allParams}} - {{#required}} - // verify the required parameter '{{paramName}}' is set - if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter ${{paramName}} when calling {{operationId}}' - ); - } - {{/required}} - {{#hasValidation}} - {{#maxLength}} - if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) > {{maxLength}}) { - throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); - } - {{/maxLength}} - {{#minLength}} - if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) < {{minLength}}) { - throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); - } - {{/minLength}} - {{#maximum}} - if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { - throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); - } - {{/maximum}} - {{#minimum}} - if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { - throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); - } - {{/minimum}} - {{#pattern}} - if ({{^required}}${{paramName}} !== null && {{/required}}!preg_match("{{{pattern}}}", ${{paramName}})) { - throw new \InvalidArgumentException("invalid value for \"{{paramName}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); - } - {{/pattern}} - {{#maxItems}} - if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) > {{maxItems}}) { - throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); - } - {{/maxItems}} - {{#minItems}} - if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) < {{minItems}}) { - throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); - } - {{/minItems}} - {{/hasValidation}}{{/allParams}} - - $resourcePath = '{{{path}}}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - {{#queryParams}} - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - ${{paramName}}, - '{{baseName}}', // param base name - '{{#schema}}{{openApiType}}{{/schema}}', // openApiType - '{{style}}', // style - {{#isExplode}}true{{/isExplode}}{{^isExplode}}false{{/isExplode}}, // explode - {{required}} // required - ) ?? []); - {{/queryParams}} - - {{#headerParams}} - // header params - {{#collectionFormat}} - if (is_array(${{paramName}})) { - ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); - } - {{/collectionFormat}} - if (${{paramName}} !== null) { - $headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}}); - } - {{/headerParams}} - - {{#pathParams}} - // path params - {{#collectionFormat}} - if (is_array(${{paramName}})) { - ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); - } - {{/collectionFormat}} - if (${{paramName}} !== null) { - $resourcePath = str_replace( - '{' . '{{baseName}}' . '}', - ObjectSerializer::toPathValue(${{paramName}}), - $resourcePath - ); - } - {{/pathParams}} - - {{#formParams}} - // form params - if (${{paramName}} !== null) { - {{#isFile}} - $multipart = true; - $formParams['{{baseName}}'] = []; - $paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}]; - foreach ($paramFiles as $paramFile) { - $formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue($paramFile), - 'rb' - ); - } - {{/isFile}} - {{^isFile}} - $formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}}); - {{/isFile}} - } - {{/formParams}} - - $headers = $this->headerSelector->selectHeaders( - [{{#produces}}'{{{mediaType}}}', {{/produces}}], - $contentType, - $multipart - ); - $headers = array_merge( - $this->headerSelector->getConektaUserAgent(), - $headers - ); - - // for model (json/xml) - {{#bodyParams}} - if (isset(${{paramName}})) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization(${{paramName}})); - } else { - $httpBody = ${{paramName}}; - } - } elseif (count($formParams) > 0) { - {{/bodyParams}} - {{^bodyParams}} - if (count($formParams) > 0) { - {{/bodyParams}} - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - {{#authMethods}} - {{#isApiKey}} - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('{{keyParamName}}'); - if ($apiKey !== null) { - {{#isKeyInHeader}}$headers['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}} - } - {{/isApiKey}} - {{#isBasic}} - {{#isBasicBasic}} - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - {{/isBasicBasic}} - {{#isBasicBearer}} - // this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - {{/isBasicBearer}} - {{/isBasic}} - {{#isOAuth}} - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - {{/isOAuth}} - {{/authMethods}} - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - {{#servers.0}} - # Preserve the original behavior of server indexing. - if ($hostIndex === null) { - $hostIndex = $this->hostIndex; - } - - $hostSettings = $this->getHostSettingsFor{{operationId}}(); - - if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { - throw new \InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); - } - $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); - {{/servers.0}} - {{^servers.0}} - $operationHost = $this->config->getHost(); - {{/servers.0}} - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - '{{httpMethod}}', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - {{#servers.0}} - /** - * Returns an array of host settings for Operation {{operationId}} - * - * @return array an array of host settings - */ - protected function getHostSettingsFor{{operationId}}(): array - { - return [ - {{#servers}} - [ - "url" => "{{{url}}}", - "description" => "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - "variables" => [ - {{/-first}} - "{{{name}}}" => [ - "description" => "{{{description}}}{{^description}}No description provided{{/description}}", - "default_value" => "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - "enum_values" => [ - {{/-first}} - "{{{.}}}", - {{#-last}} - ] - {{/-last}} - {{/enumValues}} - ]{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/variables}} - ]{{^-last}},{{/-last}} - {{/servers}} - ]; - } - - {{/servers.0}} - {{/operation}} - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - $options[RequestOptions::SSL_KEY] = dirname(__DIR__, 1) . '/ssl_data/ca_bundle.crt'; - - return $options; - } -} -{{/operations}} diff --git a/templates/php/composer.mustache b/templates/php/composer.mustache deleted file mode 100644 index 47c7b72..0000000 --- a/templates/php/composer.mustache +++ /dev/null @@ -1,44 +0,0 @@ -{ - {{#composerPackageName}} - "name": "{{.}}", - {{/composerPackageName}} - {{#artifactVersion}} - "version": "{{.}}", - {{/artifactVersion}} - "description": "{{appDescriptionV2}}", - "type": "library", - "keywords": [ - "php", - "sdk", - "rest", - "api", - "conekta" - ], - "homepage": "https://www.conekta.com/", - "license": "MIT", - "authors": [ - { - "name": "{{{packageAuthors}}}", - "homepage": "https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}/contributors" - } - ], - "require": { - "php": "^7.4 || ^8.0", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "guzzlehttp/guzzle": "^7.3", - "guzzlehttp/psr7": "^1.7 || ^2.0" - }, - "require-dev": { - "phpunit/phpunit": "^8.0 || ^9.0", - "friendsofphp/php-cs-fixer": "^3.5", - "phpstan/phpstan": "1.10.15" - }, - "autoload": { - "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } - }, - "autoload-dev": { - "psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" } - } -} diff --git a/templates/php/gitignore b/templates/php/gitignore deleted file mode 100644 index 880465a..0000000 --- a/templates/php/gitignore +++ /dev/null @@ -1,35 +0,0 @@ -# Ignore build files -build/* - -# Mac OS X dumps these all over the place. -.DS_Store - -# Ignore the SimpleTest library if it is installed to /test/. -/test/simpletest/ - -# Ignore the /vendor/ directory for people using composer -/vendor/ - -# If the vendor directory isn't being commited the composer.lock file should also be ignored -composer.lock - -# Ignore PHPUnit coverage file -clover.xml - -# Ignore IDE's configuration files -.idea - -# Ignore PHP CS Fixer local config and cache -.php_cs -.php_cs.cache -.php-cs-fixer.cache - -# Ignore PHPStan local config -.phpstan.neon - -# Ignore phpDocumentor's local config and artifacts -.phpdoc/* -phpdoc.xml - -# Ignore cached PHPUnit results. -.phpunit.result.cache diff --git a/templates/php/phpunit.xml.mustache b/templates/php/phpunit.xml.mustache deleted file mode 100644 index e0259fe..0000000 --- a/templates/php/phpunit.xml.mustache +++ /dev/null @@ -1,16 +0,0 @@ - - - - - {{apiSrcPath}} - - - - - {{apiTestPath}} - - - - - - \ No newline at end of file diff --git a/templates/python/VERSION.mustache b/templates/python/VERSION.mustache deleted file mode 100644 index f28b7af..0000000 --- a/templates/python/VERSION.mustache +++ /dev/null @@ -1 +0,0 @@ -{{packageVersion}} diff --git a/templates/python/api_client.mustache b/templates/python/api_client.mustache deleted file mode 100644 index a78d32c..0000000 --- a/templates/python/api_client.mustache +++ /dev/null @@ -1,801 +0,0 @@ -# coding: utf-8 - -{{>partial_header}} - -import atexit -import datetime -from dateutil.parser import parse -import json -import mimetypes -from multiprocessing.pool import ThreadPool -import os -import re -import tempfile -import platform - -from urllib.parse import quote -{{#tornado}} -import tornado.gen -{{/tornado}} - -from {{packageName}}.configuration import Configuration -from {{packageName}}.api_response import ApiResponse -import {{modelPackage}} -from {{packageName}} import rest -from {{packageName}}.exceptions import ApiValueError, ApiException - - -class ApiClient(object): - """Generic API client for OpenAPI client library builds. - - OpenAPI generic API client. This client handles the client- - server communication, and is invariant across implementations. Specifics of - the methods and models for each application are generated from the OpenAPI - templates. - - :param configuration: .Configuration object for this client - :param header_name: a header to pass when making calls to the API. - :param header_value: a header value to pass when making calls to - the API. - :param cookie: a cookie to include in the header when making calls - to the API - :param pool_threads: The number of threads to use for async requests - to the API. More threads means more concurrent API requests. - """ - - PRIMITIVE_TYPES = (float, bool, bytes, str, int) - NATIVE_TYPES_MAPPING = { - 'int': int, - 'long': int, # TODO remove as only py3 is supported? - 'float': float, - 'str': str, - 'bool': bool, - 'date': datetime.date, - 'datetime': datetime.datetime, - 'object': object, - } - data = { - 'lang': 'python', - 'lang_version': platform.python_version(), - 'publisher': 'conekta', - 'bindings_version': '{{packageVersion}}', - 'uname': platform.uname() - } - _pool = None - - def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None, pool_threads=1): - # use default configuration if none is provided - if configuration is None: - configuration = Configuration.get_default() - self.configuration = configuration - self.pool_threads = pool_threads - - self.rest_client = rest.RESTClientObject(configuration) - self.default_headers = {} - if header_name is not None: - self.default_headers[header_name] = header_value - self.cookie = cookie - # Set default User-Agent. - self.user_agent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/python{{/httpUserAgent}}' - self.conekta_user_agent = json.dumps(self.data) - self.client_side_validation = configuration.client_side_validation - - {{#asyncio}} - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc_value, traceback): - await self.close() - {{/asyncio}} - {{^asyncio}} - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, traceback): - self.close() - {{/asyncio}} - - {{#asyncio}}async {{/asyncio}}def close(self): - {{#asyncio}} - await self.rest_client.close() - {{/asyncio}} - if self._pool: - self._pool.close() - self._pool.join() - self._pool = None - if hasattr(atexit, 'unregister'): - atexit.unregister(self.close) - - @property - def pool(self): - """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. - """ - if self._pool is None: - atexit.register(self.close) - self._pool = ThreadPool(self.pool_threads) - return self._pool - - @property - def user_agent(self): - """User agent for this API client""" - return self.default_headers['User-Agent'] - - @user_agent.setter - def user_agent(self, value): - self.default_headers['User-Agent'] = value - - @property - def conekta_user_agent(self): - """User conekta agent for this API client""" - return self.default_headers['X-Conekta-Client-User-Agent'] - - @conekta_user_agent.setter - def conekta_user_agent(self, value): - self.default_headers['X-Conekta-Client-User-Agent'] = value - - def set_default_header(self, header_name, header_value): - self.default_headers[header_name] = header_value - - - _default = None - - @classmethod - def get_default(cls): - """Return new instance of ApiClient. - - This method returns newly created, based on default constructor, - object of ApiClient class or returns a copy of default - ApiClient. - - :return: The ApiClient object. - """ - if cls._default is None: - cls._default = ApiClient() - return cls._default - - @classmethod - def set_default(cls, default): - """Set default instance of ApiClient. - - It stores default ApiClient. - - :param default: object of ApiClient. - """ - cls._default = default - - {{#tornado}} - @tornado.gen.coroutine - {{/tornado}} - {{#asyncio}}async {{/asyncio}}def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_types_map=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None, - _request_auth=None): - - config = self.configuration - - # header parameters - header_params = header_params or {} - header_params.update(self.default_headers) - if self.cookie: - header_params['Cookie'] = self.cookie - if header_params: - header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) - - # path parameters - if path_params: - path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) - for k, v in path_params: - # specified safe chars, encode everything - resource_path = resource_path.replace( - '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param) - ) - - # post parameters - if post_params or files: - post_params = post_params if post_params else [] - post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) - post_params.extend(self.files_parameters(files)) - - # auth setting - self.update_params_for_auth( - header_params, query_params, auth_settings, - resource_path, method, body, - request_auth=_request_auth) - - # body - if body: - body = self.sanitize_for_serialization(body) - - # request url - if _host is None: - url = self.configuration.host + resource_path - else: - # use server/host defined in path or operation instead - url = _host + resource_path - - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - url_query = self.parameters_to_url_query(query_params, - collection_formats) - url += "?" + url_query - - try: - # perform request and return response - response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}self.request( - method, url, - query_params=query_params, - headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) - except ApiException as e: - if e.body: - e.body = e.body.decode('utf-8') - raise e - - self.last_response = response_data - - return_data = None # assuming derialization is not needed - # data needs deserialization or returns HTTP data (deserialized) only - if _preload_content or _return_http_data_only: - response_type = response_types_map.get(str(response_data.status), None) - - if response_type == "bytearray": - response_data.data = response_data.data - else: - match = None - content_type = response_data.getheader('content-type') - if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) - encoding = match.group(1) if match else "utf-8" - response_data.data = response_data.data.decode(encoding) - - # deserialize response data - if response_type == "bytearray": - return_data = response_data.data - elif response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None - -{{^tornado}} - if _return_http_data_only: - return return_data - else: - return ApiResponse(status_code = response_data.status, - data = return_data, - headers = response_data.getheaders(), - raw_data = response_data.data) -{{/tornado}} -{{#tornado}} - if _return_http_data_only: - raise tornado.gen.Return(return_data) - else: - raise tornado.gen.Return(ApiResponse(status_code = response_data.status, - data = return_data, - headers = response_data.getheaders(), - raw_data = response_data.data)) -{{/tornado}} - - def sanitize_for_serialization(self, obj): - """Builds a JSON POST object. - - If obj is None, return None. - If obj is str, int, long, float, bool, return directly. - If obj is datetime.datetime, datetime.date - convert to string in iso8601 format. - If obj is list, sanitize each element in the list. - If obj is dict, return the dict. - If obj is OpenAPI model, return the properties dict. - - :param obj: The data to serialize. - :return: The serialized form of data. - """ - if obj is None: - return None - elif isinstance(obj, self.PRIMITIVE_TYPES): - return obj - elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] - elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) - elif isinstance(obj, (datetime.datetime, datetime.date)): - return obj.isoformat() - - if isinstance(obj, dict): - obj_dict = obj - else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - obj_dict = obj.to_dict() - - return {key: self.sanitize_for_serialization(val) - for key, val in obj_dict.items()} - - def deserialize(self, response, response_type): - """Deserializes response into an object. - - :param response: RESTResponse object to be deserialized. - :param response_type: class literal for - deserialized object, or string of class name. - - :return: deserialized object. - """ - # handle file downloading - # save response body into a tmp file and return the instance - if response_type == "file": - return self.__deserialize_file(response) - - # fetch data from response object - try: - data = json.loads(response.data) - except ValueError: - data = response.data - - return self.__deserialize(data, response_type) - - def __deserialize(self, data, klass): - """Deserializes dict, list, str into an object. - - :param data: dict, list or str. - :param klass: class literal, or string of class name. - - :return: object. - """ - if data is None: - return None - - if type(klass) == str: - if klass.startswith('List['): - sub_kls = re.match(r'List\[(.*)]', klass).group(1) - return [self.__deserialize(sub_data, sub_kls) - for sub_data in data] - - if klass.startswith('Dict['): - sub_kls = re.match(r'Dict\[([^,]*), (.*)]', klass).group(2) - return {k: self.__deserialize(v, sub_kls) - for k, v in data.items()} - - # convert str to class - if klass in self.NATIVE_TYPES_MAPPING: - klass = self.NATIVE_TYPES_MAPPING[klass] - else: - klass = getattr({{modelPackage}}, klass) - - if klass in self.PRIMITIVE_TYPES: - return self.__deserialize_primitive(data, klass) - elif klass == object: - return self.__deserialize_object(data) - elif klass == datetime.date: - return self.__deserialize_date(data) - elif klass == datetime.datetime: - return self.__deserialize_datetime(data) - else: - return self.__deserialize_model(data, klass) - - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_types_map=None, auth_settings=None, - async_req=None, _return_http_data_only=None, - collection_formats=None, _preload_content=True, - _request_timeout=None, _host=None, _request_auth=None): - """Makes the HTTP request (synchronous) and returns deserialized data. - - To make an async_req request, set the async_req parameter. - - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param response: Response data type. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. - :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_token: dict, optional - :return: - If async_req parameter is True, - the request will be called asynchronously. - The method will return the request thread. - If parameter async_req is False or missing, - then the method will return the response directly. - """ - if not async_req: - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_types_map, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host, - _request_auth) - - return self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, - query_params, - header_params, body, - post_params, files, - response_types_map, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, _request_auth)) - - def request(self, method, url, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - """Makes the HTTP request using RESTClient.""" - if method == "GET": - return self.rest_client.get_request(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "HEAD": - return self.rest_client.head_request(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "OPTIONS": - return self.rest_client.options_request(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout) - elif method == "POST": - return self.rest_client.post_request(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PUT": - return self.rest_client.put_request(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PATCH": - return self.rest_client.patch_request(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "DELETE": - return self.rest_client.delete_request(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - else: - raise ApiValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) - - def parameters_to_tuples(self, params, collection_formats): - """Get parameters as list of tuples, formatting collections. - - :param params: Parameters as dict or list of two-tuples - :param dict collection_formats: Parameter collection formats - :return: Parameters as list of tuples, collections formatted - """ - new_params = [] - if collection_formats is None: - collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 - if k in collection_formats: - collection_format = collection_formats[k] - if collection_format == 'multi': - new_params.extend((k, value) for value in v) - else: - if collection_format == 'ssv': - delimiter = ' ' - elif collection_format == 'tsv': - delimiter = '\t' - elif collection_format == 'pipes': - delimiter = '|' - else: # csv is the default - delimiter = ',' - new_params.append( - (k, delimiter.join(str(value) for value in v))) - else: - new_params.append((k, v)) - return new_params - - def parameters_to_url_query(self, params, collection_formats): - """Get parameters as list of tuples, formatting collections. - - :param params: Parameters as dict or list of two-tuples - :param dict collection_formats: Parameter collection formats - :return: URL query string (e.g. a=Hello%20World&b=123) - """ - new_params = [] - if collection_formats is None: - collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 - if isinstance(v, (int, float)): - v = str(v) - if isinstance(v, bool): - v = str(v).lower() - if isinstance(v, dict): - v = json.dumps(v) - - if k in collection_formats: - collection_format = collection_formats[k] - if collection_format == 'multi': - new_params.extend((k, value) for value in v) - else: - if collection_format == 'ssv': - delimiter = ' ' - elif collection_format == 'tsv': - delimiter = '\t' - elif collection_format == 'pipes': - delimiter = '|' - else: # csv is the default - delimiter = ',' - new_params.append( - (k, delimiter.join(quote(str(value)) for value in v))) - else: - new_params.append((k, quote(str(v)))) - - return "&".join(["=".join(item) for item in new_params]) - - def files_parameters(self, files=None): - """Builds form parameters. - - :param files: File parameters. - :return: Form parameters with files. - """ - params = [] - - if files: - for k, v in files.items(): - if not v: - continue - file_names = v if type(v) is list else [v] - for n in file_names: - with open(n, 'rb') as f: - filename = os.path.basename(f.name) - filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') - params.append( - tuple([k, tuple([filename, filedata, mimetype])])) - - return params - - def select_header_accept(self, accepts): - """Returns `Accept` based on an array of accepts provided. - - :param accepts: List of headers. - :return: Accept (e.g. application/json). - """ - if not accepts: - return - - for accept in accepts: - if re.search('json', accept, re.IGNORECASE): - return accept - - return accepts[0] - - def select_header_content_type(self, content_types): - """Returns `Content-Type` based on an array of content_types provided. - - :param content_types: List of content-types. - :return: Content-Type (e.g. application/json). - """ - if not content_types: - return None - - for content_type in content_types: - if re.search('json', content_type, re.IGNORECASE): - return content_type - - return content_types[0] - - def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body, - request_auth=None): - """Updates header and query params based on authentication setting. - - :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. - :param auth_settings: Authentication setting identifiers list. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param request_auth: if set, the provided settings will - override the token in the configuration. - """ - if not auth_settings: - return - - if request_auth: - self._apply_auth_params(headers, queries, - resource_path, method, body, - request_auth) - return - - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - self._apply_auth_params(headers, queries, - resource_path, method, body, - auth_setting) - - def _apply_auth_params(self, headers, queries, - resource_path, method, body, - auth_setting): - """Updates the request parameters based on a single auth_setting - - :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param auth_setting: auth settings for the endpoint - """ - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - {{#hasHttpSignatureMethods}} - else: - # The HTTP signature scheme requires multiple HTTP headers - # that are calculated dynamically. - signing_info = self.configuration.signing_info - auth_headers = signing_info.get_http_signature_headers( - resource_path, method, headers, body, queries) - headers.update(auth_headers) - {{/hasHttpSignatureMethods}} - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) - - def __deserialize_file(self, response): - """Deserializes body to file - - Saves response body into a file in a temporary folder, - using the filename from the `Content-Disposition` header if provided. - - :param response: RESTResponse. - :return: file path. - """ - fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) - os.close(fd) - os.remove(path) - - content_disposition = response.getheader("Content-Disposition") - if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) - path = os.path.join(os.path.dirname(path), filename) - - with open(path, "wb") as f: - f.write(response.data) - - return path - - def __deserialize_primitive(self, data, klass): - """Deserializes string to primitive type. - - :param data: str. - :param klass: class literal. - - :return: int, long, float, str, bool. - """ - try: - return klass(data) - except UnicodeEncodeError: - return str(data) - except TypeError: - return data - - def __deserialize_object(self, value): - """Return an original value. - - :return: object. - """ - return value - - def __deserialize_date(self, string): - """Deserializes string to date. - - :param string: str. - :return: date. - """ - try: - return parse(string).date() - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason="Failed to parse `{0}` as date object".format(string) - ) - - def __deserialize_datetime(self, string): - """Deserializes string to datetime. - - The string should be in iso8601 datetime format. - - :param string: str. - :return: datetime. - """ - try: - return parse(string) - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason=( - "Failed to parse `{0}` as datetime object" - .format(string) - ) - ) - - def __deserialize_model(self, data, klass): - """Deserializes list or dict to model. - - :param data: dict, list. - :param klass: class literal. - :return: model object. - """ - - return klass.from_dict(data) diff --git a/templates/python/common_README.mustache b/templates/python/common_README.mustache deleted file mode 100644 index 9cc1b53..0000000 --- a/templates/python/common_README.mustache +++ /dev/null @@ -1,93 +0,0 @@ -```python - -import time -import conekta -from conekta.rest import ApiException -from pprint import pprint - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure Bearer authorization: bearerAuth -configuration = conekta.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - - -# Enter a context with an instance of the API client -with conekta.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = conekta.CustomersApi(api_client) - customer = conekta.Customer( - email='customer@customer.com', - name='Customer Name', - phone='5534343434' - ) # Customer | requested field for create Customer - accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') - - try: - # Create Customer - api_response = api_instance.create_customer(customer, accept_language=accept_language) - print("The response of CustomersApi->create_customer:\n") - pprint(api_response) - except ApiException as e: - print("Exception when calling CustomersApi->create_customer: %s\n" % e) - -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{{basePath}}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation For Models - -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) -{{/model}}{{/models}} - - -## Documentation For Authorization - -{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} -{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} -{{#authMethods}} - -### {{{name}}} - -{{#isApiKey}} -- **Type**: API key -- **API key parameter name**: {{{keyParamName}}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} -{{/isApiKey}} -{{#isBasic}} -{{#isBasicBasic}} -- **Type**: HTTP basic authentication -{{/isBasicBasic}} -{{#isBasicBearer}} -- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} -{{/isBasicBearer}} -{{#isHttpSignature}} -- **Type**: HTTP signature authentication -{{/isHttpSignature}} -{{/isBasic}} -{{#isOAuth}} -- **Type**: OAuth -- **Flow**: {{{flow}}} -- **Authorization URL**: {{{authorizationUrl}}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - **{{{scope}}}**: {{{description}}} -{{/scopes}} -{{/isOAuth}} - -{{/authMethods}} - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} \ No newline at end of file diff --git a/templates/python/configuration.mustache b/templates/python/configuration.mustache deleted file mode 100644 index 1c6bc9c..0000000 --- a/templates/python/configuration.mustache +++ /dev/null @@ -1,618 +0,0 @@ -# coding: utf-8 - -{{>partial_header}} - -from __future__ import absolute_import - -import copy -import logging -{{^asyncio}} -import multiprocessing -{{/asyncio}} -import sys -import urllib3 - -import http.client as httplib -from {{packageName}}.exceptions import ApiValueError - - -JSON_SCHEMA_VALIDATION_KEYWORDS = { - 'multipleOf', 'maximum', 'exclusiveMaximum', - 'minimum', 'exclusiveMinimum', 'maxLength', - 'minLength', 'pattern', 'maxItems', 'minItems' -} - -class Configuration(object): - """NOTE: This class is auto generated by OpenAPI Generator - - Ref: https://openapi-generator.tech - Do not edit the class manually. - - :param host: Base url. - :param api_key: Dict to store API key(s). - Each entry in the dict specifies an API key. - The dict key is the name of the security scheme in the OAS specification. - The dict value is the API key secret. - :param api_key_prefix: Dict to store API prefix (e.g. Bearer). - The dict key is the name of the security scheme in the OAS specification. - The dict value is an API key prefix when generating the auth data. - :param username: Username for HTTP basic authentication. - :param password: Password for HTTP basic authentication. - :param access_token: Access token. -{{#hasHttpSignatureMethods}} - :param signing_info: Configuration parameters for the HTTP signature security scheme. - Must be an instance of {{{packageName}}}.signing.HttpSigningConfiguration -{{/hasHttpSignatureMethods}} - :param server_index: Index to servers configuration. - :param server_variables: Mapping with string values to replace variables in - templated server configuration. The validation of enums is performed for - variables with defined enum values before. - :param server_operation_index: Mapping from operation ID to an index to server - configuration. - :param server_operation_variables: Mapping from operation ID to a mapping with - string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum values before. - :param ssl_ca_cert: str - the path to a file of concatenated CA certificates - in PEM format. - -{{#hasAuthMethods}} - :Example: -{{#hasApiKeyMethods}} - - API Key Authentication Example. - Given the following security scheme in the OpenAPI specification: - components: - securitySchemes: - cookieAuth: # name for the security scheme - type: apiKey - in: cookie - name: JSESSIONID # cookie name - - You can programmatically set the cookie: - -conf = {{{packageName}}}.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} -) - - The following cookie will be added to the HTTP request: - Cookie: JSESSIONID abc123 -{{/hasApiKeyMethods}} -{{#hasHttpBasicMethods}} - - HTTP Basic Authentication Example. - Given the following security scheme in the OpenAPI specification: - components: - securitySchemes: - http_basic_auth: - type: http - scheme: basic - - Configure API client with HTTP basic authentication: - -conf = {{{packageName}}}.Configuration( - username='the-user', - password='the-password', -) - -{{/hasHttpBasicMethods}} -{{#hasHttpSignatureMethods}} - - HTTP Signature Authentication Example. - Given the following security scheme in the OpenAPI specification: - components: - securitySchemes: - http_basic_auth: - type: http - scheme: signature - - Configure API client with HTTP signature authentication. Use the 'hs2019' signature scheme, - sign the HTTP requests with the RSA-SSA-PSS signature algorithm, and set the expiration time - of the signature to 5 minutes after the signature has been created. - Note you can use the constants defined in the {{{packageName}}}.signing module, and you can - also specify arbitrary HTTP headers to be included in the HTTP signature, except for the - 'Authorization' header, which is used to carry the signature. - - One may be tempted to sign all headers by default, but in practice it rarely works. - This is because explicit proxies, transparent proxies, TLS termination endpoints or - load balancers may add/modify/remove headers. Include the HTTP headers that you know - are not going to be modified in transit. - -conf = {{{packageName}}}.Configuration( - signing_info = {{{packageName}}}.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'rsa.pem', - signing_scheme = {{{packageName}}}.signing.SCHEME_HS2019, - signing_algorithm = {{{packageName}}}.signing.ALGORITHM_RSASSA_PSS, - signed_headers = [{{{packageName}}}.signing.HEADER_REQUEST_TARGET, - {{{packageName}}}.signing.HEADER_CREATED, - {{{packageName}}}.signing.HEADER_EXPIRES, - {{{packageName}}}.signing.HEADER_HOST, - {{{packageName}}}.signing.HEADER_DATE, - {{{packageName}}}.signing.HEADER_DIGEST, - 'Content-Type', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) -{{/hasHttpSignatureMethods}} -{{/hasAuthMethods}} - """ - - _default = None - - def __init__(self, host=None, - api_key=None, api_key_prefix=None, - username=None, password=None, - access_token=None, -{{#hasHttpSignatureMethods}} - signing_info=None, -{{/hasHttpSignatureMethods}} - server_index=None, server_variables=None, - server_operation_index=None, server_operation_variables=None, - ssl_ca_cert=None, - ): - """Constructor - """ - self._base_path = "{{{basePath}}}" if host is None else host - """Default Base url - """ - self.server_index = 0 if server_index is None and host is None else server_index - self.server_operation_index = server_operation_index or {} - """Default server index - """ - self.server_variables = server_variables or {} - self.server_operation_variables = server_operation_variables or {} - """Default server variables - """ - self.temp_folder_path = None - """Temp file folder for downloading files - """ - # Authentication Settings - self.api_key = {} - if api_key: - self.api_key = api_key - """dict to store API key(s) - """ - self.api_key_prefix = {} - if api_key_prefix: - self.api_key_prefix = api_key_prefix - """dict to store API prefix (e.g. Bearer) - """ - self.refresh_api_key_hook = None - """function hook to refresh API key if expired - """ - self.username = username - """Username for HTTP basic authentication - """ - self.password = password - """Password for HTTP basic authentication - """ - self.access_token = access_token - """Access token - """ -{{#hasHttpSignatureMethods}} - if signing_info is not None: - signing_info.host = host - self.signing_info = signing_info - """The HTTP signing configuration - """ -{{/hasHttpSignatureMethods}} -{{#hasOAuthMethods}} - self.access_token = None - """access token for OAuth/Bearer - """ -{{/hasOAuthMethods}} - self.logger = {} - """Logging Settings - """ - self.logger["package_logger"] = logging.getLogger("{{packageName}}") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = '%(asctime)s %(levelname)s %(message)s' - """Log format - """ - self.logger_stream_handler = None - """Log stream handler - """ - self.logger_file_handler = None - """Log file handler - """ - self.logger_file = None - """Debug file location - """ - self.debug = False - """Debug switch - """ - - self.verify_ssl = True - """SSL/TLS verification - Set this to false to skip verifying SSL certificate when calling API - from https server. - """ - self.ssl_ca_cert = ssl_ca_cert - """Set this to customize the certificate file to verify the peer. - """ - self.cert_file = None - """client certificate file - """ - self.key_file = None - """client key file - """ - self.assert_hostname = None - """Set this to True/False to enable/disable SSL hostname verification. - """ - self.tls_server_name = None - """SSL/TLS Server Name Indication (SNI) - Set this to the SNI value expected by the server. - """ - - {{#asyncio}} - self.connection_pool_maxsize = 100 - """This value is passed to the aiohttp to limit simultaneous connections. - Default values is 100, None means no-limit. - """ - {{/asyncio}} - {{^asyncio}} - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - """urllib3 connection pool's maximum number of connections saved - per pool. urllib3 uses 1 connection as default value, but this is - not the best value when you are making a lot of possibly parallel - requests to the same host, which is often the case here. - cpu_count * 5 is used as default value to increase performance. - """ - {{/asyncio}} - - self.proxy = None - """Proxy URL - """ - self.proxy_headers = None - """Proxy headers - """ - self.safe_chars_for_path_param = '' - """Safe chars for path_param - """ - self.retries = None - """Adding retries to override urllib3 default value 3 - """ - # Enable client side validation - self.client_side_validation = True - - self.socket_options = None - """Options to pass down to the underlying urllib3 socket - """ - - def __deepcopy__(self, memo): - cls = self.__class__ - result = cls.__new__(cls) - memo[id(self)] = result - for k, v in self.__dict__.items(): - if k not in ('logger', 'logger_file_handler'): - setattr(result, k, copy.deepcopy(v, memo)) - # shallow copy of loggers - result.logger = copy.copy(self.logger) - # use setters to configure loggers - result.logger_file = self.logger_file - result.debug = self.debug - return result - - def __setattr__(self, name, value): - object.__setattr__(self, name, value) -{{#hasHttpSignatureMethods}} - if name == "signing_info" and value is not None: - # Ensure the host parameter from signing info is the same as - # Configuration.host. - value.host = self.host -{{/hasHttpSignatureMethods}} - - @classmethod - def set_default(cls, default): - """Set default instance of configuration. - - It stores default configuration, which can be - returned by get_default_copy method. - - :param default: object of Configuration - """ - cls._default = default - - @classmethod - def get_default_copy(cls): - """Deprecated. Please use `get_default` instead. - - Deprecated. Please use `get_default` instead. - - :return: The configuration object. - """ - return cls.get_default() - - @classmethod - def get_default(cls): - """Return the default configuration. - - This method returns newly created, based on default constructor, - object of Configuration class or returns a copy of default - configuration. - - :return: The configuration object. - """ - if cls._default is None: - cls._default = Configuration() - return cls._default - - @property - def logger_file(self): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - return self.__logger_file - - @logger_file.setter - def logger_file(self, value): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - self.__logger_file = value - if self.__logger_file: - # If set logging file, - # then add file handler and remove stream handler. - self.logger_file_handler = logging.FileHandler(self.__logger_file) - self.logger_file_handler.setFormatter(self.logger_formatter) - for _, logger in self.logger.items(): - logger.addHandler(self.logger_file_handler) - - @property - def debug(self): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - return self.__debug - - @debug.setter - def debug(self, value): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - self.__debug = value - if self.__debug: - # if debug status is True, turn on debug logging - for _, logger in self.logger.items(): - logger.setLevel(logging.DEBUG) - # turn on httplib debug - httplib.HTTPConnection.debuglevel = 1 - else: - # if debug status is False, turn off debug logging, - # setting log level to default `logging.WARNING` - for _, logger in self.logger.items(): - logger.setLevel(logging.WARNING) - # turn off httplib debug - httplib.HTTPConnection.debuglevel = 0 - - @property - def logger_format(self): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - return self.__logger_format - - @logger_format.setter - def logger_format(self, value): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - self.__logger_format = value - self.logger_formatter = logging.Formatter(self.__logger_format) - - def get_api_key_with_prefix(self, identifier, alias=None): - """Gets API key (with prefix if set). - - :param identifier: The identifier of apiKey. - :param alias: The alternative identifier of apiKey. - :return: The token for api key authentication. - """ - if self.refresh_api_key_hook is not None: - self.refresh_api_key_hook(self) - key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) - if key: - prefix = self.api_key_prefix.get(identifier) - if prefix: - return "%s %s" % (prefix, key) - else: - return key - - def get_basic_auth_token(self): - """Gets HTTP basic authentication header (string). - - :return: The token for basic HTTP authentication. - """ - username = "" - if self.username is not None: - username = self.username - password = "" - if self.password is not None: - password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') - - def auth_settings(self): - """Gets Auth Settings dict for api client. - - :return: The Auth Settings information dict. - """ - auth = {} -{{#authMethods}} -{{#isApiKey}} - if '{{name}}' in self.api_key{{#vendorExtensions.x-auth-id-alias}} or '{{.}}' in self.api_key{{/vendorExtensions.x-auth-id-alias}}: - auth['{{name}}'] = { - 'type': 'api_key', - 'in': {{#isKeyInCookie}}'cookie'{{/isKeyInCookie}}{{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}}, - 'key': '{{keyParamName}}', - 'value': self.get_api_key_with_prefix( - '{{name}}',{{#vendorExtensions.x-auth-id-alias}} - alias='{{.}}',{{/vendorExtensions.x-auth-id-alias}} - ), - } -{{/isApiKey}} -{{#isBasic}} - {{#isBasicBasic}} - if self.username is not None and self.password is not None: - auth['{{name}}'] = { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - } - {{/isBasicBasic}} - {{#isBasicBearer}} - if self.access_token is not None: - auth['{{name}}'] = { - 'type': 'bearer', - 'in': 'header', - {{#bearerFormat}} - 'format': '{{{.}}}', - {{/bearerFormat}} - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } - {{/isBasicBearer}} - {{#isHttpSignature}} - if self.signing_info is not None: - auth['{{name}}'] = { - 'type': 'http-signature', - 'in': 'header', - 'key': 'Authorization', - 'value': None # Signature headers are calculated for every HTTP request - } - {{/isHttpSignature}} -{{/isBasic}} -{{#isOAuth}} - if self.access_token is not None: - auth['{{name}}'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } -{{/isOAuth}} -{{/authMethods}} - return auth - - def to_debug_report(self): - """Gets the essential information for debugging. - - :return: The report for debugging. - """ - return "Python SDK Debug Report:\n"\ - "OS: {env}\n"\ - "Python Version: {pyversion}\n"\ - "Version of the API: {{version}}\n"\ - "SDK Package Version: {{packageVersion}}".\ - format(env=sys.platform, pyversion=sys.version) - - def get_host_settings(self): - """Gets an array of host settings - - :return: An array of host settings - """ - return [ - {{#servers}} - { - 'url': "{{{url}}}", - 'description': "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - 'variables': { - {{/-first}} - '{{{name}}}': { - 'description': "{{{description}}}{{^description}}No description provided{{/description}}", - 'default_value': "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - 'enum_values': [ - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/enumValues}} - }{{^-last}},{{/-last}} - {{#-last}} - } - {{/-last}} - {{/variables}} - }{{^-last}},{{/-last}} - {{/servers}} - ] - - def get_host_from_settings(self, index, variables=None, servers=None): - """Gets host URL based on the index and variables - :param index: array index of the host settings - :param variables: hash of variable and the corresponding value - :param servers: an array of host settings or None - :return: URL based on host settings - """ - if index is None: - return self._base_path - - variables = {} if variables is None else variables - servers = self.get_host_settings() if servers is None else servers - - try: - server = servers[index] - except IndexError: - raise ValueError( - "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers))) - - url = server['url'] - - # go through variables and replace placeholders - for variable_name, variable in server.get('variables', {}).items(): - used_value = variables.get( - variable_name, variable['default_value']) - - if 'enum_values' in variable \ - and used_value not in variable['enum_values']: - raise ValueError( - "The variable `{0}` in the host URL has invalid value " - "{1}. Must be {2}.".format( - variable_name, variables[variable_name], - variable['enum_values'])) - - url = url.replace("{" + variable_name + "}", used_value) - - return url - - @property - def host(self): - """Return generated host.""" - return self.get_host_from_settings(self.server_index, variables=self.server_variables) - - @host.setter - def host(self, value): - """Fix base path.""" - self._base_path = value - self.server_index = None diff --git a/templates/python/github-workflow.mustache b/templates/python/github-workflow.mustache deleted file mode 100644 index d7c217c..0000000 --- a/templates/python/github-workflow.mustache +++ /dev/null @@ -1,38 +0,0 @@ -# NOTE: This file is auto generated by OpenAPI Generator. -# URL: https://openapi-generator.tech -# -# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: {{packageName}} Python package -{{=<% %>=}} - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest \ No newline at end of file diff --git a/templates/python/gitignore.mustache b/templates/python/gitignore.mustache deleted file mode 100644 index a02e612..0000000 --- a/templates/python/gitignore.mustache +++ /dev/null @@ -1,70 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ -venv/ -.venv/ -.python-version -.pytest_cache - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -#Ipython Notebook -.ipynb_checkpoints -.idea/ - -.DS_Store -.DS_Store? \ No newline at end of file diff --git a/templates/python/pyproject.mustache b/templates/python/pyproject.mustache deleted file mode 100644 index ec5ddf1..0000000 --- a/templates/python/pyproject.mustache +++ /dev/null @@ -1,60 +0,0 @@ -[tool.poetry] -name = "{{{packageName}}}" -version = "{{packageVersion}}" -description = "{{{appName}}}" -authors = ["{{infoName}}{{^infoName}}OpenAPI Generator Community{{/infoName}} <{{infoEmail}}{{^infoEmail}}team@openapitools.org{{/infoEmail}}>"] -license = "{{{licenseInfo}}}{{^licenseInfo}}NoLicense{{/licenseInfo}}" -readme = "README.md" -repository = "https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}" -keywords = ["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"] - -[tool.poetry.dependencies] -python = "^3.7" - -urllib3 = ">= 1.25.3" -python-dateutil = ">=2.8.2" -{{#asyncio}} -aiohttp = ">= 3.8.4" -{{/asyncio}} -{{#tornado}} -tornado = ">=4.2,<5" -{{/tornado}} -{{#hasHttpSignatureMethods}} -pem = ">= 19.3.0" -pycryptodome = ">= 3.9.0" -{{/hasHttpSignatureMethods}} -pydantic = "^1.10.5, <2" -aenum = ">=3.1.11" - -[tool.poetry.dev-dependencies] -pytest = ">=7.2.1" -tox = ">=3.9.0" -flake8 = ">=4.0.0" - -[build-system] -requires = ["setuptools"] -build-backend = "setuptools.build_meta" - -[tool.setuptools_scm] - -[tool.pylint.'MESSAGES CONTROL'] -extension-pkg-whitelist = "pydantic" - -[project] -name = "{{{packageName}}}" -version = "{{packageVersion}}" -authors = [ - { name="{{infoName}}{{^infoName}}OpenAPI Generator Community{{/infoName}}", email="{{infoEmail}}{{^infoEmail}}team@openapitools.org{{/infoEmail}}" }, -] -description = "This is a Python library that allows interaction with https://api.conekta.io API." -readme = "README.md" -requires-python = ">=3.7" -classifiers = [ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", -] - -[project.urls] -"Homepage" = "https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}" -"Bug Tracker" = "https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}/issues" diff --git a/templates/ruby/CUSTOM_VERSION.mustache b/templates/ruby/CUSTOM_VERSION.mustache deleted file mode 100644 index b74d96d..0000000 --- a/templates/ruby/CUSTOM_VERSION.mustache +++ /dev/null @@ -1 +0,0 @@ -{{gemVersion}} diff --git a/templates/ruby/api_client.mustache b/templates/ruby/api_client.mustache deleted file mode 100644 index a86d045..0000000 --- a/templates/ruby/api_client.mustache +++ /dev/null @@ -1,283 +0,0 @@ -=begin -{{> api_info}} -=end - -require 'date' -require 'json' -require 'logger' -require 'tempfile' -require 'time' -{{^isFaraday}} -require 'typhoeus' -{{/isFaraday}} -{{#isFaraday}} -require 'faraday' -require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') -{{/isFaraday}} - -module {{moduleName}} - class ApiClient - # The Configuration object holding settings to be used in the API client. - attr_accessor :config - - # Defines the headers to be used in HTTP requests of all API calls by default. - # - # @return [Hash] - attr_accessor :default_headers - - # Initializes the ApiClient - # @option config [Configuration] Configuration for initializing the object, default to Configuration.default - def initialize(config = Configuration.default) - @config = config - @user_agent = "{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/#{VERSION}/ruby{{/httpUserAgent}}" - @default_headers = { - 'Content-Type' => 'application/json', - 'User-Agent' => @user_agent, - 'X-Conekta-Client-User-Agent' => conekta_headers.to_json - } - end - - def self.default - @@default ||= ApiClient.new - end - -{{^isFaraday}} -{{> api_client_typhoeus_partial}} -{{/isFaraday}} -{{#isFaraday}} -{{> api_client_faraday_partial}} -{{/isFaraday}} - # Check if the given MIME is a JSON MIME. - # JSON MIME examples: - # application/json - # application/json; charset=UTF8 - # APPLICATION/JSON - # */* - # @param [String] mime MIME - # @return [Boolean] True if the MIME is application/json - def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? - end - - # Deserialize the response to the given return type. - # - # @param [Response] response HTTP response - # @param [String] return_type some examples: "User", "Array", "Hash" - def deserialize(response, return_type) - body = response.body - - # handle file downloading - return the File instance processed in request callbacks - # note that response body is empty when the file is written in chunks in request on_body callback - {{^isFaraday}} - return @tempfile if return_type == 'File' - {{/isFaraday}} - {{#isFaraday}} - if return_type == 'File' - if @config.return_binary_data == true - # return byte stream - encoding = body.encoding - return @stream.join.force_encoding(encoding) - else - # return file instead of binary data - content_disposition = response.headers['Content-Disposition'] - if content_disposition && content_disposition =~ /filename=/i - filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] - prefix = sanitize_filename(filename) - else - prefix = 'download-' - end - prefix = prefix + '-' unless prefix.end_with?('-') - encoding = body.encoding - @tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) - @tempfile.write(@stream.join.force_encoding(encoding)) - @tempfile.close - @config.logger.info "Temp file written to #{@tempfile.path}, please copy the file to a proper folder "\ - "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ - "will be deleted automatically with GC. It's also recommended to delete the temp file "\ - "explicitly with `tempfile.delete`" - return @tempfile - end - end - {{/isFaraday}} - - return nil if body.nil? || body.empty? - - # return response body directly for String return type - return body if return_type == 'String' - - # ensuring a default content type - content_type = response.headers['Content-Type'] || 'application/json' - - fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) - - begin - data = JSON.parse("[#{body}]", :symbolize_names => true)[0] - rescue JSON::ParserError => e - if %w(String Date Time).include?(return_type) - data = body - else - raise e - end - end - - convert_to_type data, return_type - end - - # Convert data to the given return type. - # @param [Object] data Data to be converted - # @param [String] return_type Return type - # @return [Mixed] Data in a particular type - def convert_to_type(data, return_type) - return nil if data.nil? - case return_type - when 'String' - data.to_s - when 'Integer' - data.to_i - when 'Float' - data.to_f - when 'Boolean' - data == true - when 'Time' - # parse date time (expecting ISO 8601 format) - Time.parse data - when 'Date' - # parse date time (expecting ISO 8601 format) - Date.parse data - when 'Object' - # generic object (usually a Hash), return directly - data - when /\AArray<(.+)>\z/ - # e.g. Array - sub_type = $1 - data.map { |item| convert_to_type(item, sub_type) } - when /\AHash\\z/ - # e.g. Hash - sub_type = $1 - {}.tap do |hash| - data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } - end - else - # models (e.g. Pet) or oneOf - klass = {{moduleName}}.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) - end - end - - # Sanitize filename by removing path. - # e.g. ../../sun.gif becomes sun.gif - # - # @param [String] filename the filename to be sanitized - # @return [String] the sanitized filename - def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') - end - - def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path - end - - # Update header and query params based on authentication settings. - # - # @param [Hash] header_params Header parameters - # @param [Hash] query_params Query parameters - # @param [String] auth_names Authentication scheme name - def update_params_for_auth!(header_params, query_params, auth_names) - Array(auth_names).each do |auth_name| - auth_setting = @config.auth_settings[auth_name] - next unless auth_setting - case auth_setting[:in] - when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] - when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] - else fail ArgumentError, 'Authentication token must be in `query` or `header`' - end - end - end - - # Sets user agent in HTTP header - # - # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) - def user_agent=(user_agent) - @user_agent = user_agent - @default_headers['User-Agent'] = @user_agent - end - - # Return Accept header based on an array of accepts provided. - # @param [Array] accepts array for Accept - # @return [String] the Accept header (e.g. application/json) - def select_header_accept(accepts) - return nil if accepts.nil? || accepts.empty? - # use JSON when present, otherwise use all of the provided - json_accept = accepts.find { |s| json_mime?(s) } - json_accept || accepts.join(',') - end - - # Return Content-Type header based on an array of content types provided. - # @param [Array] content_types array for Content-Type - # @return [String] the Content-Type header (e.g. application/json) - def select_header_content_type(content_types) - # return nil by default - return if content_types.nil? || content_types.empty? - # use JSON when present, otherwise use the first one - json_content_type = content_types.find { |s| json_mime?(s) } - json_content_type || content_types.first - end - - # Convert object (array, hash, object, etc) to JSON string. - # @param [Object] model object to be converted into JSON string - # @return [String] JSON string representation of the object - def object_to_http_body(model) - return model if model.nil? || model.is_a?(String) - local_body = nil - if model.is_a?(Array) - local_body = model.map { |m| object_to_hash(m) } - else - local_body = object_to_hash(model) - end - local_body.to_json - end - - # Convert object(non-array) to hash. - # @param [Object] obj object to be converted into JSON string - # @return [String] JSON string representation of the object - def object_to_hash(obj) - if obj.respond_to?(:to_hash) - obj.to_hash - else - obj - end - end - - # Build parameter value according to the given collection format. - # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi - def build_collection_param(param, collection_format) - case collection_format - when :csv - param.join(',') - when :ssv - param.join(' ') - when :tsv - param.join("\t") - when :pipes - param.join('|') - when :multi - # return the array directly as typhoeus will handle it as expected - param - else - fail "unknown collection format: #{collection_format.inspect}" - end - end - def conekta_headers - params = { - bindings_version: Conekta::VERSION, - lang: 'ruby', - lang_version: RUBY_VERSION, - publisher: 'conekta' - } - - @conekta_headers ||= params - end - end -end diff --git a/templates/ruby/configuration.mustache b/templates/ruby/configuration.mustache deleted file mode 100644 index 7404954..0000000 --- a/templates/ruby/configuration.mustache +++ /dev/null @@ -1,448 +0,0 @@ -=begin -{{> api_info}} -=end - -module {{moduleName}} - class Configuration - # Defines url scheme - attr_accessor :scheme - - # Defines url host - attr_accessor :host - - # Defines url base path - attr_accessor :base_path - - # Define server configuration index - attr_accessor :server_index - - # Define server operation configuration index - attr_accessor :server_operation_index - - # Default server variables - attr_accessor :server_variables - - # Default server operation variables - attr_accessor :server_operation_variables - - # Defines API keys used with API Key authentications. - # - # @return [Hash] key: parameter name, value: parameter value (API key) - # - # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) - # config.api_key['api_key'] = 'xxx' - attr_accessor :api_key - - # Defines API key prefixes used with API Key authentications. - # - # @return [Hash] key: parameter name, value: API key prefix - # - # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) - # config.api_key_prefix['api_key'] = 'Token' - attr_accessor :api_key_prefix - - # Defines the username used with HTTP basic authentication. - # - # @return [String] - attr_accessor :username - - # Defines the password used with HTTP basic authentication. - # - # @return [String] - attr_accessor :password - - # Defines the access token (Bearer) used with OAuth2. - attr_accessor :access_token - - # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. - # Overrides the access_token if set - # @return [Proc] - attr_accessor :access_token_getter - - # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) - # HTTP responses with return type `File` will be returned as a stream of binary data. - # Default to false. - attr_accessor :return_binary_data - - # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response - # details will be logged with `logger.debug` (see the `logger` attribute). - # Default to false. - # - # @return [true, false] - attr_accessor :debugging - - # Defines the logger used for debugging. - # Default to `Rails.logger` (when in Rails) or logging to STDOUT. - # - # @return [#debug] - attr_accessor :logger - - # Defines the temporary folder to store downloaded files - # (for API endpoints that have file response). - # Default to use `Tempfile`. - # - # @return [String] - attr_accessor :temp_folder_path - - # The time limit for HTTP request in seconds. - # Default to 0 (never times out). - attr_accessor :timeout - - # Set this to false to skip client side validation in the operation. - # Default to true. - # @return [true, false] - attr_accessor :client_side_validation - -{{^isFaraday}} -{{> configuration_typhoeus_partial}} -{{/isFaraday}} -{{#isFaraday}} -{{> configuration_faraday_partial}} -{{/isFaraday}} - - attr_accessor :inject_format - - attr_accessor :force_ending_format - - def initialize - @scheme = '{{scheme}}' - @host = '{{host}}{{#port}}:{{{.}}}{{/port}}' - @base_path = '{{contextPath}}' - @server_index = 0 - @server_operation_index = {} - @server_variables = {} - @server_operation_variables = {} - @api_key = {} - @api_key_prefix = {} - @client_side_validation = true - {{#isFaraday}} - @ssl_verify = true - @ssl_verify_mode = nil - @ssl_ca_file = File.dirname(__FILE__) + '/../ssl_data/ca_bundle.crt' - @ssl_client_cert = nil - @ssl_client_key = nil - @middlewares = Hash.new { |h, k| h[k] = [] } - @configure_connection_blocks = [] - @timeout = 60 - # return data as binary instead of file - @return_binary_data = false - @params_encoder = nil - {{/isFaraday}} - {{^isFaraday}} - @verify_ssl = true - @verify_ssl_host = true - @cert_file = nil - @key_file = nil - @timeout = 0 - @params_encoding = nil - {{/isFaraday}} - @debugging = false - @inject_format = false - @force_ending_format = false - @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) - - yield(self) if block_given? - end - - # The default Configuration object. - def self.default - @@default ||= Configuration.new - end - - def configure - yield(self) if block_given? - end - - def scheme=(scheme) - # remove :// from scheme - @scheme = scheme.sub(/:\/\//, '') - end - - def host=(host) - # remove http(s):// and anything after a slash - @host = host.sub(/https?:\/\//, '').split('/').first - end - - def base_path=(base_path) - # Add leading and trailing slashes to base_path - @base_path = "/#{base_path}".gsub(/\/+/, '/') - @base_path = '' if @base_path == '/' - end - - # Returns base URL for specified operation based on server settings - def base_url(operation = nil) - index = server_operation_index[operation] - return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil - - server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) - end - - # Gets API key (with prefix if set). - # @param [String] param_name the parameter name of API key auth - def api_key_with_prefix(param_name, param_alias = nil) - key = @api_key[param_name] - key = @api_key.fetch(param_alias, key) unless param_alias.nil? - if @api_key_prefix[param_name] - "#{@api_key_prefix[param_name]} #{key}" - else - key - end - end - - # Gets access_token using access_token_getter or uses the static access_token - def access_token_with_refresh - return access_token if access_token_getter.nil? - access_token_getter.call - end - - # Gets Basic Auth token string - def basic_auth_token - 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") - end - - # Returns Auth Settings hash for api client. - def auth_settings - { -{{#authMethods}} -{{#isApiKey}} - '{{name}}' => - { - type: 'api_key', - in: {{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}}, - key: '{{keyParamName}}', - value: api_key_with_prefix('{{name}}'{{#vendorExtensions.x-auth-id-alias}}, '{{.}}'{{/vendorExtensions.x-auth-id-alias}}) - }, -{{/isApiKey}} -{{#isBasic}} -{{#isBasicBasic}} - '{{name}}' => - { - type: 'basic', - in: 'header', - key: 'Authorization', - value: basic_auth_token - }, -{{/isBasicBasic}} -{{#isBasicBearer}} - '{{name}}' => - { - type: 'bearer', - in: 'header', - {{#bearerFormat}} - format: '{{{.}}}', - {{/bearerFormat}} - key: 'Authorization', - value: "Bearer #{access_token_with_refresh}" - }, -{{/isBasicBearer}} -{{/isBasic}} -{{#isOAuth}} - '{{name}}' => - { - type: 'oauth2', - in: 'header', - key: 'Authorization', - value: "Bearer #{access_token_with_refresh}" - }, -{{/isOAuth}} -{{/authMethods}} - } - end - - # Returns an array of Server setting - def server_settings - [ - {{#servers}} - { - url: "{{{url}}}", - description: "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - variables: { - {{/-first}} - {{{name}}}: { - description: "{{{description}}}{{^description}}No description provided{{/description}}", - default_value: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - enum_values: [ - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/enumValues}} - }{{^-last}},{{/-last}} - {{#-last}} - } - {{/-last}} - {{/variables}} - }{{^-last}},{{/-last}} - {{/servers}} - ] - end - - def operation_server_settings - { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#servers}} - {{#-first}} - "{{{classname}}}.{{{nickname}}}": [ - {{/-first}} - { - url: "{{{url}}}", - description: "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - variables: { - {{/-first}} - {{{name}}}: { - description: "{{{description}}}{{^description}}No description provided{{/description}}", - default_value: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - enum_values: [ - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/enumValues}} - }{{^-last}},{{/-last}} - {{#-last}} - } - {{/-last}} - {{/variables}} - }{{^-last}},{{/-last}} - {{#-last}} - ], - {{/-last}} - {{/servers}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} - } - end - - # Returns URL based on server settings - # - # @param index array index of the server settings - # @param variables hash of variable and the corresponding value - def server_url(index, variables = {}, servers = nil) - servers = server_settings if servers == nil - - # check array index out of bound - if (index < 0 || index >= servers.size) - fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" - end - - server = servers[index] - url = server[:url] - - return url unless server.key? :variables - - # go through variable and assign a value - server[:variables].each do |name, variable| - if variables.key?(name) - if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) - url.gsub! "{" + name.to_s + "}", variables[name] - else - fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." - end - else - # use default value - url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] - end - end - - url - end - - {{#isFaraday}} - # Configure Faraday connection directly. - # - # ``` - # c.configure_faraday_connection do |conn| - # conn.use Faraday::HttpCache, shared_cache: false, logger: logger - # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger| - # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]') - # end - # end - # - # c.configure_faraday_connection do |conn| - # conn.adapter :typhoeus - # end - # ``` - # - # @param block [Proc] `#call`able object that takes one arg, the connection - def configure_faraday_connection(&block) - @configure_connection_blocks << block - end - - def configure_connection(conn) - @configure_connection_blocks.each do |block| - block.call(conn) - end - end - - # Adds middleware to the stack - def use(*middleware) - set_faraday_middleware(:use, *middleware) - end - - # Adds request middleware to the stack - def request(*middleware) - set_faraday_middleware(:request, *middleware) - end - - # Adds response middleware to the stack - def response(*middleware) - set_faraday_middleware(:response, *middleware) - end - - # Adds Faraday middleware setting information to the stack - # - # @example Use the `set_faraday_middleware` method to set middleware information - # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503]) - # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug }) - # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false) - # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 }) - # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger) - # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware) - # - # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143 - def set_faraday_middleware(operation, key, *args, &block) - unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation) - fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \ - " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete." - end - - @middlewares[operation] << [key, args, block] - end - ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true) - - # Set up middleware on the connection - def configure_middleware(connection) - return if @middlewares.empty? - - [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation| - next unless @middlewares.key?(operation) - - @middlewares[operation].each do |key, args, block| - connection.builder.send(operation, key, *args, &block) - end - end - - if @middlewares.key?(:delete) - @middlewares[:delete].each do |key, _args, _block| - connection.builder.delete(key) - end - end - end - {{/isFaraday}} - end -end