From 49551c1f7f49321ffc6c5439a402cff30a18d451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Thu, 5 Oct 2023 08:39:09 -0300 Subject: [PATCH 1/8] added names export for mercadopago module --- CHANGELOG.MD | 25 ++++++++++++++++++++++++- PULL_REQUEST_TEMPLATE.md | 19 +++++++++++++------ README.md | 10 +++++----- package.json | 2 +- src/index.ts | 1 + src/utils/config/index.ts | 2 +- 6 files changed, 45 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 4fee1d91..b025d353 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,5 +1,28 @@ # Releases +## VERSION 2.0.1 +- Added named export to MercadoPago configuration module +- Modified integration example in readme +- Adjusted PR template + ## VERSION 2.0.0 -* Search Method implementation +Release SDK Node Mercado Pago V2 + +- TypeScript Support ⭐️ +- Type of all requests and all responses +- Maintained compatibility with Vanilla Javascript + +Tests +- More than 90% coverage of unit tests +- Documentation +- Implementation examples from ALL clients +- Technical Documentation +- Melhorias no Readme +- Contribution template + +Technical debits +- Code registration +- Removal of vulnerable libraries and without recent updates +- Registration with other Mercado Pago SDKs +- Individual Request configuration for client diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index f8cb6294..c1a897ac 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -6,6 +6,7 @@ ### ✅ Checklist: - [ ] I followed the instructions indicated in [Contribution Guidelines](CONTRIBUTING.md) +- [ ] I added the changes to CHANGELOG - [ ] Added the necessary tests for the code or functionality that I'm working on - [ ] I ran the tests and made sure they work - [ ] My branch coverage is at least 80% @@ -13,15 +14,21 @@ ## 🧰 How to reproduce -- Step by step of how to test, specially for bugs. -- Links of external docs. +- [ ] Not Apply.
+
+- [ ] Step by step of how to test, specially for bugs. +- [ ] Links of external docs. ## 📸 Screenshots -- Before and after, if it's a fix for a bug. +- [ ] Not Apply.
+
+- [ ] Before and after, if it's a fix for a bug. ## 📄 References -- Links do external documentation -- Diagrams -- Useful links \ No newline at end of file +- [ ] Not Apply.
+
+- [ ] Links do external documentation. +- [ ] Diagrams. +- [ ] Useful links. diff --git a/README.md b/README.md index bf3c28a1..15240c36 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ That's it! Mercado Pago SDK has been successfully installed. ```javascript // Step 1: Import the parts of the module you want to use -import MercadoPago, { Payment } from 'mercadopago'; +import { MercadoPagoConfig, Payment } from 'mercadopago'; // Step 2: Initialize the client object -const client = new MercadoPago({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } }); +const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } }); // Step 3: Initialize the API object const payment = new Payment(client); @@ -56,10 +56,10 @@ payment.create({ body }).then(console.log).catch(console.log); ### Step 1: Import the parts of the module you want to use -Import `MercadoPago` and API objects from the MercadoPago module. +Import `MercadoPagoConfig` and API objects from the MercadoPago module. ``` javascript -import MercadoPago, { Payment } from 'mercadopago'; +import { MercadoPagoConfig, Payment } from 'mercadopago'; ``` ### Step 2: Initialize the client object @@ -73,7 +73,7 @@ Initialize the client object, passing the following: For example: ``` javascript -const client = new MercadoPago({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } }); +const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } }); ``` ### Step 3: Initialize the API object 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/index.ts b/src/index.ts index ff67fafb..394199c0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ import { MercadoPagoConfig } from './mercadoPagoConfig'; export default MercadoPagoConfig; +export { MercadoPagoConfig }; export { CardToken } from './clients/cardToken'; export { CustomerCard } from './clients/customerCard'; 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 a726a8d453e543a7635f7c063237604aac1750b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Thu, 5 Oct 2023 09:10:33 -0300 Subject: [PATCH 2/8] fix template PR --- PULL_REQUEST_TEMPLATE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index c1a897ac..e8db6b6c 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -16,7 +16,7 @@ - [ ] Not Apply.

