@cloudcommerce/app-pagarme-v5 2.8.8 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/pagarme-v5-events.js.map +1 -1
- package/package.json +13 -7
- package/.turbo/turbo-build.log +0 -5
- package/CHANGELOG.md +0 -1
- package/assets/onload-expression.js +0 -38
- package/assets/onload-expression.min.js +0 -1
- package/scripts/build.sh +0 -4
- package/scripts/tests.sh +0 -9
- package/src/index.ts +0 -1
- package/src/pagarme-v5-events.ts +0 -27
- package/src/pagarme-v5.ts +0 -12
- package/tests/1-list-payments.test.mjs +0 -37
- package/tests/2-create-transaction.test.mjs +0 -56
- package/tsconfig.json +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagarme-v5-events.js","sourceRoot":"","sources":["../src/pagarme-v5-events.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,EACL,uBAAuB,GAExB,MAAM,4CAA4C,CAAC;AACpD,OAAO,cAAc,MAAM,mCAAmC,CAAC;AAC/D,OAAO,sBAAsB,MAAM,kCAAkC,CAAC;AAEtE,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,YAAY,EAAE,uBAAuB,CACnC,WAAW,EACX,cAAiC,CAClC;IACD,QAAQ,EAAE,SAAS;SAChB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC;SAChD,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC5B,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"pagarme-v5-events.js","sourceRoot":"","sources":["../src/pagarme-v5-events.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,EACL,uBAAuB,GAExB,MAAM,4CAA4C,CAAC;AACpD,OAAO,cAAc,MAAM,mCAAmC,CAAC;AAC/D,OAAO,sBAAsB,MAAM,kCAAkC,CAAC;AAEtE,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,YAAY,EAAE,uBAAuB,CACnC,WAAW,EACX,cAAiC,CAClC;IACD,QAAQ,EAAE,SAAS;SAChB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC;SAChD,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC5B,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC1B,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,sBAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC;CACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-pagarme-v5",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.10.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app to integrate Pagar.me API v5 with recurring payments",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./lib/index.js",
|
|
9
9
|
"./events": "./lib/pagarme-v5-events.js"
|
|
10
10
|
},
|
|
11
|
+
"files": [
|
|
12
|
+
"/lib",
|
|
13
|
+
"/lib-mjs",
|
|
14
|
+
"/types",
|
|
15
|
+
"/*.{js,mjs,ts}"
|
|
16
|
+
],
|
|
11
17
|
"repository": {
|
|
12
18
|
"type": "git",
|
|
13
19
|
"url": "git+https://github.com/ecomplus/cloud-commerce.git",
|
|
@@ -21,15 +27,15 @@
|
|
|
21
27
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/apps/pagarme-v5#readme",
|
|
22
28
|
"dependencies": {
|
|
23
29
|
"@ecomplus/utils": "1.5.0-rc.6",
|
|
24
|
-
"axios": "^1.6.
|
|
30
|
+
"axios": "^1.6.8",
|
|
25
31
|
"firebase-admin": "^12.0.0",
|
|
26
|
-
"firebase-functions": "^4.8.
|
|
27
|
-
"@cloudcommerce/api": "2.
|
|
28
|
-
"@cloudcommerce/firebase": "2.
|
|
32
|
+
"firebase-functions": "^4.8.1",
|
|
33
|
+
"@cloudcommerce/api": "2.10.0",
|
|
34
|
+
"@cloudcommerce/firebase": "2.10.0"
|
|
29
35
|
},
|
|
30
36
|
"devDependencies": {
|
|
31
|
-
"@cloudcommerce/test-base": "2.
|
|
32
|
-
"@cloudcommerce/types": "2.
|
|
37
|
+
"@cloudcommerce/test-base": "2.10.0",
|
|
38
|
+
"@cloudcommerce/types": "2.10.0"
|
|
33
39
|
},
|
|
34
40
|
"scripts": {
|
|
35
41
|
"build": "bash scripts/build.sh",
|
package/.turbo/turbo-build.log
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Please refer to GitHub [repository releases](https://github.com/ecomplus/cloud-commerce/releases) or monorepo unified [CHANGELOG.md](https://github.com/ecomplus/cloud-commerce/blob/main/CHANGELOG.md).
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
(function pagarmeOnload() {
|
|
2
|
-
const apiKey = window._pagarmeKey;
|
|
3
|
-
window._pagarmeHash = function pagarmeHash(cardClient) {
|
|
4
|
-
return new Promise(async (resolve, reject) => {
|
|
5
|
-
const card = {
|
|
6
|
-
number: cardClient.number,
|
|
7
|
-
holder_name: cardClient.name,
|
|
8
|
-
exp_month: cardClient.month,
|
|
9
|
-
exp_year: cardClient.year,
|
|
10
|
-
cvv: cardClient.cvc,
|
|
11
|
-
};
|
|
12
|
-
const resp = await fetch(
|
|
13
|
-
`https://api.pagar.me/core/v5/tokens?appId=${apiKey}`,
|
|
14
|
-
{
|
|
15
|
-
headers: {
|
|
16
|
-
'Content-Type': 'application/json',
|
|
17
|
-
},
|
|
18
|
-
method: 'POST',
|
|
19
|
-
body: JSON.stringify({
|
|
20
|
-
type: 'card',
|
|
21
|
-
card,
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const data = await resp.json();
|
|
28
|
-
if (data.id) {
|
|
29
|
-
resolve(data.id);
|
|
30
|
-
}
|
|
31
|
-
throw new Error(`Error Token ${await resp.text()}`);
|
|
32
|
-
} catch (err) {
|
|
33
|
-
// console.error(err);
|
|
34
|
-
reject(err);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
}());
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(){const o=window._pagarmeKey;window._pagarmeHash=function(t){return new Promise(async(a,e)=>{var r={number:t.number,holder_name:t.name,exp_month:t.month,exp_year:t.year,cvv:t.cvc},r=await fetch("https://api.pagar.me/core/v5/tokens?appId="+o,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({type:"card",card:r})});try{var n=await r.json();throw n.id&&a(n.id),new Error("Error Token "+await r.text())}catch(a){e(a)}})}}();
|
package/scripts/build.sh
DELETED
package/scripts/tests.sh
DELETED
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './pagarme-v5';
|
package/src/pagarme-v5-events.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
|
|
3
|
-
import '@cloudcommerce/firebase/lib/init';
|
|
4
|
-
import * as functions from 'firebase-functions/v1';
|
|
5
|
-
import config from '@cloudcommerce/firebase/lib/config';
|
|
6
|
-
import {
|
|
7
|
-
createAppEventsFunction,
|
|
8
|
-
ApiEventHandler,
|
|
9
|
-
} from '@cloudcommerce/firebase/lib/helpers/pubsub';
|
|
10
|
-
import handleApiEvent from '../lib-mjs/events-to-pagarme5.mjs';
|
|
11
|
-
import handlePagarmeV5Webhook from '../lib-mjs/pagarme5-webhooks.mjs';
|
|
12
|
-
|
|
13
|
-
export const pagarmev5 = {
|
|
14
|
-
onStoreEvent: createAppEventsFunction(
|
|
15
|
-
'pagarMeV5',
|
|
16
|
-
handleApiEvent as ApiEventHandler,
|
|
17
|
-
),
|
|
18
|
-
webhooks: functions
|
|
19
|
-
.region(config.get().httpsFunctionOptions.region)
|
|
20
|
-
.https.onRequest((req, res) => {
|
|
21
|
-
if (req.method !== 'POST') {
|
|
22
|
-
res.sendStatus(405);
|
|
23
|
-
} else {
|
|
24
|
-
handlePagarmeV5Webhook(req, res);
|
|
25
|
-
}
|
|
26
|
-
}),
|
|
27
|
-
};
|
package/src/pagarme-v5.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import '@cloudcommerce/firebase/lib/init';
|
|
2
|
-
import type { AppModuleBody } from '@cloudcommerce/types';
|
|
3
|
-
import handleListPayments from '../lib-mjs/list-pagarme5-payments.mjs';
|
|
4
|
-
import handleCreateTransaction from '../lib-mjs/create-pagarme5-transaction.mjs';
|
|
5
|
-
|
|
6
|
-
export const listPayments = async (modBody: AppModuleBody) => {
|
|
7
|
-
return handleListPayments(modBody);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const createTransaction = async (modBody: AppModuleBody) => {
|
|
11
|
-
return handleCreateTransaction(modBody);
|
|
12
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import test, { before, describe } from 'node:test';
|
|
4
|
-
import {
|
|
5
|
-
modulesUrl,
|
|
6
|
-
bodyListPayments,
|
|
7
|
-
} from '@cloudcommerce/test-base';
|
|
8
|
-
|
|
9
|
-
describe('Test payment list of Pagar.me V5 App', async () => {
|
|
10
|
-
let req;
|
|
11
|
-
let data;
|
|
12
|
-
const appId = 112381;
|
|
13
|
-
|
|
14
|
-
before(async () => {
|
|
15
|
-
req = await fetch(`${modulesUrl}/list_payments?app_id=${appId}`, {
|
|
16
|
-
method: 'POST',
|
|
17
|
-
body: JSON.stringify(bodyListPayments),
|
|
18
|
-
headers: {
|
|
19
|
-
'Content-Type': 'application/json',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
data = (await req.json()).result;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('Check Status 200', async () => {
|
|
27
|
-
assert.strictEqual(req?.status, 200);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('Check validated is true', async () => {
|
|
31
|
-
assert.equal(data[0].validated, true);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('Have payment gateways', async () => {
|
|
35
|
-
assert.equal(data[0].response.payment_gateways.length > 0, true);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import test, { before, describe } from 'node:test';
|
|
4
|
-
import {
|
|
5
|
-
modulesUrl,
|
|
6
|
-
bodyCreateTransaction,
|
|
7
|
-
} from '@cloudcommerce/test-base';
|
|
8
|
-
|
|
9
|
-
describe('Test to create a transaction in the Pagar.me V5 with banking billet', async () => {
|
|
10
|
-
let req;
|
|
11
|
-
let data;
|
|
12
|
-
const appId = 112381;
|
|
13
|
-
before(async () => {
|
|
14
|
-
const paymentMethod = {
|
|
15
|
-
code: 'account_deposit',
|
|
16
|
-
name: 'Pix - Pagar.me',
|
|
17
|
-
};
|
|
18
|
-
const to = {
|
|
19
|
-
zip: '35701134',
|
|
20
|
-
province_code: 'MG',
|
|
21
|
-
name: 'Wisley Alves',
|
|
22
|
-
city: 'Sete Lagoas',
|
|
23
|
-
borough: 'Progresso',
|
|
24
|
-
street: 'Rua Santo André',
|
|
25
|
-
number: 81,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
Object.assign(bodyCreateTransaction, {
|
|
29
|
-
payment_method: paymentMethod,
|
|
30
|
-
to,
|
|
31
|
-
domain: 'www.lojatest.com.br',
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
req = await fetch(`${modulesUrl}/create_transaction?app_id=${appId}`, {
|
|
35
|
-
method: 'POST',
|
|
36
|
-
body: JSON.stringify(bodyCreateTransaction),
|
|
37
|
-
headers: {
|
|
38
|
-
'Content-Type': 'application/json',
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
data = (await req.json()).result;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('Check Status 200', async () => {
|
|
46
|
-
assert.strictEqual(req?.status, 200);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('Check validated is true', async () => {
|
|
50
|
-
assert.equal(data[0].validated, true);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test('Have transaction', async () => {
|
|
54
|
-
assert.notEqual(data[0].response.transaction, undefined);
|
|
55
|
-
});
|
|
56
|
-
});
|