@payloadcms/plugin-stripe 0.0.19 → 3.0.0-beta.23
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/README.md +3 -285
- package/dist/admin.d.ts +4 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +34 -0
- package/dist/admin.js.map +1 -0
- package/dist/fields/getFields.d.ts +12 -0
- package/dist/fields/getFields.d.ts.map +1 -0
- package/dist/fields/getFields.js +46 -0
- package/dist/fields/getFields.js.map +1 -0
- package/dist/hooks/createNewInStripe.d.ts +7 -2
- package/dist/hooks/createNewInStripe.d.ts.map +1 -0
- package/dist/hooks/createNewInStripe.js +70 -124
- package/dist/hooks/createNewInStripe.js.map +1 -1
- package/dist/hooks/deleteFromStripe.d.ts +7 -2
- package/dist/hooks/deleteFromStripe.d.ts.map +1 -0
- package/dist/hooks/deleteFromStripe.js +30 -87
- package/dist/hooks/deleteFromStripe.js.map +1 -1
- package/dist/hooks/syncExistingWithStripe.d.ts +7 -2
- package/dist/hooks/syncExistingWithStripe.d.ts.map +1 -0
- package/dist/hooks/syncExistingWithStripe.js +42 -94
- package/dist/hooks/syncExistingWithStripe.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -166
- package/dist/index.js.map +1 -1
- package/dist/routes/rest.d.ts +4 -6
- package/dist/routes/rest.d.ts.map +1 -0
- package/dist/routes/rest.js +33 -76
- package/dist/routes/rest.js.map +1 -1
- package/dist/routes/webhooks.d.ts +4 -6
- package/dist/routes/webhooks.d.ts.map +1 -0
- package/dist/routes/webhooks.js +49 -94
- package/dist/routes/webhooks.js.map +1 -1
- package/dist/types.d.ts +138 -11
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/dist/ui/LinkToDoc.d.ts +4 -7
- package/dist/ui/LinkToDoc.d.ts.map +1 -0
- package/dist/ui/LinkToDoc.js +29 -31
- package/dist/ui/LinkToDoc.js.map +1 -1
- package/dist/utilities/deepen.d.ts +1 -0
- package/dist/utilities/deepen.d.ts.map +1 -0
- package/dist/utilities/deepen.js +9 -16
- package/dist/utilities/deepen.js.map +1 -1
- package/dist/utilities/stripeProxy.d.ts +2 -1
- package/dist/utilities/stripeProxy.d.ts.map +1 -0
- package/dist/utilities/stripeProxy.js +37 -88
- package/dist/utilities/stripeProxy.js.map +1 -1
- package/dist/webhooks/handleCreatedOrUpdated.d.ts +3 -2
- package/dist/webhooks/handleCreatedOrUpdated.d.ts.map +1 -0
- package/dist/webhooks/handleCreatedOrUpdated.js +115 -196
- package/dist/webhooks/handleCreatedOrUpdated.js.map +1 -1
- package/dist/webhooks/handleDeleted.d.ts +2 -1
- package/dist/webhooks/handleDeleted.d.ts.map +1 -0
- package/dist/webhooks/handleDeleted.js +44 -102
- package/dist/webhooks/handleDeleted.js.map +1 -1
- package/dist/webhooks/index.d.ts +2 -1
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +46 -90
- package/dist/webhooks/index.js.map +1 -1
- package/package.json +50 -45
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/dist/extendWebpackConfig.d.ts +0 -3
- package/dist/extendWebpackConfig.js +0 -31
- package/dist/extendWebpackConfig.js.map +0 -1
- package/dist/mocks/serverModule.d.ts +0 -2
- package/dist/mocks/serverModule.js +0 -6
- package/dist/mocks/serverModule.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/createNewInStripe.ts"],"sourcesContent":["import type { CollectionBeforeValidateHook, CollectionConfig } from 'payload/types'\n\nimport { APIError } from 'payload/errors'\nimport Stripe from 'stripe'\n\nimport type { StripeConfig } from '../types.js'\n\nimport { deepen } from '../utilities/deepen.js'\n\nconst stripeSecretKey = process.env.STRIPE_SECRET_KEY\n// api version can only be the latest, stripe recommends ts ignoring it\nconst stripe = new Stripe(stripeSecretKey || '', { apiVersion: '2022-08-01' })\n\ntype HookArgsWithCustomCollection = Omit<\n Parameters<CollectionBeforeValidateHook>[0],\n 'collection'\n> & {\n collection: CollectionConfig\n}\n\nexport type CollectionBeforeValidateHookWithArgs = (\n args: HookArgsWithCustomCollection & {\n collection?: CollectionConfig\n stripeConfig?: StripeConfig\n },\n) => void\n\nexport const createNewInStripe: CollectionBeforeValidateHookWithArgs = async (args) => {\n const { collection, data, operation, req, stripeConfig } = args\n\n const { logs, sync } = stripeConfig || {}\n\n const payload = req?.payload\n\n const dataRef = data || {}\n\n if (process.env.NODE_ENV === 'test') {\n dataRef.stripeID = 'test'\n return dataRef\n }\n\n if (payload) {\n if (data?.skipSync) {\n if (logs) payload.logger.info(`Bypassing collection-level hooks.`)\n } else {\n // initialize as 'false' so that all Payload admin events sync to Stripe\n // then conditionally set to 'true' to for events that originate from webhooks\n // this will prevent webhook events from triggering an unnecessary sync / infinite loop\n dataRef.skipSync = false\n\n const { slug: collectionSlug } = collection || {}\n const syncConfig = sync?.find((conf) => conf.collection === collectionSlug)\n\n if (syncConfig) {\n // combine all fields of this object and match their respective values within the document\n let syncedFields = syncConfig.fields.reduce(\n (acc, field) => {\n const { fieldPath, stripeProperty } = field\n\n acc[stripeProperty] = dataRef[fieldPath]\n return acc\n },\n {} as Record<string, any>,\n )\n\n syncedFields = deepen(syncedFields)\n\n if (operation === 'update') {\n if (logs)\n payload.logger.info(\n `A '${collectionSlug}' document has changed in Payload with ID: '${data?.id}', syncing with Stripe...`,\n )\n\n // NOTE: the Stripe document will be created in the \"afterChange\" hook, so create a new stripe document here if no stripeID exists\n if (!dataRef.stripeID) {\n try {\n // NOTE: Typed as \"any\" because the \"create\" method is not standard across all Stripe resources\n const stripeResource = await stripe?.[syncConfig.stripeResourceType]?.create(\n // @ts-expect-error\n syncedFields,\n )\n\n if (logs)\n payload.logger.info(\n `✅ Successfully created new '${syncConfig.stripeResourceType}' resource in Stripe with ID: '${stripeResource.id}'.`,\n )\n\n dataRef.stripeID = stripeResource.id\n\n // NOTE: this is to prevent sync in the \"afterChange\" hook\n dataRef.skipSync = true\n } catch (error: unknown) {\n const msg = error instanceof Error ? error.message : error\n if (logs) payload.logger.error(`- Error creating Stripe document: ${msg}`)\n }\n }\n }\n\n if (operation === 'create') {\n if (logs)\n payload.logger.info(\n `A new '${collectionSlug}' document was created in Payload with ID: '${data?.id}', syncing with Stripe...`,\n )\n\n try {\n if (logs)\n payload.logger.info(\n `- Creating new '${syncConfig.stripeResourceType}' resource in Stripe...`,\n )\n\n // NOTE: Typed as \"any\" because the \"create\" method is not standard across all Stripe resources\n const stripeResource = await stripe?.[syncConfig.stripeResourceType]?.create(\n // @ts-expect-error\n syncedFields,\n )\n\n if (logs)\n payload.logger.info(\n `✅ Successfully created new '${syncConfig.stripeResourceType}' resource in Stripe with ID: '${stripeResource.id}'.`,\n )\n\n dataRef.stripeID = stripeResource.id\n\n // IMPORTANT: this is to prevent sync in the \"afterChange\" hook\n dataRef.skipSync = true\n } catch (error: unknown) {\n const msg = error instanceof Error ? error.message : error\n throw new APIError(\n `Failed to create new '${syncConfig.stripeResourceType}' resource in Stripe: ${msg}`,\n )\n }\n }\n }\n }\n }\n\n return dataRef\n}\n"],"names":["APIError","Stripe","deepen","stripeSecretKey","process","env","STRIPE_SECRET_KEY","stripe","apiVersion","createNewInStripe","args","collection","data","operation","req","stripeConfig","logs","sync","payload","dataRef","NODE_ENV","stripeID","skipSync","logger","info","slug","collectionSlug","syncConfig","find","conf","syncedFields","fields","reduce","acc","field","fieldPath","stripeProperty","id","stripeResource","stripeResourceType","create","error","msg","Error","message"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,QAAQ,QAAQ,iBAAgB;AACzC,OAAOC,YAAY,SAAQ;AAI3B,SAASC,MAAM,QAAQ,yBAAwB;AAE/C,MAAMC,kBAAkBC,QAAQC,GAAG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AAgB;wBACvB,MAAMC,MAAMD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAGH;wBACrD,MAAM,IAAIzC,SACR,CAAC,sBAAsB,EAAE2B,WAAWY,kBAAkB,CAAC,sBAAsB,EAAEG,IAAI,CAAC;oBAExF;gBACF;YACF;QACF;IACF;IAEA,OAAOvB;AACT,EAAC"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { CollectionAfterDeleteHook, CollectionConfig } from 'payload/types';
|
|
2
|
-
import type { StripeConfig } from '../types';
|
|
3
|
-
|
|
2
|
+
import type { StripeConfig } from '../types.js';
|
|
3
|
+
type HookArgsWithCustomCollection = Omit<Parameters<CollectionAfterDeleteHook>[0], 'collection'> & {
|
|
4
|
+
collection: CollectionConfig;
|
|
5
|
+
};
|
|
6
|
+
export type CollectionAfterDeleteHookWithArgs = (args: HookArgsWithCustomCollection & {
|
|
4
7
|
collection?: CollectionConfig;
|
|
5
8
|
stripeConfig?: StripeConfig;
|
|
6
9
|
}) => void;
|
|
7
10
|
export declare const deleteFromStripe: CollectionAfterDeleteHookWithArgs;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=deleteFromStripe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteFromStripe.d.ts","sourceRoot":"","sources":["../../src/hooks/deleteFromStripe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAKhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM/C,KAAK,4BAA4B,GAAG,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,GAAG;IACjG,UAAU,EAAE,gBAAgB,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG,CAC9C,IAAI,EAAE,4BAA4B,GAAG;IACnC,UAAU,CAAC,EAAE,gBAAgB,CAAA;IAC7B,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,KACE,IAAI,CAAA;AAET,eAAO,MAAM,gBAAgB,EAAE,iCAwC9B,CAAA"}
|
|
@@ -1,91 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
1
|
+
import { APIError } from 'payload/errors';
|
|
2
|
+
import Stripe from 'stripe';
|
|
3
|
+
const stripeSecretKey = process.env.STRIPE_SECRET_KEY;
|
|
4
|
+
// api version can only be the latest, stripe recommends ts ignoring it
|
|
5
|
+
const stripe = new Stripe(stripeSecretKey || '', {
|
|
6
|
+
apiVersion: '2022-08-01'
|
|
7
|
+
});
|
|
8
|
+
export const deleteFromStripe = async (args)=>{
|
|
9
|
+
const { collection, doc, req, stripeConfig } = args;
|
|
10
|
+
const { logs, sync } = stripeConfig || {};
|
|
11
|
+
const { payload } = req;
|
|
12
|
+
const { slug: collectionSlug } = collection || {};
|
|
13
|
+
if (logs) payload.logger.info(`Document with ID: '${doc?.id}' in collection: '${collectionSlug}' has been deleted, deleting from Stripe...`);
|
|
14
|
+
if (process.env.NODE_ENV !== 'test') {
|
|
15
|
+
if (logs) payload.logger.info(`- Deleting Stripe document with ID: '${doc.stripeID}'...`);
|
|
16
|
+
const syncConfig = sync?.find((conf)=>conf.collection === collectionSlug);
|
|
17
|
+
if (syncConfig) {
|
|
18
|
+
try {
|
|
19
|
+
const found = await stripe?.[syncConfig.stripeResourceType]?.retrieve(doc.stripeID);
|
|
20
|
+
if (found) {
|
|
21
|
+
await stripe?.[syncConfig.stripeResourceType]?.del(doc.stripeID);
|
|
22
|
+
if (logs) payload.logger.info(`✅ Successfully deleted Stripe document with ID: '${doc.stripeID}'.`);
|
|
23
|
+
} else {
|
|
24
|
+
if (logs) payload.logger.info(`- Stripe document with ID: '${doc.stripeID}' not found, skipping...`);
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
const msg = error instanceof Error ? error.message : error;
|
|
28
|
+
throw new APIError(`Failed to delete Stripe document with ID: '${doc.stripeID}': ${msg}`);
|
|
32
29
|
}
|
|
33
|
-
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
30
|
+
}
|
|
36
31
|
}
|
|
37
32
|
};
|
|
38
|
-
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.deleteFromStripe = void 0;
|
|
43
|
-
var errors_1 = require("payload/errors");
|
|
44
|
-
var stripe_1 = __importDefault(require("stripe"));
|
|
45
|
-
var stripeSecretKey = process.env.STRIPE_SECRET_KEY;
|
|
46
|
-
var stripe = new stripe_1.default(stripeSecretKey || '', { apiVersion: '2022-08-01' });
|
|
47
|
-
var deleteFromStripe = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
-
var req, doc, stripeConfig, collection, _a, logs, sync, payload, collectionSlug, syncConfig, found, error_1, msg;
|
|
49
|
-
var _b, _c;
|
|
50
|
-
return __generator(this, function (_d) {
|
|
51
|
-
switch (_d.label) {
|
|
52
|
-
case 0:
|
|
53
|
-
req = args.req, doc = args.doc, stripeConfig = args.stripeConfig, collection = args.collection;
|
|
54
|
-
_a = stripeConfig || {}, logs = _a.logs, sync = _a.sync;
|
|
55
|
-
payload = req.payload;
|
|
56
|
-
collectionSlug = (collection || {}).slug;
|
|
57
|
-
if (logs)
|
|
58
|
-
payload.logger.info("Document with ID: '".concat(doc === null || doc === void 0 ? void 0 : doc.id, "' in collection: '").concat(collectionSlug, "' has been deleted, deleting from Stripe..."));
|
|
59
|
-
if (!(process.env.NODE_ENV !== 'test')) return [3 /*break*/, 7];
|
|
60
|
-
if (logs)
|
|
61
|
-
payload.logger.info("- Deleting Stripe document with ID: '".concat(doc.stripeID, "'..."));
|
|
62
|
-
syncConfig = sync === null || sync === void 0 ? void 0 : sync.find(function (conf) { return conf.collection === collectionSlug; });
|
|
63
|
-
if (!syncConfig) return [3 /*break*/, 7];
|
|
64
|
-
_d.label = 1;
|
|
65
|
-
case 1:
|
|
66
|
-
_d.trys.push([1, 6, , 7]);
|
|
67
|
-
return [4 /*yield*/, ((_b = stripe === null || stripe === void 0 ? void 0 : stripe[syncConfig.stripeResourceType]) === null || _b === void 0 ? void 0 : _b.retrieve(doc.stripeID))];
|
|
68
|
-
case 2:
|
|
69
|
-
found = _d.sent();
|
|
70
|
-
if (!found) return [3 /*break*/, 4];
|
|
71
|
-
return [4 /*yield*/, ((_c = stripe === null || stripe === void 0 ? void 0 : stripe[syncConfig.stripeResourceType]) === null || _c === void 0 ? void 0 : _c.del(doc.stripeID))];
|
|
72
|
-
case 3:
|
|
73
|
-
_d.sent();
|
|
74
|
-
if (logs)
|
|
75
|
-
payload.logger.info("\u2705 Successfully deleted Stripe document with ID: '".concat(doc.stripeID, "'."));
|
|
76
|
-
return [3 /*break*/, 5];
|
|
77
|
-
case 4:
|
|
78
|
-
if (logs)
|
|
79
|
-
payload.logger.info("- Stripe document with ID: '".concat(doc.stripeID, "' not found, skipping..."));
|
|
80
|
-
_d.label = 5;
|
|
81
|
-
case 5: return [3 /*break*/, 7];
|
|
82
|
-
case 6:
|
|
83
|
-
error_1 = _d.sent();
|
|
84
|
-
msg = error_1 instanceof Error ? error_1.message : error_1;
|
|
85
|
-
throw new errors_1.APIError("Failed to delete Stripe document with ID: '".concat(doc.stripeID, "': ").concat(msg));
|
|
86
|
-
case 7: return [2 /*return*/];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}); };
|
|
90
|
-
exports.deleteFromStripe = deleteFromStripe;
|
|
33
|
+
|
|
91
34
|
//# sourceMappingURL=deleteFromStripe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/deleteFromStripe.ts"],"sourcesContent":["import type { CollectionAfterDeleteHook, CollectionConfig } from 'payload/types'\n\nimport { APIError } from 'payload/errors'\nimport Stripe from 'stripe'\n\nimport type { StripeConfig } from '../types.js'\n\nconst stripeSecretKey = process.env.STRIPE_SECRET_KEY\n// api version can only be the latest, stripe recommends ts ignoring it\nconst stripe = new Stripe(stripeSecretKey || '', { apiVersion: '2022-08-01' })\n\ntype HookArgsWithCustomCollection = Omit<Parameters<CollectionAfterDeleteHook>[0], 'collection'> & {\n collection: CollectionConfig\n}\n\nexport type CollectionAfterDeleteHookWithArgs = (\n args: HookArgsWithCustomCollection & {\n collection?: CollectionConfig\n stripeConfig?: StripeConfig\n },\n) => void\n\nexport const deleteFromStripe: CollectionAfterDeleteHookWithArgs = async (args) => {\n const { collection, doc, req, stripeConfig } = args\n\n const { logs, sync } = stripeConfig || {}\n\n const { payload } = req\n const { slug: collectionSlug } = collection || {}\n\n if (logs)\n payload.logger.info(\n `Document with ID: '${doc?.id}' in collection: '${collectionSlug}' has been deleted, deleting from Stripe...`,\n )\n\n if (process.env.NODE_ENV !== 'test') {\n if (logs) payload.logger.info(`- Deleting Stripe document with ID: '${doc.stripeID}'...`)\n\n const syncConfig = sync?.find((conf) => conf.collection === collectionSlug)\n\n if (syncConfig) {\n try {\n const found = await stripe?.[syncConfig.stripeResourceType]?.retrieve(doc.stripeID)\n\n if (found) {\n await stripe?.[syncConfig.stripeResourceType]?.del(doc.stripeID)\n if (logs)\n payload.logger.info(\n `✅ Successfully deleted Stripe document with ID: '${doc.stripeID}'.`,\n )\n } else {\n if (logs)\n payload.logger.info(\n `- Stripe document with ID: '${doc.stripeID}' not found, skipping...`,\n )\n }\n } catch (error: unknown) {\n const msg = error instanceof Error ? error.message : error\n throw new APIError(`Failed to delete Stripe document with ID: '${doc.stripeID}': ${msg}`)\n }\n }\n }\n}\n"],"names":["APIError","Stripe","stripeSecretKey","process","env","STRIPE_SECRET_KEY","stripe","apiVersion","deleteFromStripe","args","collection","doc","req","stripeConfig","logs","sync","payload","slug","collectionSlug","logger","info","id","NODE_ENV","stripeID","syncConfig","find","conf","found","stripeResourceType","retrieve","del","error","msg","Error","message"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,QAAQ,QAAQ,iBAAgB;AACzC,OAAOC,YAAY,SAAQ;AAI3B,MAAMC,kBAAkBC,QAAQC,GAAG,CAACC,iBAAiB;AACrD,uEAAuE;AACvE,MAAMC,SAAS,IAAIL,OAAOC,mBAAmB,IAAI;IAAEK,YAAY;AAAa;AAa5E,OAAO,MAAMC,mBAAsD,OAAOC;IACxE,MAAM,EAAEC,UAAU,EAAEC,GAAG,EAAEC,GAAG,EAAEC,YAAY,EAAE,GAAGJ;IAE/C,MAAM,EAAEK,IAAI,EAAEC,IAAI,EAAE,GAAGF,gBAAgB,CAAC;IAExC,MAAM,EAAEG,OAAO,EAAE,GAAGJ;IACpB,MAAM,EAAEK,MAAMC,cAAc,EAAE,GAAGR,cAAc,CAAC;IAEhD,IAAII,MACFE,QAAQG,MAAM,CAACC,IAAI,CACjB,CAAC,mBAAmB,EAAET,KAAKU,GAAG,kBAAkB,EAAEH,eAAe,2CAA2C,CAAC;IAGjH,IAAIf,QAAQC,GAAG,CAACkB,QAAQ,KAAK,QAAQ;QACnC,IAAIR,MAAME,QAAQG,MAAM,CAACC,IAAI,CAAC,CAAC,qCAAqC,EAAET,IAAIY,QAAQ,CAAC,IAAI,CAAC;QAExF,MAAMC,aAAaT,MAAMU,KAAK,CAACC,OAASA,KAAKhB,UAAU,KAAKQ;QAE5D,IAAIM,YAAY;YACd,IAAI;gBACF,MAAMG,QAAQ,MAAMrB,QAAQ,CAACkB,WAAWI,kBAAkB,CAAC,EAAEC,SAASlB,IAAIY,QAAQ;gBAElF,IAAII,OAAO;oBACT,MAAMrB,QAAQ,CAACkB,WAAWI,kBAAkB,CAAC,EAAEE,IAAInB,IAAIY,QAAQ;oBAC/D,IAAIT,MACFE,QAAQG,MAAM,CAACC,IAAI,CACjB,CAAC,iDAAiD,EAAET,IAAIY,QAAQ,CAAC,EAAE,CAAC;gBAE1E,OAAO;oBACL,IAAIT,MACFE,QAAQG,MAAM,CAACC,IAAI,CACjB,CAAC,4BAA4B,EAAET,IAAIY,QAAQ,CAAC,wBAAwB,CAAC;gBAE3E;YACF,EAAE,OAAOQ,OAAgB;gBACvB,MAAMC,MAAMD,iBAAiBE,QAAQF,MAAMG,OAAO,GAAGH;gBACrD,MAAM,IAAI/B,SAAS,CAAC,2CAA2C,EAAEW,IAAIY,QAAQ,CAAC,GAAG,EAAES,IAAI,CAAC;YAC1F;QACF;IACF;AACF,EAAC"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { CollectionBeforeChangeHook, CollectionConfig } from 'payload/types';
|
|
2
|
-
import type { StripeConfig } from '../types';
|
|
3
|
-
|
|
2
|
+
import type { StripeConfig } from '../types.js';
|
|
3
|
+
type HookArgsWithCustomCollection = Omit<Parameters<CollectionBeforeChangeHook>[0], 'collection'> & {
|
|
4
|
+
collection: CollectionConfig;
|
|
5
|
+
};
|
|
6
|
+
export type CollectionBeforeChangeHookWithArgs = (args: HookArgsWithCustomCollection & {
|
|
4
7
|
collection?: CollectionConfig;
|
|
5
8
|
stripeConfig?: StripeConfig;
|
|
6
9
|
}) => void;
|
|
7
10
|
export declare const syncExistingWithStripe: CollectionBeforeChangeHookWithArgs;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=syncExistingWithStripe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syncExistingWithStripe.d.ts","sourceRoot":"","sources":["../../src/hooks/syncExistingWithStripe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAKjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAQ/C,KAAK,4BAA4B,GAAG,IAAI,CACtC,UAAU,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,EACzC,YAAY,CACb,GAAG;IACF,UAAU,EAAE,gBAAgB,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,kCAAkC,GAAG,CAC/C,IAAI,EAAE,4BAA4B,GAAG;IACnC,UAAU,CAAC,EAAE,gBAAgB,CAAA;IAC7B,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,KACE,IAAI,CAAA;AAET,eAAO,MAAM,sBAAsB,EAAE,kCA8DpC,CAAA"}
|
|
@@ -1,99 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.syncExistingWithStripe = void 0;
|
|
43
|
-
var errors_1 = require("payload/errors");
|
|
44
|
-
var stripe_1 = __importDefault(require("stripe"));
|
|
45
|
-
var deepen_1 = require("../utilities/deepen");
|
|
46
|
-
var stripeSecretKey = process.env.STRIPE_SECRET_KEY;
|
|
47
|
-
var stripe = new stripe_1.default(stripeSecretKey || '', { apiVersion: '2022-08-01' });
|
|
48
|
-
var syncExistingWithStripe = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
-
var req, operation, data, originalDoc, collection, stripeConfig, _a, logs, sync, payload, collectionSlug, syncConfig, syncedFields, stripeResource, error_1, msg;
|
|
50
|
-
var _b;
|
|
51
|
-
return __generator(this, function (_c) {
|
|
52
|
-
switch (_c.label) {
|
|
53
|
-
case 0:
|
|
54
|
-
req = args.req, operation = args.operation, data = args.data, originalDoc = args.originalDoc, collection = args.collection, stripeConfig = args.stripeConfig;
|
|
55
|
-
_a = stripeConfig || {}, logs = _a.logs, sync = _a.sync;
|
|
56
|
-
payload = req.payload;
|
|
57
|
-
collectionSlug = (collection || {}).slug;
|
|
58
|
-
if (!(process.env.NODE_ENV !== 'test' && !data.skipSync)) return [3 /*break*/, 5];
|
|
59
|
-
syncConfig = sync === null || sync === void 0 ? void 0 : sync.find(function (conf) { return conf.collection === collectionSlug; });
|
|
60
|
-
if (!syncConfig) return [3 /*break*/, 5];
|
|
61
|
-
if (!(operation === 'update')) return [3 /*break*/, 5];
|
|
62
|
-
syncedFields = syncConfig.fields.reduce(function (acc, field) {
|
|
63
|
-
var fieldPath = field.fieldPath, stripeProperty = field.stripeProperty;
|
|
1
|
+
import { APIError } from 'payload/errors';
|
|
2
|
+
import Stripe from 'stripe';
|
|
3
|
+
import { deepen } from '../utilities/deepen.js';
|
|
4
|
+
const stripeSecretKey = process.env.STRIPE_SECRET_KEY;
|
|
5
|
+
// api version can only be the latest, stripe recommends ts ignoring it
|
|
6
|
+
const stripe = new Stripe(stripeSecretKey || '', {
|
|
7
|
+
apiVersion: '2022-08-01'
|
|
8
|
+
});
|
|
9
|
+
export const syncExistingWithStripe = async (args)=>{
|
|
10
|
+
const { collection, data, operation, originalDoc, req, stripeConfig } = args;
|
|
11
|
+
const { logs, sync } = stripeConfig || {};
|
|
12
|
+
const { payload } = req;
|
|
13
|
+
const { slug: collectionSlug } = collection || {};
|
|
14
|
+
if (process.env.NODE_ENV !== 'test' && !data.skipSync) {
|
|
15
|
+
const syncConfig = sync?.find((conf)=>conf.collection === collectionSlug);
|
|
16
|
+
if (syncConfig) {
|
|
17
|
+
if (operation === 'update') {
|
|
18
|
+
// combine all fields of this object and match their respective values within the document
|
|
19
|
+
let syncedFields = syncConfig.fields.reduce((acc, field)=>{
|
|
20
|
+
const { fieldPath, stripeProperty } = field;
|
|
64
21
|
acc[stripeProperty] = data[fieldPath];
|
|
65
22
|
return acc;
|
|
66
23
|
}, {});
|
|
67
|
-
syncedFields =
|
|
68
|
-
if (logs)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
payload.logger.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
stripeResource = _c.sent();
|
|
84
|
-
if (logs)
|
|
85
|
-
payload.logger.info("\u2705 Successfully synced Stripe resource with ID: '".concat(stripeResource.id, "'."));
|
|
86
|
-
return [3 /*break*/, 5];
|
|
87
|
-
case 4:
|
|
88
|
-
error_1 = _c.sent();
|
|
89
|
-
msg = error_1 instanceof Error ? error_1.message : error_1;
|
|
90
|
-
throw new errors_1.APIError("Failed to sync document with ID: '".concat(data.id, "' to Stripe: ").concat(msg));
|
|
91
|
-
case 5:
|
|
92
|
-
// Set back to 'false' so that all changes continue to sync to Stripe, see note in './createNewInStripe.ts'
|
|
93
|
-
data.skipSync = false;
|
|
94
|
-
return [2 /*return*/, data];
|
|
24
|
+
syncedFields = deepen(syncedFields);
|
|
25
|
+
if (logs) payload.logger.info(`A '${collectionSlug}' document has changed in Payload with ID: '${originalDoc?._id}', syncing with Stripe...`);
|
|
26
|
+
if (!data.stripeID) {
|
|
27
|
+
// NOTE: the "beforeValidate" hook populates this
|
|
28
|
+
if (logs) payload.logger.error(`- There is no Stripe ID for this document, skipping.`);
|
|
29
|
+
} else {
|
|
30
|
+
if (logs) payload.logger.info(`- Syncing to Stripe resource with ID: '${data.stripeID}'...`);
|
|
31
|
+
try {
|
|
32
|
+
const stripeResource = await stripe?.[syncConfig?.stripeResourceType]?.update(data.stripeID, syncedFields);
|
|
33
|
+
if (logs) payload.logger.info(`✅ Successfully synced Stripe resource with ID: '${stripeResource.id}'.`);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
const msg = error instanceof Error ? error.message : error;
|
|
36
|
+
throw new APIError(`Failed to sync document with ID: '${data.id}' to Stripe: ${msg}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
95
40
|
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
41
|
+
}
|
|
42
|
+
// Set back to 'false' so that all changes continue to sync to Stripe, see note in './createNewInStripe.ts'
|
|
43
|
+
data.skipSync = false;
|
|
44
|
+
return data;
|
|
45
|
+
};
|
|
46
|
+
|
|
99
47
|
//# sourceMappingURL=syncExistingWithStripe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/syncExistingWithStripe.ts"],"sourcesContent":["import type { CollectionBeforeChangeHook, CollectionConfig } from 'payload/types'\n\nimport { APIError } from 'payload/errors'\nimport Stripe from 'stripe'\n\nimport type { StripeConfig } from '../types.js'\n\nimport { deepen } from '../utilities/deepen.js'\n\nconst stripeSecretKey = process.env.STRIPE_SECRET_KEY\n// api version can only be the latest, stripe recommends ts ignoring it\nconst stripe = new Stripe(stripeSecretKey || '', { apiVersion: '2022-08-01' })\n\ntype HookArgsWithCustomCollection = Omit<\n Parameters<CollectionBeforeChangeHook>[0],\n 'collection'\n> & {\n collection: CollectionConfig\n}\n\nexport type CollectionBeforeChangeHookWithArgs = (\n args: HookArgsWithCustomCollection & {\n collection?: CollectionConfig\n stripeConfig?: StripeConfig\n },\n) => void\n\nexport const syncExistingWithStripe: CollectionBeforeChangeHookWithArgs = async (args) => {\n const { collection, data, operation, originalDoc, req, stripeConfig } = args\n\n const { logs, sync } = stripeConfig || {}\n\n const { payload } = req\n\n const { slug: collectionSlug } = collection || {}\n\n if (process.env.NODE_ENV !== 'test' && !data.skipSync) {\n const syncConfig = sync?.find((conf) => conf.collection === collectionSlug)\n\n if (syncConfig) {\n if (operation === 'update') {\n // combine all fields of this object and match their respective values within the document\n let syncedFields = syncConfig.fields.reduce(\n (acc, field) => {\n const { fieldPath, stripeProperty } = field\n\n acc[stripeProperty] = data[fieldPath]\n return acc\n },\n {} as Record<string, any>,\n )\n\n syncedFields = deepen(syncedFields)\n\n if (logs)\n payload.logger.info(\n `A '${collectionSlug}' document has changed in Payload with ID: '${originalDoc?._id}', syncing with Stripe...`,\n )\n\n if (!data.stripeID) {\n // NOTE: the \"beforeValidate\" hook populates this\n if (logs) payload.logger.error(`- There is no Stripe ID for this document, skipping.`)\n } else {\n if (logs)\n payload.logger.info(`- Syncing to Stripe resource with ID: '${data.stripeID}'...`)\n\n try {\n const stripeResource = await stripe?.[syncConfig?.stripeResourceType]?.update(\n data.stripeID,\n syncedFields,\n )\n\n if (logs)\n payload.logger.info(\n `✅ Successfully synced Stripe resource with ID: '${stripeResource.id}'.`,\n )\n } catch (error: unknown) {\n const msg = error instanceof Error ? error.message : error\n throw new APIError(`Failed to sync document with ID: '${data.id}' to Stripe: ${msg}`)\n }\n }\n }\n }\n }\n\n // Set back to 'false' so that all changes continue to sync to Stripe, see note in './createNewInStripe.ts'\n data.skipSync = false\n\n return data\n}\n"],"names":["APIError","Stripe","deepen","stripeSecretKey","process","env","STRIPE_SECRET_KEY","stripe","apiVersion","syncExistingWithStripe","args","collection","data","operation","originalDoc","req","stripeConfig","logs","sync","payload","slug","collectionSlug","NODE_ENV","skipSync","syncConfig","find","conf","syncedFields","fields","reduce","acc","field","fieldPath","stripeProperty","logger","info","_id","stripeID","error","stripeResource","stripeResourceType","update","id","msg","Error","message"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,QAAQ,QAAQ,iBAAgB;AACzC,OAAOC,YAAY,SAAQ;AAI3B,SAASC,MAAM,QAAQ,yBAAwB;AAE/C,MAAMC,kBAAkBC,QAAQC,GAAG,CAACC,iBAAiB;AACrD,uEAAuE;AACvE,MAAMC,SAAS,IAAIN,OAAOE,mBAAmB,IAAI;IAAEK,YAAY;AAAa;AAgB5E,OAAO,MAAMC,yBAA6D,OAAOC;IAC/E,MAAM,EAAEC,UAAU,EAAEC,IAAI,EAAEC,SAAS,EAAEC,WAAW,EAAEC,GAAG,EAAEC,YAAY,EAAE,GAAGN;IAExE,M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,MAAML,iBAAiBM,QAAQN,MAAMO,OAAO,GAAGP;wBACrD,MAAM,IAAItC,SAAS,CAAC,kCAAkC,EAAEY,KAAK8B,EAAE,CAAC,aAAa,EAAEC,IAAI,CAAC;oBACtF;gBACF;YACF;QACF;IACF;IAEA,2GAA2G;IAC3G/B,KAAKW,QAAQ,GAAG;IAEhB,OAAOX;AACT,EAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Config } from 'payload/config';
|
|
2
|
-
import type { StripeConfig } from './types';
|
|
3
|
-
|
|
4
|
-
export
|
|
2
|
+
import type { StripeConfig } from './types.js';
|
|
3
|
+
export { LinkToDoc } from './ui/LinkToDoc.js';
|
|
4
|
+
export { stripeProxy } from './utilities/stripeProxy.js';
|
|
5
|
+
export declare const stripePlugin: (incomingStripeConfig: StripeConfig) => (config: Config) => Config;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAY,MAAM,gBAAgB,CAAA;AAEtD,OAAO,KAAK,EAAyB,YAAY,EAAE,MAAM,YAAY,CAAA;AASrE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,eAAO,MAAM,YAAY,yBACA,YAAY,cAC1B,MAAM,KAAG,MAoGjB,CAAA"}
|