-- [ ] Step by step of how to test, specially for bugs. +- [ ] Step by step of how to test, specially for bugs.
- [ ] Links of external docs. ## 📸 Screenshots @@ -29,6 +29,6 @@ - [ ] Not Apply.

-- [ ] Links do external documentation. -- [ ] Diagrams. +- [ ] Links do external documentation.
+- [ ] Diagrams.
- [ ] Useful links. From 95cebfe8ba50385e45e36c26d1f32488f91b766a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Thu, 5 Oct 2023 09:11:58 -0300 Subject: [PATCH 3/8] fix template PR --- PULL_REQUEST_TEMPLATE.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index e8db6b6c..a81176cf 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -14,21 +14,18 @@ ## 🧰 How to reproduce -- [ ] Not Apply.
-
-- [ ] Step by step of how to test, specially for bugs.
+- [ ] Not Apply. +- [ ] Step by step of how to test, specially for bugs. - [ ] Links of external docs. ## 📸 Screenshots -- [ ] Not Apply.
-
+- [ ] Not Apply. - [ ] Before and after, if it's a fix for a bug. ## 📄 References -- [ ] Not Apply.
-
-- [ ] Links do external documentation.
-- [ ] Diagrams.
+- [ ] Not Apply. +- [ ] Links do external documentation. +- [ ] Diagrams. - [ ] Useful links. From 54d55405afd93b743d1b396ad3c830a85e6e7ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Thu, 5 Oct 2023 09:19:22 -0300 Subject: [PATCH 4/8] rename MercadoPagoConfig to MercadoPago --- README.md | 10 +++++----- src/index.ts | 6 +++--- src/mercadoPagoConfig.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 15240c36..2ffae8a4 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ That's it! Mercado Pago SDK has been successfully installed. ```javascript // Step 1: Import the parts of the module you want to use -import { MercadoPagoConfig, Payment } from 'mercadopago'; +import { MercadoPago, Payment } from 'mercadopago'; // Step 2: Initialize the client object -const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } }); +const client = new MercadoPago({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } }); // Step 3: Initialize the API object const payment = new Payment(client); @@ -56,10 +56,10 @@ payment.create({ body }).then(console.log).catch(console.log); ### Step 1: Import the parts of the module you want to use -Import `MercadoPagoConfig` and API objects from the MercadoPago module. +Import `MercadoPago` and API objects from the MercadoPago module. ``` javascript -import { MercadoPagoConfig, Payment } from 'mercadopago'; +import { MercadoPago, Payment } from 'mercadopago'; ``` ### Step 2: Initialize the client object @@ -73,7 +73,7 @@ Initialize the client object, passing the following: For example: ``` javascript -const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } }); +const client = new MercadoPago({ accessToken: 'access_token', options: { timeout: 5000, idempotencyKey: 'abc' } }); ``` ### Step 3: Initialize the API object diff --git a/src/index.ts b/src/index.ts index 394199c0..464c4ea7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ -import { MercadoPagoConfig } from './mercadoPagoConfig'; -export default MercadoPagoConfig; -export { MercadoPagoConfig }; +import { MercadoPago } from './mercadoPagoConfig'; +export default MercadoPago; +export { MercadoPago }; export { CardToken } from './clients/cardToken'; export { CustomerCard } from './clients/customerCard'; diff --git a/src/mercadoPagoConfig.ts b/src/mercadoPagoConfig.ts index b0ffff6f..7e4521dc 100644 --- a/src/mercadoPagoConfig.ts +++ b/src/mercadoPagoConfig.ts @@ -5,7 +5,7 @@ import type { Config, Options } from './types'; * * @see {@link https://github.com/mercadopago/sdk-nodejs Documentation }. */ -export class MercadoPagoConfig { +export class MercadoPago { accessToken: string; options?: Options; From c4d02ffabefe1a9114e1a743cdc75b0eebf02187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Thu, 5 Oct 2023 09:21:26 -0300 Subject: [PATCH 5/8] rename MercadoPagoConfig to MercadoPago --- src/index.ts | 2 +- src/mercadoPagoConfig.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 464c4ea7..9e924065 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { MercadoPago } from './mercadoPagoConfig'; +import { MercadoPagoConfig as MercadoPago } from './mercadoPagoConfig'; export default MercadoPago; export { MercadoPago }; diff --git a/src/mercadoPagoConfig.ts b/src/mercadoPagoConfig.ts index 7e4521dc..b0ffff6f 100644 --- a/src/mercadoPagoConfig.ts +++ b/src/mercadoPagoConfig.ts @@ -5,7 +5,7 @@ import type { Config, Options } from './types'; * * @see {@link https://github.com/mercadopago/sdk-nodejs Documentation }. */ -export class MercadoPago { +export class MercadoPagoConfig { accessToken: string; options?: Options; From 842c75626e0a15dad4bdeab178ee45502ad57803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Thu, 5 Oct 2023 09:31:03 -0300 Subject: [PATCH 6/8] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ffae8a4..cdb4acda 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![SDK Node MErcado Pago](https://github.com/lucmkz/sdk-nodejs/assets/31546923/84211022-6fc5-4db1-8772-117eca84f2d9) +![SDK Node Mercado Pago](https://github.com/lucmkz/sdk-nodejs/assets/31546923/84211022-6fc5-4db1-8772-117eca84f2d9) # Mercado Pago SDK for NodeJS From 679d073ad8c9a4005d7bf8a83e30fa2f2304f3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Thu, 5 Oct 2023 10:14:04 -0300 Subject: [PATCH 7/8] git flow files refactor --- .github/worflows/ci.yml | 14 +++++++------- .github/worflows/publish.yml | 18 ++++-------------- CHANGELOG.MD | 1 + 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/.github/worflows/ci.yml b/.github/worflows/ci.yml index ee587484..b1dfc53b 100644 --- a/.github/worflows/ci.yml +++ b/.github/worflows/ci.yml @@ -1,19 +1,19 @@ -name: Node.js CI +name: CI on: push: - branches: [ "master", "master-v2" ] + branches: [ "master" ] pull_request: - branches: [ "*" ] + branches: [ "master" ] jobs: - build: - + test: + name: Test on Node v${{ matrix.node-version }} runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x, 14.x, 16.x, 18.x] + node-version: [12.x, 14.x, 16.x, 18.x, 19.x] steps: - uses: actions/checkout@v3 @@ -22,5 +22,5 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: npm ci + - run: npm ci --legacy-peer-deps - run: npm test diff --git a/.github/worflows/publish.yml b/.github/worflows/publish.yml index 14e43784..bd711ed7 100644 --- a/.github/worflows/publish.yml +++ b/.github/worflows/publish.yml @@ -1,22 +1,11 @@ -name: Node.js Publish Package +name: Publish to NPM on: release: types: [created] jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm ci - - run: npm test - - publish-npm: - needs: build + publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -24,7 +13,8 @@ jobs: with: node-version: 18 registry-url: https://registry.npmjs.org/ - - run: npm ci + - run: npm ci --legacy-peer-deps + - run: npm run build - run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/CHANGELOG.MD b/CHANGELOG.MD index b025d353..90d2a1c3 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -4,6 +4,7 @@ - Added named export to MercadoPago configuration module - Modified integration example in readme - Adjusted PR template +- Adjusted gitflow files ## VERSION 2.0.0 From 7e47788ccfb6430f3febeddd9e3f4ab0f564268a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CLucas?= Date: Thu, 5 Oct 2023 10:39:17 -0300 Subject: [PATCH 8/8] readme update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cdb4acda..3818072e 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ const body = { Use the API object's method to make the request. For example, to make a request to the `/v1/payments` endpoint using the `payment` object: -``` +```javascript payment.create({ body }).then(console.log).catch(console.log); ```