Skip to content

Commit

Permalink
Merge pull request #267 from mercadopago/hotfix/typo-issues
Browse files Browse the repository at this point in the history
typo issues
  • Loading branch information
lucmkz authored Oct 2, 2023
2 parents 257c60d + 3ecba0e commit cb7eb36
Show file tree
Hide file tree
Showing 42 changed files with 115 additions and 115 deletions.
8 changes: 4 additions & 4 deletions src/clients/identificationType/index.ts
Original file line number Diff line number Diff line change
@@ -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 }.
*/
Expand All @@ -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<IdentificationTypeResponse[]> {
const { requestOptions } = IdentificationTypesListOptions;
list(identificationTypeListOptions: IdentificationTypeListData = {} as IdentificationTypeListData): Promise<IdentificationTypeResponse[]> {
const { requestOptions } = identificationTypeListOptions;
this.config.options = { ...this.config.options, ...requestOptions };
return list({ config: this.config });
}
Expand Down
2 changes: 1 addition & 1 deletion src/clients/identificationType/list/types.ts
Original file line number Diff line number Diff line change
@@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions src/clients/invoice/commonTypes.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
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;
external_reference?: string;
id?: string;
last_modified?: string;
payer_id?: number;
payment?: InvoicesPayment;
payment?: InvoicePayment;
preapproval_id?: string;
reason?: string;
retry_attempt?: number,
status?: string;
summarized?: string;
transaction_amount?: number;
type?: string;
}
}
2 changes: 1 addition & 1 deletion src/clients/invoice/get/get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
8 changes: 4 additions & 4 deletions src/clients/invoice/get/index.ts
Original file line number Diff line number Diff line change
@@ -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<InvoicesResponse> {
return RestClient.fetch<InvoicesResponse>(
export default function get({ id, config }: InvoiceGetClient): Promise<InvoiceResponse> {
return RestClient.fetch<InvoiceResponse>(
`/authorized_payments/${id}`,
{
method: 'GET',
Expand Down
4 changes: 2 additions & 2 deletions src/clients/invoice/get/types.ts
Original file line number Diff line number Diff line change
@@ -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
};
Expand Down
10 changes: 5 additions & 5 deletions src/clients/invoice/index.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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<InvoicesResponse> {
get({ id, requestOptions }: InvoiceGetData): Promise<InvoiceResponse> {
this.config.options = { ...this.config.options, ...requestOptions };
return get({ id, config: this.config });
}
Expand All @@ -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<InvoicesSearchResponse> {
search(ivoicesSearchOptions: InvoiceSearchData = {}): Promise<InvoiceSearchResponse> {
const { options, requestOptions } = ivoicesSearchOptions;
this.config.options = { ...this.config.options, ...requestOptions };
return search({ options, config: this.config });
Expand Down
6 changes: 3 additions & 3 deletions src/clients/invoice/search/index.ts
Original file line number Diff line number Diff line change
@@ -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<InvoicesSearchResponse> {
return RestClient.fetch<InvoicesSearchResponse>(
export default function search({ options, config }: InvoiceSearchClient): Promise<InvoiceSearchResponse> {
return RestClient.fetch<InvoiceSearchResponse>(
'/authorized_payments/search',
{
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/clients/invoice/search/search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
16 changes: 8 additions & 8 deletions src/clients/invoice/search/types.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -22,7 +22,7 @@ export declare interface InvoicesSearchOptions extends SearchOptions {
limit?: number;
}

export declare type InvoicesSearchResponse = {
export declare type InvoiceSearchResponse = {
paging?: Paging;
results?: Array<InvoicesResponse>;
results?: Array<InvoiceResponse>;
}
6 changes: 3 additions & 3 deletions src/clients/payment/cancel/index.ts
Original file line number Diff line number Diff line change
@@ -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<PaymentsResponse> {
export default function cancel({ id, config }: PaymentCancelClient): Promise<PaymentResponse> {
const cancelBody = {
status: 'cancelled'
};
return RestClient.fetch<PaymentsResponse>(
return RestClient.fetch<PaymentResponse>(
`/v1/payments/${id}`,
{
method: 'PUT',
Expand Down
6 changes: 3 additions & 3 deletions src/clients/payment/capture/index.ts
Original file line number Diff line number Diff line change
@@ -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<PaymentsResponse> {
export default function capture({ id, transaction_amount, config }: PaymentCaptureClient): Promise<PaymentResponse> {
const captureBody = {
capture: true,
transaction_amount
};

return RestClient.fetch<PaymentsResponse>(
return RestClient.fetch<PaymentResponse>(
`/v1/payments/${id}`,
{
method: 'PUT',
Expand Down
6 changes: 3 additions & 3 deletions src/clients/payment/commonTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export declare type PayerAdditionalInfo = {
registration_date?: string;
};

export declare type ShipmentsPayments = {
export declare type ShipmentsPayment = {
receiver_address?: ShipmentsReceiverAddress;
};

Expand All @@ -82,7 +82,7 @@ export declare type AdditionalInfo = {
ip_address?: string;
items?: Array<Items>;
payer?: PayerAdditionalInfo;
shipments?: ShipmentsPayments;
shipments?: ShipmentsPayment;
};

export declare type TransactionDetails = {
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/clients/payment/create/index.ts
Original file line number Diff line number Diff line change
@@ -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<PaymentsResponse> {
return RestClient.fetch<PaymentsResponse>(
export default function create({ body, config }: PaymentCreateClient): Promise<PaymentResponse> {
return RestClient.fetch<PaymentResponse>(
'/v1/payments',
{
method: 'POST',
Expand Down
8 changes: 4 additions & 4 deletions src/clients/payment/create/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/clients/payment/get/index.ts
Original file line number Diff line number Diff line change
@@ -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<PaymentsResponse> {
return RestClient.fetch<PaymentsResponse>(
export default function get({ id, config }: PaymentGetClient): Promise<PaymentResponse> {
return RestClient.fetch<PaymentResponse>(
`/v1/payments/${id}`,
{
headers: {
Expand Down
14 changes: 7 additions & 7 deletions src/clients/payment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<PaymentsSearch> {
search(paymentSearchOptions: PaymentSearchData = {}): Promise<PaymentSearch> {
const { options, requestOptions } = paymentSearchOptions;
this.config.options = { ...this.config.options, ...requestOptions };
return search({ options, config: this.config });
Expand All @@ -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<PaymentsResponse> {
cancel({ id, requestOptions }: PaymentCancelData): Promise<PaymentResponse> {
this.config.options = { ...this.config.options, ...requestOptions };
return cancel({ id, config: this.config } );
}
Expand All @@ -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<PaymentsResponse> {
capture({ id, transaction_amount, requestOptions }: PaymentCaptureData): Promise<PaymentResponse> {
this.config.options = { ...this.config.options, ...requestOptions };
return capture({ id, transaction_amount, config: this.config });
}
Expand All @@ -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<PaymentsResponse> {
create({ body, requestOptions }: PaymentCreateData): Promise<PaymentResponse> {
this.config.options = { ...this.config.options, ...requestOptions };
return create({ body, config: this.config });
}
Expand All @@ -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<PaymentsResponse> {
get({ id, requestOptions }: PaymentGetData): Promise<PaymentResponse> {
this.config.options = { ...this.config.options, ...requestOptions };
return get({ id, config: this.config } );
}
Expand Down
6 changes: 3 additions & 3 deletions src/clients/payment/search/index.ts
Original file line number Diff line number Diff line change
@@ -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<PaymentsSearch> {
return RestClient.fetch<PaymentsSearch>(
export default function search({ options, config }: PaymentSearchClient): Promise<PaymentSearch> {
return RestClient.fetch<PaymentSearch>(
'/v1/payments/search',
{
headers: {
Expand Down
Loading

0 comments on commit cb7eb36

Please sign in to comment.