From 1533f20ab26f388efa28a9b4d77dc59c114c523f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Mon, 2 Oct 2023 17:52:39 -0300 Subject: [PATCH 1/5] typo issues --- src/clients/invoice/commonTypes.ts | 8 ++++---- src/clients/invoice/get/get.spec.ts | 2 +- src/clients/invoice/get/index.ts | 8 ++++---- src/clients/invoice/get/types.ts | 4 ++-- src/clients/invoice/index.ts | 10 +++++----- src/clients/invoice/search/index.ts | 6 +++--- src/clients/invoice/search/search.spec.ts | 2 +- src/clients/invoice/search/types.ts | 16 ++++++++-------- .../preApprovalPlan/create/create.spec.ts | 2 +- src/clients/preApprovalPlan/create/index.ts | 2 +- src/clients/preApprovalPlan/create/types.ts | 2 +- src/clients/preApprovalPlan/get/index.ts | 2 +- src/clients/preApprovalPlan/index.ts | 4 ++-- src/clients/preApprovalPlan/update/index.ts | 2 +- src/clients/preApprovalPlan/update/types.ts | 2 +- src/clients/preference/create/create.spec.ts | 2 +- src/clients/preference/create/index.ts | 2 +- src/clients/preference/create/types.ts | 2 +- src/clients/preference/get/index.ts | 2 +- src/clients/preference/update/index.ts | 2 +- src/clients/preference/update/types.ts | 2 +- src/examples/invoice/get.ts | 6 +++--- src/examples/invoice/search.ts | 6 +++--- src/examples/preference/create.ts | 2 +- src/examples/preference/get.ts | 2 +- src/examples/preference/search.ts | 2 +- src/examples/preference/update.ts | 2 +- 27 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/clients/invoice/commonTypes.ts b/src/clients/invoice/commonTypes.ts index d50acff2..e30b3db9 100644 --- a/src/clients/invoice/commonTypes.ts +++ b/src/clients/invoice/commonTypes.ts @@ -1,10 +1,10 @@ -export declare type InvoicesPayment = { +export declare type InvoicePayment = { id: string; status: string; status_detail: string; }; -export declare type InvoicesResponse = { +export declare type InvoiceResponse = { currency_id?: string; date_created?: string; debit_date?: string; @@ -12,7 +12,7 @@ export declare type InvoicesResponse = { id?: string; last_modified?: string; payer_id?: number; - payment?: InvoicesPayment; + payment?: InvoicePayment; preapproval_id?: string; reason?: string; retry_attempt?: number, @@ -20,4 +20,4 @@ export declare type InvoicesResponse = { summarized?: string; transaction_amount?: number; type?: string; -} \ No newline at end of file +} diff --git a/src/clients/invoice/get/get.spec.ts b/src/clients/invoice/get/get.spec.ts index 3d7f1501..8de76597 100644 --- a/src/clients/invoice/get/get.spec.ts +++ b/src/clients/invoice/get/get.spec.ts @@ -5,7 +5,7 @@ import { MercadoPagoConfig } from '@src/mercadoPagoConfig'; jest.mock('@utils/restClient'); -describe('Testing invoices, get', () => { +describe('Testing invoice, get', () => { test('should make a GET request with the correct parameters', async () => { const client = new MercadoPagoConfig({ accessToken: 'token', options: { timeout: 5000 } }); const id = '1234'; diff --git a/src/clients/invoice/get/index.ts b/src/clients/invoice/get/index.ts index 34e1988a..47ab078f 100644 --- a/src/clients/invoice/get/index.ts +++ b/src/clients/invoice/get/index.ts @@ -1,10 +1,10 @@ import { RestClient } from '@utils/restClient'; -import type { InvoicesGetClient } from './types'; -import type { InvoicesResponse } from '@src/clients/invoices/commonTypes'; +import type { InvoiceGetClient } from './types'; +import type { InvoiceResponse } from '@src/clients/invoice/commonTypes'; -export default function get({ id, config }: InvoicesGetClient): Promise { - return RestClient.fetch( +export default function get({ id, config }: InvoiceGetClient): Promise { + return RestClient.fetch( `/authorized_payments/${id}`, { method: 'GET', diff --git a/src/clients/invoice/get/types.ts b/src/clients/invoice/get/types.ts index f9d828da..4bd0d76e 100644 --- a/src/clients/invoice/get/types.ts +++ b/src/clients/invoice/get/types.ts @@ -1,12 +1,12 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; import type { Options } from '@src/types'; -export declare type InvoicesGetData = { +export declare type InvoiceGetData = { id: string; requestOptions?: Options; } -export declare type InvoicesGetClient = { +export declare type InvoiceGetClient = { id: string; config: MercadoPagoConfig }; diff --git a/src/clients/invoice/index.ts b/src/clients/invoice/index.ts index 1c679c55..35aa1ca8 100644 --- a/src/clients/invoice/index.ts +++ b/src/clients/invoice/index.ts @@ -1,9 +1,9 @@ import get from './get'; import search from './search'; -import type { InvoicesResponse } from './commonTypes'; -import type { InvoicesGetData } from './get/types'; -import type { InvoicesSearchData, InvoicesSearchResponse } from './search/types'; +import type { InvoiceResponse } from './commonTypes'; +import type { InvoiceGetData } from './get/types'; +import type { InvoiceSearchData, InvoiceSearchResponse } from './search/types'; import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; @@ -19,7 +19,7 @@ export class Invoice { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/invoice/get.ts Usage Example }. */ - get({ id, requestOptions }: InvoicesGetData): Promise { + get({ id, requestOptions }: InvoiceGetData): Promise { this.config.options = { ...this.config.options, ...requestOptions }; return get({ id, config: this.config }); } @@ -29,7 +29,7 @@ export class Invoice { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/invoice/search.ts Usage Example }. */ - search(ivoicesSearchOptions: InvoicesSearchData = {}): Promise { + search(ivoicesSearchOptions: InvoiceSearchData = {}): Promise { const { options, requestOptions } = ivoicesSearchOptions; this.config.options = { ...this.config.options, ...requestOptions }; return search({ options, config: this.config }); diff --git a/src/clients/invoice/search/index.ts b/src/clients/invoice/search/index.ts index be2dd4e9..8bed8e3a 100644 --- a/src/clients/invoice/search/index.ts +++ b/src/clients/invoice/search/index.ts @@ -1,9 +1,9 @@ import { RestClient } from '@utils/restClient'; -import type { InvoicesSearchClient, InvoicesSearchResponse } from './types'; +import type { InvoiceSearchClient, InvoiceSearchResponse } from './types'; -export default function search({ options, config }: InvoicesSearchClient): Promise { - return RestClient.fetch( +export default function search({ options, config }: InvoiceSearchClient): Promise { + return RestClient.fetch( '/authorized_payments/search', { headers: { diff --git a/src/clients/invoice/search/search.spec.ts b/src/clients/invoice/search/search.spec.ts index 75587701..3bc2d615 100644 --- a/src/clients/invoice/search/search.spec.ts +++ b/src/clients/invoice/search/search.spec.ts @@ -5,7 +5,7 @@ import { MercadoPagoConfig } from '@src/mercadoPagoConfig'; jest.mock('@utils/restClient'); -describe('Testing invoices, search', () => { +describe('Testing invoice, search', () => { test('should make a SEARCH request with the correct parameters', async () => { const client = new MercadoPagoConfig({ accessToken: 'token' }); const expectedHeaders = { diff --git a/src/clients/invoice/search/types.ts b/src/clients/invoice/search/types.ts index 6fccba74..88f43ae1 100644 --- a/src/clients/invoice/search/types.ts +++ b/src/clients/invoice/search/types.ts @@ -1,19 +1,19 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; import type { Paging } from '@src/clients/commonTypes'; -import type { InvoicesResponse } from '@src/clients/invoices/commonTypes'; +import type { InvoiceResponse } from '@src/clients/invoice/commonTypes'; import type { Options, SearchOptions } from '@src/types'; -export declare type InvoicesSearchData = { - options?: InvoicesSearchOptions; +export declare type InvoiceSearchData = { + options?: InvoiceSearchOptions; requestOptions?: Options; } -export declare type InvoicesSearchClient = { - options?: InvoicesSearchOptions; +export declare type InvoiceSearchClient = { + options?: InvoiceSearchOptions; config: MercadoPagoConfig } -export declare interface InvoicesSearchOptions extends SearchOptions { +export declare interface InvoiceSearchOptions extends SearchOptions { id?: number; preapproval_id?: string; payment_id?: number; @@ -22,7 +22,7 @@ export declare interface InvoicesSearchOptions extends SearchOptions { limit?: number; } -export declare type InvoicesSearchResponse = { +export declare type InvoiceSearchResponse = { paging?: Paging; - results?: Array; + results?: Array; } diff --git a/src/clients/preApprovalPlan/create/create.spec.ts b/src/clients/preApprovalPlan/create/create.spec.ts index f5506281..78576f8c 100644 --- a/src/clients/preApprovalPlan/create/create.spec.ts +++ b/src/clients/preApprovalPlan/create/create.spec.ts @@ -3,7 +3,7 @@ import create from '.'; import { RestClient } from '@utils/restClient'; import { MercadoPagoConfig } from '@src/mercadoPagoConfig'; -import type { PreApprovalPlanRequest } from '@src/clients/preApprovalPlans/commonTypes'; +import type { PreApprovalPlanRequest } from '@src/clients/preApprovalPlan/commonTypes'; jest.mock('@utils/restClient'); diff --git a/src/clients/preApprovalPlan/create/index.ts b/src/clients/preApprovalPlan/create/index.ts index e9c26274..2c9f22e2 100644 --- a/src/clients/preApprovalPlan/create/index.ts +++ b/src/clients/preApprovalPlan/create/index.ts @@ -1,7 +1,7 @@ import { RestClient } from '@utils/restClient'; import type { PreApprovalPlansCreateClient } from './types'; -import type { PreApprovalPlanResponse } from '@src/clients/preApprovalPlans/commonTypes'; +import type { PreApprovalPlanResponse } from '@src/clients/preApprovalPlan/commonTypes'; export default function create({ body, config }: PreApprovalPlansCreateClient): Promise { return RestClient.fetch( diff --git a/src/clients/preApprovalPlan/create/types.ts b/src/clients/preApprovalPlan/create/types.ts index 7175810b..62915d7a 100644 --- a/src/clients/preApprovalPlan/create/types.ts +++ b/src/clients/preApprovalPlan/create/types.ts @@ -1,5 +1,5 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; -import type { PreApprovalPlanRequest } from '@src/clients/preApprovalPlans/commonTypes'; +import type { PreApprovalPlanRequest } from '@src/clients/preApprovalPlan/commonTypes'; import type { Options } from '@src/types'; export declare type PreApprovalPlansCreateClient = { diff --git a/src/clients/preApprovalPlan/get/index.ts b/src/clients/preApprovalPlan/get/index.ts index a4d7d329..c972a862 100644 --- a/src/clients/preApprovalPlan/get/index.ts +++ b/src/clients/preApprovalPlan/get/index.ts @@ -1,7 +1,7 @@ import { RestClient } from '@utils/restClient'; import type { PreApprovalPlansGetClient } from './types'; -import type { PreApprovalPlanResponse } from '@src/clients/preApprovalPlans/commonTypes'; +import type { PreApprovalPlanResponse } from '@src/clients/preApprovalPlan/commonTypes'; export default function get({ id, config }: PreApprovalPlansGetClient): Promise { return RestClient.fetch( diff --git a/src/clients/preApprovalPlan/index.ts b/src/clients/preApprovalPlan/index.ts index 40bc0c78..626ab7d1 100644 --- a/src/clients/preApprovalPlan/index.ts +++ b/src/clients/preApprovalPlan/index.ts @@ -57,8 +57,8 @@ export class PreApprovalPlan { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/preapprovalplan/search.ts Usage Example }. */ - search(preApprovalPlansSearchData: PreApprovalPlansSearchData = {}): Promise { - const { options, requestOptions } = preApprovalPlansSearchData; + search(preApprovalPlanSearchData: PreApprovalPlansSearchData = {}): Promise { + const { options, requestOptions } = preApprovalPlanSearchData; this.config.options = { ...this.config.options, ...requestOptions }; return search({ options, config: this.config }); } diff --git a/src/clients/preApprovalPlan/update/index.ts b/src/clients/preApprovalPlan/update/index.ts index 08702477..c89957c0 100644 --- a/src/clients/preApprovalPlan/update/index.ts +++ b/src/clients/preApprovalPlan/update/index.ts @@ -1,7 +1,7 @@ import { RestClient } from '@utils/restClient'; import type { UpdatePreApprovalPlanUpdateClient } from './types'; -import type { PreApprovalPlanResponse } from '@src/clients/preApprovalPlans/commonTypes'; +import type { PreApprovalPlanResponse } from '@src/clients/preApprovalPlan/commonTypes'; export default function update({ id, updatePreApprovalPlanRequest, config }: UpdatePreApprovalPlanUpdateClient): Promise { return RestClient.fetch( diff --git a/src/clients/preApprovalPlan/update/types.ts b/src/clients/preApprovalPlan/update/types.ts index eb4f1a9e..19d1f5f8 100644 --- a/src/clients/preApprovalPlan/update/types.ts +++ b/src/clients/preApprovalPlan/update/types.ts @@ -1,5 +1,5 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; -import type { PreApprovalPlanRequest } from '@src/clients/preApprovalPlans/commonTypes'; +import type { PreApprovalPlanRequest } from '@src/clients/preApprovalPlan/commonTypes'; import type { Options } from '@src/types'; export declare type PreApprovalPlanId = { diff --git a/src/clients/preference/create/create.spec.ts b/src/clients/preference/create/create.spec.ts index fe628e41..01a40617 100644 --- a/src/clients/preference/create/create.spec.ts +++ b/src/clients/preference/create/create.spec.ts @@ -3,7 +3,7 @@ import create from '.'; import { RestClient } from '@utils/restClient'; import { MercadoPagoConfig } from '@src/mercadoPagoConfig' ; -import type { PreferenceRequest } from '@src/clients/preferences/commonTypes'; +import type { PreferenceRequest } from '@src/clients/preference/commonTypes'; jest.mock('@utils/restClient'); diff --git a/src/clients/preference/create/index.ts b/src/clients/preference/create/index.ts index c42ba60f..dcca5c98 100644 --- a/src/clients/preference/create/index.ts +++ b/src/clients/preference/create/index.ts @@ -1,7 +1,7 @@ import { RestClient } from '@utils/restClient'; import type { PreferenceCreateClient } from './types'; -import type { PreferenceResponse } from '@src/clients/preferences/commonTypes'; +import type { PreferenceResponse } from '@src/clients/preference/commonTypes'; export default function create({ body, config }: PreferenceCreateClient): Promise { return RestClient.fetch( diff --git a/src/clients/preference/create/types.ts b/src/clients/preference/create/types.ts index 733542f3..819996be 100644 --- a/src/clients/preference/create/types.ts +++ b/src/clients/preference/create/types.ts @@ -1,5 +1,5 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; -import type { PreferenceRequest } from '@src/clients/preferences/commonTypes'; +import type { PreferenceRequest } from '@src/clients/preference/commonTypes'; import type { Options } from '@src/types'; export declare type PreferenceCreateClient = { diff --git a/src/clients/preference/get/index.ts b/src/clients/preference/get/index.ts index a8c38c7f..7b62ab67 100644 --- a/src/clients/preference/get/index.ts +++ b/src/clients/preference/get/index.ts @@ -1,7 +1,7 @@ import { RestClient } from '@utils/restClient'; import type { PreferenceGetClient } from './types'; -import type { PreferenceResponse } from '@src/clients/preferences/commonTypes'; +import type { PreferenceResponse } from '@src/clients/preference/commonTypes'; export default function get({ id, config }: PreferenceGetClient): Promise { return RestClient.fetch( diff --git a/src/clients/preference/update/index.ts b/src/clients/preference/update/index.ts index a2670f84..ab173abc 100644 --- a/src/clients/preference/update/index.ts +++ b/src/clients/preference/update/index.ts @@ -1,7 +1,7 @@ import { RestClient } from '@utils/restClient'; import type { PreferenceUpdateClient } from './types'; -import type { PreferenceResponse } from '@src/clients/preferences/commonTypes'; +import type { PreferenceResponse } from '@src/clients/preference/commonTypes'; export default function update({ id, updatePreferenceRequest, config }: PreferenceUpdateClient): Promise { return RestClient.fetch( diff --git a/src/clients/preference/update/types.ts b/src/clients/preference/update/types.ts index fb511605..cd441153 100644 --- a/src/clients/preference/update/types.ts +++ b/src/clients/preference/update/types.ts @@ -1,5 +1,5 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; -import type { PreferenceRequest } from '@src/clients/preferences/commonTypes'; +import type { PreferenceRequest } from '@src/clients/preference/commonTypes'; import type { Options } from '@src/types'; export declare type PreferenceId = { diff --git a/src/examples/invoice/get.ts b/src/examples/invoice/get.ts index f31d85d7..c0300a2e 100644 --- a/src/examples/invoice/get.ts +++ b/src/examples/invoice/get.ts @@ -1,13 +1,13 @@ import MercadoPago, { Invoice } from '@src/index'; /** - * Mercado Pago Invoices . + * Mercado Pago Invoice . * * @see {@link https://www.mercadopago.com/developers/en/reference/subscriptions/_authorized_payments_id/get Documentation }. */ const client = new MercadoPago({ accessToken: '', options: { timeout: 5000 } }); -const invoices = new Invoice(client); +const invoice = new Invoice(client); -invoices.get({ id: '1234' }).then(console.log).catch(console.log); +invoice.get({ id: '1234' }).then(console.log).catch(console.log); diff --git a/src/examples/invoice/search.ts b/src/examples/invoice/search.ts index 1c89fb6e..df88e12d 100644 --- a/src/examples/invoice/search.ts +++ b/src/examples/invoice/search.ts @@ -1,14 +1,14 @@ import MercadoPago, { Invoice } from '@src/index'; /** - * Mercado Pago Invoices. + * Mercado Pago Invoice. * * @see {@link https://www.mercadopago.com/developers/en/reference/subscriptions/_authorized_payments_search/get Documentation }. */ const client = new MercadoPago({ accessToken: '', options: { timeout: 9000 } }); -const invoices = new Invoice(client); +const invoice = new Invoice(client); const options = { id: 1234, preapproval_id: '', @@ -16,4 +16,4 @@ const options = { payer_id: 1234 }; -invoices.search({ options }).then(console.log).catch(console.log); +invoice.search({ options }).then(console.log).catch(console.log); diff --git a/src/examples/preference/create.ts b/src/examples/preference/create.ts index c60ff82f..27826d7b 100644 --- a/src/examples/preference/create.ts +++ b/src/examples/preference/create.ts @@ -3,7 +3,7 @@ import MercadoPago, { Preference } from '@src/index'; /** * Mercado Pago Preference. * - * @see {@link https://www.mercadopago.com/developers/en/reference/preferences/_checkout_preferences/post Documentation }. + * @see {@link https://www.mercadopago.com/developers/en/reference/preference/_checkout_preference/post Documentation }. */ const client = new MercadoPago({ accessToken: '', options: { timeout: 5000 } }); diff --git a/src/examples/preference/get.ts b/src/examples/preference/get.ts index 894a95d5..5c7a5728 100644 --- a/src/examples/preference/get.ts +++ b/src/examples/preference/get.ts @@ -3,7 +3,7 @@ import MercadoPago, { Preference } from '@src/index'; /** * Mercado Pago Preference. * - * @see {@link https://www.mercadopago.com/developers/en/reference/preferences/_checkout_preferences_id/get Documentation }. + * @see {@link https://www.mercadopago.com/developers/en/reference/preference/_checkout_preference_id/get Documentation }. */ const client = new MercadoPago({ accessToken: '', options: { timeout: 5000 } }); diff --git a/src/examples/preference/search.ts b/src/examples/preference/search.ts index efb6725f..dd063c18 100644 --- a/src/examples/preference/search.ts +++ b/src/examples/preference/search.ts @@ -3,7 +3,7 @@ import MercadoPago, { Preference } from '@src/index'; /** * Mercado Pago Preference. * - * @see {@link https://www.mercadopago.com/developers/en/reference/preferences/_checkout_preferences_search/get Documentation }. + * @see {@link https://www.mercadopago.com/developers/en/reference/preference/_checkout_preference_search/get Documentation }. */ const client = new MercadoPago({ accessToken: '' }); diff --git a/src/examples/preference/update.ts b/src/examples/preference/update.ts index 817993ac..b547d023 100644 --- a/src/examples/preference/update.ts +++ b/src/examples/preference/update.ts @@ -3,7 +3,7 @@ import MercadoPago, { Preference } from '@src/index'; /** * Mercado Pago Preference. * - * @see {@link https://www.mercadopago.com/developers/en/reference/preferences/_checkout_preferences_id/put Documentation }. + * @see {@link https://www.mercadopago.com/developers/en/reference/preference/_checkout_preference_id/put Documentation }. */ const client = new MercadoPago({ accessToken: '' }); From 83054dd7555da02f1085e666221cd833ba24f8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Mon, 2 Oct 2023 17:59:52 -0300 Subject: [PATCH 2/5] rename payments to payment --- package.json | 2 +- src/clients/payment/cancel/index.ts | 6 +++--- src/clients/payment/capture/index.ts | 6 +++--- src/clients/payment/commonTypes.ts | 2 +- src/clients/payment/create/index.ts | 6 +++--- src/clients/payment/create/types.ts | 8 ++++---- src/clients/payment/get/index.ts | 6 +++--- src/clients/payment/index.ts | 14 +++++++------- src/clients/payment/search/index.ts | 6 +++--- src/clients/payment/search/types.ts | 16 ++++++++-------- src/utils/config/index.ts | 2 +- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 614d97e0..a89eb2ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mercadopago", - "version": "2.0.0", + "version": "2.0.1", "description": "Mercadopago SDK for Node.js", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/clients/payment/cancel/index.ts b/src/clients/payment/cancel/index.ts index 49dd63bd..2af68217 100644 --- a/src/clients/payment/cancel/index.ts +++ b/src/clients/payment/cancel/index.ts @@ -1,13 +1,13 @@ import { RestClient } from '@utils/restClient'; -import type { PaymentsResponse } from '../commonTypes'; +import type { PaymentResponse } from '../commonTypes'; import type { PaymentCancelClient } from './types'; -export default function cancel({ id, config }: PaymentCancelClient): Promise { +export default function cancel({ id, config }: PaymentCancelClient): Promise { const cancelBody = { status: 'cancelled' }; - return RestClient.fetch( + return RestClient.fetch( `/v1/payments/${id}`, { method: 'PUT', diff --git a/src/clients/payment/capture/index.ts b/src/clients/payment/capture/index.ts index ae182d4b..3d3a0d2c 100644 --- a/src/clients/payment/capture/index.ts +++ b/src/clients/payment/capture/index.ts @@ -1,15 +1,15 @@ import { RestClient } from '@utils/restClient'; -import type { PaymentsResponse } from '../commonTypes'; +import type { PaymentResponse } from '../commonTypes'; import type { PaymentCaptureClient } from './types'; -export default function capture({ id, transaction_amount, config }: PaymentCaptureClient): Promise { +export default function capture({ id, transaction_amount, config }: PaymentCaptureClient): Promise { const captureBody = { capture: true, transaction_amount }; - return RestClient.fetch( + return RestClient.fetch( `/v1/payments/${id}`, { method: 'PUT', diff --git a/src/clients/payment/commonTypes.ts b/src/clients/payment/commonTypes.ts index 2a4c10a6..a80e2ae2 100644 --- a/src/clients/payment/commonTypes.ts +++ b/src/clients/payment/commonTypes.ts @@ -200,7 +200,7 @@ export declare type ThreeDSInfo = { creq?: string; }; -export declare interface PaymentsResponse extends ApiResponse { +export declare interface PaymentResponse extends ApiResponse { id?: number; date_created?: string; date_approved?: string; diff --git a/src/clients/payment/create/index.ts b/src/clients/payment/create/index.ts index 9310e63a..827040f9 100644 --- a/src/clients/payment/create/index.ts +++ b/src/clients/payment/create/index.ts @@ -1,9 +1,9 @@ import { RestClient } from '@src/utils/restClient'; import type { PaymentCreateClient } from './types'; -import type { PaymentsResponse } from '../commonTypes'; +import type { PaymentResponse } from '../commonTypes'; -export default function create({ body, config }: PaymentCreateClient): Promise { - return RestClient.fetch( +export default function create({ body, config }: PaymentCreateClient): Promise { + return RestClient.fetch( '/v1/payments', { method: 'POST', diff --git a/src/clients/payment/create/types.ts b/src/clients/payment/create/types.ts index 1035045e..70008ddb 100644 --- a/src/clients/payment/create/types.ts +++ b/src/clients/payment/create/types.ts @@ -4,20 +4,20 @@ import type { Payer } from '../commonTypes'; import type { Options } from '@src/types'; export declare type PaymentCreateClient = { - body: PaymentsCreateRequest, + body: PaymentCreateRequest, config: MercadoPagoConfig }; export declare type qqrcoisatest = { - body: PaymentsCreateRequest, + body: PaymentCreateRequest, }; export declare type PaymentCreateData = { - body: PaymentsCreateRequest; + body: PaymentCreateRequest; requestOptions?: Options; } -export declare type PaymentsCreateRequest = { +export declare type PaymentCreateRequest = { additional_info?: additionalInfo, application_fee?: string, binary_mode?: boolean, diff --git a/src/clients/payment/get/index.ts b/src/clients/payment/get/index.ts index dc3e0df3..2684335b 100644 --- a/src/clients/payment/get/index.ts +++ b/src/clients/payment/get/index.ts @@ -1,10 +1,10 @@ import { RestClient } from '@utils/restClient'; -import type { PaymentsResponse } from '../commonTypes'; +import type { PaymentResponse } from '../commonTypes'; import type { PaymentGetClient } from './types'; -export default function get({ id, config }: PaymentGetClient): Promise { - return RestClient.fetch( +export default function get({ id, config }: PaymentGetClient): Promise { + return RestClient.fetch( `/v1/payments/${id}`, { headers: { diff --git a/src/clients/payment/index.ts b/src/clients/payment/index.ts index e959ee22..35da7c29 100644 --- a/src/clients/payment/index.ts +++ b/src/clients/payment/index.ts @@ -4,8 +4,8 @@ import cancel from './cancel'; import create from './create'; import get from './get'; -import type { PaymentsResponse } from './commonTypes'; -import type { PaymentSearchData, PaymentsSearch } from './search/types'; +import type { PaymentResponse } from './commonTypes'; +import type { PaymentSearchData, PaymentSearch } from './search/types'; import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; import type { PaymentCreateData } from './create/types'; import type { PaymentCaptureData } from './capture/types'; @@ -29,7 +29,7 @@ export class Payment { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/payment/search.ts Usage Example }. */ - search(paymentSearchOptions: PaymentSearchData = {}): Promise { + search(paymentSearchOptions: PaymentSearchData = {}): Promise { const { options, requestOptions } = paymentSearchOptions; this.config.options = { ...this.config.options, ...requestOptions }; return search({ options, config: this.config }); @@ -40,7 +40,7 @@ export class Payment { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/payment/cancel.ts Usage Example }. */ - cancel({ id, requestOptions }: PaymentCancelData): Promise { + cancel({ id, requestOptions }: PaymentCancelData): Promise { this.config.options = { ...this.config.options, ...requestOptions }; return cancel({ id, config: this.config } ); } @@ -50,7 +50,7 @@ export class Payment { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/payment/capture.ts Usage Example }. */ - capture({ id, transaction_amount, requestOptions }: PaymentCaptureData): Promise { + capture({ id, transaction_amount, requestOptions }: PaymentCaptureData): Promise { this.config.options = { ...this.config.options, ...requestOptions }; return capture({ id, transaction_amount, config: this.config }); } @@ -60,7 +60,7 @@ export class Payment { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/payment/create.ts Usage Example }. */ - create({ body, requestOptions }: PaymentCreateData): Promise { + create({ body, requestOptions }: PaymentCreateData): Promise { this.config.options = { ...this.config.options, ...requestOptions }; return create({ body, config: this.config }); } @@ -70,7 +70,7 @@ export class Payment { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/payment/get.ts Usage Example }. */ - get({ id, requestOptions }: PaymentGetData): Promise { + get({ id, requestOptions }: PaymentGetData): Promise { this.config.options = { ...this.config.options, ...requestOptions }; return get({ id, config: this.config } ); } diff --git a/src/clients/payment/search/index.ts b/src/clients/payment/search/index.ts index 1bd0a3d2..d54a9c35 100644 --- a/src/clients/payment/search/index.ts +++ b/src/clients/payment/search/index.ts @@ -1,8 +1,8 @@ import { RestClient } from '@src/utils/restClient'; -import type { PaymentsSearch, PaymentSearchClient } from './types'; +import type { PaymentSearch, PaymentSearchClient } from './types'; -export default function search({ options, config }: PaymentSearchClient): Promise { - return RestClient.fetch( +export default function search({ options, config }: PaymentSearchClient): Promise { + return RestClient.fetch( '/v1/payments/search', { headers: { diff --git a/src/clients/payment/search/types.ts b/src/clients/payment/search/types.ts index 5df17b9c..00a31220 100644 --- a/src/clients/payment/search/types.ts +++ b/src/clients/payment/search/types.ts @@ -3,16 +3,16 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; import type { Options, SearchOptions } from '@src/types'; export declare type PaymentSearchClient = { - options?: PaymentsSearchOptions, + options?: PaymentSearchOptions, config: MercadoPagoConfig }; -export declare type PaymentsSearch = { - paging?: PaymentsSearchPaging; - results?: Array; +export declare type PaymentSearch = { + paging?: PaymentSearchPaging; + results?: Array; }; -export declare type PaymentsSearchResult = { +export declare type PaymentSearchResult = { id: string; date_created: string; date_approved: string; @@ -75,13 +75,13 @@ export declare type TransactionDetails = { acquirer_reference: string; }; -export declare type PaymentsSearchPaging = { +export declare type PaymentSearchPaging = { total: number; limit: number; offset: number; }; -export declare interface PaymentsSearchOptions extends SearchOptions { +export declare interface PaymentSearchOptions extends SearchOptions { sort?: 'date_approved' | 'date_created' | 'date_last_updated' | 'money_release_date'; criteria?: 'asc' | 'desc'; external_reference?: string; @@ -91,6 +91,6 @@ export declare interface PaymentsSearchOptions extends SearchOptions { } export declare type PaymentSearchData = { - options?: PaymentsSearchOptions; + options?: PaymentSearchOptions; requestOptions?: Options; } diff --git a/src/utils/config/index.ts b/src/utils/config/index.ts index fe363552..0f673490 100644 --- a/src/utils/config/index.ts +++ b/src/utils/config/index.ts @@ -5,7 +5,7 @@ export class AppConfig { static readonly BASE_URL = 'https://api.mercadopago.com'; static readonly PRODUCT_ID = 'bc32b6ntrpp001u8nhkg'; - static SDK_VERSION = '2.0.0'; + static SDK_VERSION = '2.0.1'; static readonly Headers = { AUTHORIZATION: 'Authorization', From 5aef0dc4519c5617f50612ace728a5c99812be08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Mon, 2 Oct 2023 19:02:44 -0300 Subject: [PATCH 3/5] typo issues --- src/clients/identificationType/index.ts | 8 ++++---- src/clients/identificationType/list/types.ts | 2 +- src/clients/payment/commonTypes.ts | 4 ++-- src/clients/user/get/types.ts | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/clients/identificationType/index.ts b/src/clients/identificationType/index.ts index cad4c893..f5f6ad61 100644 --- a/src/clients/identificationType/index.ts +++ b/src/clients/identificationType/index.ts @@ -1,10 +1,10 @@ import list from './list'; import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; -import type { IdentificationTypeResponse, IdentificationTypesListData } from './list/types'; +import type { IdentificationTypeResponse, IdentificationTypeListData } from './list/types'; /** - * Mercado Pago IdentificationTypes. + * Mercado Pago IdentificationType. * * @see {@link https://www.mercadopago.com/developers/en/reference/identification_types/_identification_types/get Documentation }. */ @@ -20,8 +20,8 @@ export class IdentificationType { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/examples/identificationtype/list.ts Usage Example }. */ - list(IdentificationTypesListOptions: IdentificationTypesListData = {} as IdentificationTypesListData): Promise { - const { requestOptions } = IdentificationTypesListOptions; + list(identificationTypeListOptions: IdentificationTypeListData = {} as IdentificationTypeListData): Promise { + const { requestOptions } = identificationTypeListOptions; this.config.options = { ...this.config.options, ...requestOptions }; return list({ config: this.config }); } diff --git a/src/clients/identificationType/list/types.ts b/src/clients/identificationType/list/types.ts index e74d9859..4d8b841d 100644 --- a/src/clients/identificationType/list/types.ts +++ b/src/clients/identificationType/list/types.ts @@ -1,7 +1,7 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; import type { ApiResponse, Options } from '@src/types'; -export declare type IdentificationTypesListData = { +export declare type IdentificationTypeListData = { requestOptions?: Options; } diff --git a/src/clients/payment/commonTypes.ts b/src/clients/payment/commonTypes.ts index a80e2ae2..17f6e95f 100644 --- a/src/clients/payment/commonTypes.ts +++ b/src/clients/payment/commonTypes.ts @@ -67,7 +67,7 @@ export declare type PayerAdditionalInfo = { registration_date?: string; }; -export declare type ShipmentsPayments = { +export declare type ShipmentsPayment = { receiver_address?: ShipmentsReceiverAddress; }; @@ -82,7 +82,7 @@ export declare type AdditionalInfo = { ip_address?: string; items?: Array; payer?: PayerAdditionalInfo; - shipments?: ShipmentsPayments; + shipments?: ShipmentsPayment; }; export declare type TransactionDetails = { diff --git a/src/clients/user/get/types.ts b/src/clients/user/get/types.ts index 7f0f4000..fd8acf44 100644 --- a/src/clients/user/get/types.ts +++ b/src/clients/user/get/types.ts @@ -127,16 +127,16 @@ export declare type BuyerReputationTransactionsWithUnits = { export declare type Status = { billing: StatusBilling; - buy: StatusAllowImmediatePayments; + buy: StatusAllowImmediatePayment; confirmed_email: boolean; shopping_cart: StatusShoppingCart; immediate_payment: boolean; - list: StatusAllowImmediatePayments; + list: StatusAllowImmediatePayment; mercadoenvios: string; mercadopago_account_type: string; mercadopago_tc_accepted: boolean; required_action: string | null; - sell: StatusAllowImmediatePayments; + sell: StatusAllowImmediatePayment; site_status: string; user_type: string; }; @@ -151,7 +151,7 @@ export declare type StatusShoppingCart = { sell: string; }; -export declare type StatusAllowImmediatePayments = { +export declare type StatusAllowImmediatePayment = { allow: boolean; codes: string[]; immediate_payment: StatusImmediatePayment; From c64a2ebd6348ef4d4d413e8597848c1a2ed2a116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Mon, 2 Oct 2023 19:05:38 -0300 Subject: [PATCH 4/5] typo issues --- src/clients/preApprovalPlan/create/index.ts | 4 ++-- src/clients/preApprovalPlan/create/types.ts | 4 ++-- src/clients/preApprovalPlan/get/index.ts | 4 ++-- src/clients/preApprovalPlan/get/types.ts | 4 ++-- src/clients/preApprovalPlan/index.ts | 12 ++++++------ src/clients/preApprovalPlan/search/index.ts | 4 ++-- src/clients/preApprovalPlan/search/types.ts | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/clients/preApprovalPlan/create/index.ts b/src/clients/preApprovalPlan/create/index.ts index 2c9f22e2..eed2c77b 100644 --- a/src/clients/preApprovalPlan/create/index.ts +++ b/src/clients/preApprovalPlan/create/index.ts @@ -1,9 +1,9 @@ import { RestClient } from '@utils/restClient'; -import type { PreApprovalPlansCreateClient } from './types'; +import type { PreApprovalPlanCreateClient } from './types'; import type { PreApprovalPlanResponse } from '@src/clients/preApprovalPlan/commonTypes'; -export default function create({ body, config }: PreApprovalPlansCreateClient): Promise { +export default function create({ body, config }: PreApprovalPlanCreateClient): Promise { return RestClient.fetch( '/preapproval_plan/', { diff --git a/src/clients/preApprovalPlan/create/types.ts b/src/clients/preApprovalPlan/create/types.ts index 62915d7a..f427fc1f 100644 --- a/src/clients/preApprovalPlan/create/types.ts +++ b/src/clients/preApprovalPlan/create/types.ts @@ -2,12 +2,12 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; import type { PreApprovalPlanRequest } from '@src/clients/preApprovalPlan/commonTypes'; import type { Options } from '@src/types'; -export declare type PreApprovalPlansCreateClient = { +export declare type PreApprovalPlanCreateClient = { body: PreApprovalPlanRequest; config: MercadoPagoConfig }; -export declare type PreApprovalPlansCreateData = { +export declare type PreApprovalPlanCreateData = { body: PreApprovalPlanRequest; requestOptions?: Options; } diff --git a/src/clients/preApprovalPlan/get/index.ts b/src/clients/preApprovalPlan/get/index.ts index c972a862..c0e23aa0 100644 --- a/src/clients/preApprovalPlan/get/index.ts +++ b/src/clients/preApprovalPlan/get/index.ts @@ -1,9 +1,9 @@ import { RestClient } from '@utils/restClient'; -import type { PreApprovalPlansGetClient } from './types'; +import type { PreApprovalPlanGetClient } from './types'; import type { PreApprovalPlanResponse } from '@src/clients/preApprovalPlan/commonTypes'; -export default function get({ id, config }: PreApprovalPlansGetClient): Promise { +export default function get({ id, config }: PreApprovalPlanGetClient): Promise { return RestClient.fetch( `/preapproval_plan/${id}`, { diff --git a/src/clients/preApprovalPlan/get/types.ts b/src/clients/preApprovalPlan/get/types.ts index 008c219e..f5694468 100644 --- a/src/clients/preApprovalPlan/get/types.ts +++ b/src/clients/preApprovalPlan/get/types.ts @@ -1,12 +1,12 @@ import type { MercadoPagoConfig } from '@src/mercadoPagoConfig'; import type { Options } from '@src/types'; -export declare type PreApprovalPlansGetClient = { +export declare type PreApprovalPlanGetClient = { id: string; config: MercadoPagoConfig }; -export declare type PreApprovalPlansGetData = { +export declare type PreApprovalPlanGetData = { preApprovalPlanId: string; requestOptions?: Options; }; diff --git a/src/clients/preApprovalPlan/index.ts b/src/clients/preApprovalPlan/index.ts index 626ab7d1..03142c04 100644 --- a/src/clients/preApprovalPlan/index.ts +++ b/src/clients/preApprovalPlan/index.ts @@ -4,11 +4,11 @@ import update from './update'; import search from './search'; import type { MercadoPagoConfig } from '../../mercadoPagoConfig'; -import type { PreApprovalPlansGetData } from './get/types'; +import type { PreApprovalPlanGetData } from './get/types'; import type { UpdatePreApprovalPlanUpdateData } from './update/types'; -import type { PreApprovalPlanSearchResponse, PreApprovalPlansSearchData } from './search/types'; +import type { PreApprovalPlanSearchResponse, PreApprovalPlanSearchData } from './search/types'; import type { PreApprovalPlanResponse } from './commonTypes'; -import type { PreApprovalPlansCreateData } from './create/types'; +import type { PreApprovalPlanCreateData } from './create/types'; /** * Mercado Pago PreApprovalPlan. @@ -27,7 +27,7 @@ export class PreApprovalPlan { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/preapprovalplan/create.ts Usage Example }. */ - create({ body, requestOptions }: PreApprovalPlansCreateData): Promise { + create({ body, requestOptions }: PreApprovalPlanCreateData): Promise { this.config.options = { ...this.config.options, ...requestOptions }; return create({ body, config: this.config }); } @@ -37,7 +37,7 @@ export class PreApprovalPlan { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/preapprovalplan/get.ts Usage Example }. */ - get({ preApprovalPlanId, requestOptions }: PreApprovalPlansGetData): Promise { + get({ preApprovalPlanId, requestOptions }: PreApprovalPlanGetData): Promise { this.config.options = { ...this.config.options, ...requestOptions }; return get({ id: preApprovalPlanId, config: this.config }); } @@ -57,7 +57,7 @@ export class PreApprovalPlan { * * @see {@link https://github.com/mercadopago/sdk-nodejs/blob/master/src/examples/preapprovalplan/search.ts Usage Example }. */ - search(preApprovalPlanSearchData: PreApprovalPlansSearchData = {}): Promise { + search(preApprovalPlanSearchData: PreApprovalPlanSearchData = {}): Promise { const { options, requestOptions } = preApprovalPlanSearchData; this.config.options = { ...this.config.options, ...requestOptions }; return search({ options, config: this.config }); diff --git a/src/clients/preApprovalPlan/search/index.ts b/src/clients/preApprovalPlan/search/index.ts index 8027881d..870b33a9 100644 --- a/src/clients/preApprovalPlan/search/index.ts +++ b/src/clients/preApprovalPlan/search/index.ts @@ -1,8 +1,8 @@ import { RestClient } from '@utils/restClient'; -import type { PreApprovalPlansSearchClient, PreApprovalPlanSearchResponse } from './types'; +import type { PreApprovalPlanSearchClient, PreApprovalPlanSearchResponse } from './types'; -export default function search({ options, config }: PreApprovalPlansSearchClient): Promise { +export default function search({ options, config }: PreApprovalPlanSearchClient): Promise { return RestClient.fetch( '/preapproval_plan/search', { diff --git a/src/clients/preApprovalPlan/search/types.ts b/src/clients/preApprovalPlan/search/types.ts index f930bf21..9b702b48 100644 --- a/src/clients/preApprovalPlan/search/types.ts +++ b/src/clients/preApprovalPlan/search/types.ts @@ -3,7 +3,7 @@ import type { SearchOptions } from '@src/types'; import type { PreApprovalPlanResponse } from '../commonTypes'; import type { Options } from '@src/types'; -export declare type PreApprovalPlansSearchClient = { +export declare type PreApprovalPlanSearchClient = { options?: PreApprovalPlanSearchOptions, config: MercadoPagoConfig }; @@ -26,7 +26,7 @@ export declare type PreApprovalPlanSearchPaging = { offset: number; }; -export declare type PreApprovalPlansSearchData = { +export declare type PreApprovalPlanSearchData = { options?: PreApprovalPlanSearchOptions; requestOptions?: Options; } From 3ecba0e2ab827bbcca3c95090a0645c601f7ac4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Mon, 2 Oct 2023 19:16:07 -0300 Subject: [PATCH 5/5] downgrade version --- package.json | 2 +- src/utils/config/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a89eb2ac..614d97e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mercadopago", - "version": "2.0.1", + "version": "2.0.0", "description": "Mercadopago SDK for Node.js", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/utils/config/index.ts b/src/utils/config/index.ts index 0f673490..fe363552 100644 --- a/src/utils/config/index.ts +++ b/src/utils/config/index.ts @@ -5,7 +5,7 @@ export class AppConfig { static readonly BASE_URL = 'https://api.mercadopago.com'; static readonly PRODUCT_ID = 'bc32b6ntrpp001u8nhkg'; - static SDK_VERSION = '2.0.1'; + static SDK_VERSION = '2.0.0'; static readonly Headers = { AUTHORIZATION: 'Authorization',