@antelopejs/mollie 0.0.0-stage → 0.0.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/LICENSE +190 -0
- package/README.md +123 -2
- package/dist/accounts.d.ts +17 -0
- package/dist/accounts.js +41 -0
- package/dist/accounts.js.map +1 -0
- package/dist/implementations/payment/checkout.d.ts +3 -0
- package/dist/implementations/payment/checkout.js +129 -0
- package/dist/implementations/payment/checkout.js.map +1 -0
- package/dist/implementations/payment/customers.d.ts +6 -0
- package/dist/implementations/payment/customers.js +79 -0
- package/dist/implementations/payment/customers.js.map +1 -0
- package/dist/implementations/payment/errors.d.ts +10 -0
- package/dist/implementations/payment/errors.js +71 -0
- package/dist/implementations/payment/errors.js.map +1 -0
- package/dist/implementations/payment/index.d.ts +5 -0
- package/dist/implementations/payment/index.js +27 -0
- package/dist/implementations/payment/index.js.map +1 -0
- package/dist/implementations/payment/instruments.d.ts +19 -0
- package/dist/implementations/payment/instruments.js +138 -0
- package/dist/implementations/payment/instruments.js.map +1 -0
- package/dist/implementations/payment/mapping.d.ts +10 -0
- package/dist/implementations/payment/mapping.js +202 -0
- package/dist/implementations/payment/mapping.js.map +1 -0
- package/dist/implementations/payment/payments.d.ts +12 -0
- package/dist/implementations/payment/payments.js +270 -0
- package/dist/implementations/payment/payments.js.map +1 -0
- package/dist/implementations/payment/refunds.d.ts +3 -0
- package/dist/implementations/payment/refunds.js +76 -0
- package/dist/implementations/payment/refunds.js.map +1 -0
- package/dist/implementations/payment/saved-method.d.ts +5 -0
- package/dist/implementations/payment/saved-method.js +83 -0
- package/dist/implementations/payment/saved-method.js.map +1 -0
- package/dist/implementations/payment/webhooks.d.ts +2 -0
- package/dist/implementations/payment/webhooks.js +72 -0
- package/dist/implementations/payment/webhooks.js.map +1 -0
- package/dist/implementations/shared/subscription-of-payment.d.ts +7 -0
- package/dist/implementations/shared/subscription-of-payment.js +47 -0
- package/dist/implementations/shared/subscription-of-payment.js.map +1 -0
- package/dist/implementations/subscriptions/calendar.d.ts +20 -0
- package/dist/implementations/subscriptions/calendar.js +160 -0
- package/dist/implementations/subscriptions/calendar.js.map +1 -0
- package/dist/implementations/subscriptions/changes.d.ts +5 -0
- package/dist/implementations/subscriptions/changes.js +140 -0
- package/dist/implementations/subscriptions/changes.js.map +1 -0
- package/dist/implementations/subscriptions/creation.d.ts +4 -0
- package/dist/implementations/subscriptions/creation.js +235 -0
- package/dist/implementations/subscriptions/creation.js.map +1 -0
- package/dist/implementations/subscriptions/errors.d.ts +7 -0
- package/dist/implementations/subscriptions/errors.js +42 -0
- package/dist/implementations/subscriptions/errors.js.map +1 -0
- package/dist/implementations/subscriptions/events.d.ts +9 -0
- package/dist/implementations/subscriptions/events.js +74 -0
- package/dist/implementations/subscriptions/events.js.map +1 -0
- package/dist/implementations/subscriptions/index.d.ts +7 -0
- package/dist/implementations/subscriptions/index.js +26 -0
- package/dist/implementations/subscriptions/index.js.map +1 -0
- package/dist/implementations/subscriptions/mapping.d.ts +3 -0
- package/dist/implementations/subscriptions/mapping.js +133 -0
- package/dist/implementations/subscriptions/mapping.js.map +1 -0
- package/dist/implementations/subscriptions/records.d.ts +40 -0
- package/dist/implementations/subscriptions/records.js +225 -0
- package/dist/implementations/subscriptions/records.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/mollie/amounts.d.ts +5 -0
- package/dist/mollie/amounts.js +85 -0
- package/dist/mollie/amounts.js.map +1 -0
- package/dist/mollie/client.d.ts +26 -0
- package/dist/mollie/client.js +136 -0
- package/dist/mollie/client.js.map +1 -0
- package/dist/mollie/errors.d.ts +16 -0
- package/dist/mollie/errors.js +35 -0
- package/dist/mollie/errors.js.map +1 -0
- package/dist/mollie/fields.d.ts +6 -0
- package/dist/mollie/fields.js +25 -0
- package/dist/mollie/fields.js.map +1 -0
- package/dist/mollie/guards.d.ts +16 -0
- package/dist/mollie/guards.js +63 -0
- package/dist/mollie/guards.js.map +1 -0
- package/dist/mollie/ids.d.ts +20 -0
- package/dist/mollie/ids.js +51 -0
- package/dist/mollie/ids.js.map +1 -0
- package/dist/mollie/json.d.ts +3 -0
- package/dist/mollie/json.js +31 -0
- package/dist/mollie/json.js.map +1 -0
- package/dist/mollie/metadata.d.ts +21 -0
- package/dist/mollie/metadata.js +121 -0
- package/dist/mollie/metadata.js.map +1 -0
- package/dist/mollie/resources.d.ts +13 -0
- package/dist/mollie/resources.js +132 -0
- package/dist/mollie/resources.js.map +1 -0
- package/dist/mollie/types.d.ts +119 -0
- package/dist/mollie/types.js +3 -0
- package/dist/mollie/types.js.map +1 -0
- package/docs/1.introduction.md +52 -0
- package/docs/2.payments.md +160 -0
- package/docs/3.webhooks.md +55 -0
- package/docs/4.subscriptions.md +109 -0
- package/docs/5.testing.md +67 -0
- package/package.json +86 -4
- package/skills/mollie/SKILL.md +55 -0
- package/skills/mollie/cases.json +49 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetadataRoom = MetadataRoom;
|
|
4
|
+
exports.FitsMetadataLimit = FitsMetadataLimit;
|
|
5
|
+
exports.IsJsonObject = IsJsonObject;
|
|
6
|
+
exports.IsJsonString = IsJsonString;
|
|
7
|
+
exports.IsJsonNumber = IsJsonNumber;
|
|
8
|
+
exports.ReadOwn = ReadOwn;
|
|
9
|
+
exports.ReadCallerMetadata = ReadCallerMetadata;
|
|
10
|
+
exports.WriteMetadata = WriteMetadata;
|
|
11
|
+
exports.MergeOwn = MergeOwn;
|
|
12
|
+
const json_1 = require("./json");
|
|
13
|
+
const OWN_KEY = "antelope";
|
|
14
|
+
const CALLER_KEY = "metadata";
|
|
15
|
+
const KEPT_KEY = "kept";
|
|
16
|
+
const FOREIGN_KEY = "foreign";
|
|
17
|
+
const METADATA_BYTES = 1024;
|
|
18
|
+
function MetadataRoom(metadata) {
|
|
19
|
+
return METADATA_BYTES - Buffer.byteLength(JSON.stringify(metadata), "utf8");
|
|
20
|
+
}
|
|
21
|
+
function FitsMetadataLimit(metadata) {
|
|
22
|
+
return MetadataRoom(metadata) >= 0;
|
|
23
|
+
}
|
|
24
|
+
function IsJsonObject(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function IsJsonString(value) {
|
|
28
|
+
return typeof value === "string";
|
|
29
|
+
}
|
|
30
|
+
function IsJsonNumber(value) {
|
|
31
|
+
return typeof value === "number";
|
|
32
|
+
}
|
|
33
|
+
function parse(metadata) {
|
|
34
|
+
if (IsJsonObject(metadata)) {
|
|
35
|
+
return metadata;
|
|
36
|
+
}
|
|
37
|
+
if (!IsJsonString(metadata)) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const parsed = (0, json_1.ParseJson)(metadata);
|
|
42
|
+
return IsJsonObject(parsed) ? parsed : {};
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function keptText(parsed) {
|
|
49
|
+
const own = parsed[OWN_KEY];
|
|
50
|
+
return IsJsonObject(own) && IsJsonString(own[KEPT_KEY])
|
|
51
|
+
? own[KEPT_KEY]
|
|
52
|
+
: undefined;
|
|
53
|
+
}
|
|
54
|
+
function ownOf(parsed) {
|
|
55
|
+
const own = parsed[OWN_KEY];
|
|
56
|
+
const kept = keptText(parsed);
|
|
57
|
+
if (kept === undefined || !IsJsonObject(own)) {
|
|
58
|
+
return own;
|
|
59
|
+
}
|
|
60
|
+
const keptOwn = parse(kept)[OWN_KEY];
|
|
61
|
+
return IsJsonObject(keptOwn) ? { ...keptOwn, ...own } : own;
|
|
62
|
+
}
|
|
63
|
+
function strings(value) {
|
|
64
|
+
if (!IsJsonObject(value)) {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"));
|
|
68
|
+
}
|
|
69
|
+
function ReadOwn(metadata, fields) {
|
|
70
|
+
const own = ownOf(parse(metadata));
|
|
71
|
+
if (!IsJsonObject(own)) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const read = {};
|
|
75
|
+
for (const key in fields) {
|
|
76
|
+
const value = Object.prototype.hasOwnProperty.call(own, key)
|
|
77
|
+
? own[key]
|
|
78
|
+
: undefined;
|
|
79
|
+
if (fields[key](value)) {
|
|
80
|
+
read[key] = value;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return read;
|
|
84
|
+
}
|
|
85
|
+
function isForeign(own) {
|
|
86
|
+
return IsJsonObject(own) && own[FOREIGN_KEY] === true;
|
|
87
|
+
}
|
|
88
|
+
function ReadCallerMetadata(metadata) {
|
|
89
|
+
const outer = parse(metadata);
|
|
90
|
+
const kept = keptText(outer);
|
|
91
|
+
const parsed = kept === undefined ? outer : parse(kept);
|
|
92
|
+
if (OWN_KEY in parsed &&
|
|
93
|
+
IsJsonObject(parsed[CALLER_KEY]) &&
|
|
94
|
+
!isForeign(parsed[OWN_KEY])) {
|
|
95
|
+
return strings(parsed[CALLER_KEY]);
|
|
96
|
+
}
|
|
97
|
+
return strings(Object.fromEntries(Object.entries(parsed).filter(([key]) => key !== OWN_KEY)));
|
|
98
|
+
}
|
|
99
|
+
function WriteMetadata(own, caller = {}) {
|
|
100
|
+
return { [OWN_KEY]: own, [CALLER_KEY]: caller };
|
|
101
|
+
}
|
|
102
|
+
function ownBefore(metadata, object) {
|
|
103
|
+
if (object === undefined) {
|
|
104
|
+
return metadata === undefined || metadata === null
|
|
105
|
+
? {}
|
|
106
|
+
: { [KEPT_KEY]: metadata };
|
|
107
|
+
}
|
|
108
|
+
if (!(OWN_KEY in object)) {
|
|
109
|
+
return IsJsonObject(object[CALLER_KEY]) ? { [FOREIGN_KEY]: true } : {};
|
|
110
|
+
}
|
|
111
|
+
const own = object[OWN_KEY];
|
|
112
|
+
return IsJsonObject(own) ? own : {};
|
|
113
|
+
}
|
|
114
|
+
function MergeOwn(metadata, changes) {
|
|
115
|
+
const object = IsJsonObject(metadata) ? metadata : undefined;
|
|
116
|
+
return {
|
|
117
|
+
...object,
|
|
118
|
+
[OWN_KEY]: { ...ownBefore(metadata, object), ...changes },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/mollie/metadata.ts"],"names":[],"mappings":";;AAgBA,oCAIC;AAGD,8CAIC;AAED,oCAIC;AAED,oCAEC;AAED,oCAEC;AAuDD,0BAkBC;AAWD,gDAkBC;AAED,sCAKC;AA0BD,4BASC;AAxLD,iCAAmC;AAGnC,MAAM,OAAO,GAAG,UAAU,CAAC;AAC3B,MAAM,UAAU,GAAG,UAAU,CAAC;AAC9B,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,cAAc,GAAG,IAAI,CAAC;AAQ5B,SAAgB,YAAY,CAC1B,QAAwE;IAExE,OAAO,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9E,CAAC;AAGD,SAAgB,iBAAiB,CAC/B,QAAqC;IAErC,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,SAAgB,YAAY,CAC1B,KAA4B;IAE5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAgB,YAAY,CAAC,KAA4B;IACvD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED,SAAgB,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AAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC;AAUD,SAAgB,QAAQ,CACtB,QAAoC,EACpC,OAAU;IAEV,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7D,OAAO;QACL,GAAG,MAAM;QACT,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,GAAG,OAAO,EAAE;KAC1D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Guard } from "./guards";
|
|
2
|
+
import type { MollieCapture, MollieCustomer, MollieMandate, MolliePayment, MollieRefund, MollieSubscription } from "./types";
|
|
3
|
+
export declare const IsMolliePayment: Guard<MolliePayment>;
|
|
4
|
+
export declare const IsMollieRefund: Guard<MollieRefund>;
|
|
5
|
+
export declare const IsMollieCapture: Guard<MollieCapture>;
|
|
6
|
+
export declare const IsMollieCustomer: Guard<MollieCustomer>;
|
|
7
|
+
export declare const IsMollieMandate: Guard<MollieMandate>;
|
|
8
|
+
export declare const IsMollieSubscription: Guard<MollieSubscription>;
|
|
9
|
+
export declare const IsMolliePaymentPage: Guard<{
|
|
10
|
+
_embedded?: {
|
|
11
|
+
payments?: MolliePayment[];
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IsMolliePaymentPage = exports.IsMollieSubscription = exports.IsMollieMandate = exports.IsMollieCustomer = exports.IsMollieCapture = exports.IsMollieRefund = exports.IsMolliePayment = void 0;
|
|
4
|
+
const guards_1 = require("./guards");
|
|
5
|
+
const json_1 = require("./json");
|
|
6
|
+
const IsMollieAmount = (0, guards_1.ObjectWith)({
|
|
7
|
+
currency: guards_1.IsText,
|
|
8
|
+
value: guards_1.IsText,
|
|
9
|
+
});
|
|
10
|
+
const IsMollieLink = (0, guards_1.ObjectWith)({
|
|
11
|
+
href: guards_1.IsText,
|
|
12
|
+
type: (0, guards_1.Optional)(guards_1.IsText),
|
|
13
|
+
});
|
|
14
|
+
const IsMetadata = (0, guards_1.Optional)(json_1.IsJsonValue);
|
|
15
|
+
const IsTimestamp = (0, guards_1.Nullable)(guards_1.IsText);
|
|
16
|
+
exports.IsMolliePayment = (0, guards_1.ObjectWith)({
|
|
17
|
+
resource: (0, guards_1.OneOf)(["payment"]),
|
|
18
|
+
id: guards_1.IsText,
|
|
19
|
+
mode: (0, guards_1.OneOf)(["live", "test"]),
|
|
20
|
+
description: guards_1.IsText,
|
|
21
|
+
amount: IsMollieAmount,
|
|
22
|
+
amountRefunded: (0, guards_1.Optional)(IsMollieAmount),
|
|
23
|
+
amountRemaining: (0, guards_1.Optional)(IsMollieAmount),
|
|
24
|
+
amountCaptured: (0, guards_1.Optional)(IsMollieAmount),
|
|
25
|
+
status: (0, guards_1.OneOf)([
|
|
26
|
+
"open",
|
|
27
|
+
"pending",
|
|
28
|
+
"authorized",
|
|
29
|
+
"paid",
|
|
30
|
+
"canceled",
|
|
31
|
+
"expired",
|
|
32
|
+
"failed",
|
|
33
|
+
]),
|
|
34
|
+
sequenceType: (0, guards_1.OneOf)(["oneoff", "first", "recurring"]),
|
|
35
|
+
captureMode: (0, guards_1.Nullable)((0, guards_1.OneOf)(["automatic", "manual"])),
|
|
36
|
+
method: (0, guards_1.Nullable)(guards_1.IsText),
|
|
37
|
+
metadata: IsMetadata,
|
|
38
|
+
customerId: (0, guards_1.Nullable)(guards_1.IsText),
|
|
39
|
+
mandateId: (0, guards_1.Nullable)(guards_1.IsText),
|
|
40
|
+
subscriptionId: (0, guards_1.Nullable)(guards_1.IsText),
|
|
41
|
+
details: (0, guards_1.Nullable)((0, guards_1.ObjectWith)({
|
|
42
|
+
failureReason: (0, guards_1.Nullable)(guards_1.IsText),
|
|
43
|
+
failureMessage: (0, guards_1.Nullable)(guards_1.IsText),
|
|
44
|
+
bankReasonCode: (0, guards_1.Nullable)(guards_1.IsText),
|
|
45
|
+
bankReason: (0, guards_1.Nullable)(guards_1.IsText),
|
|
46
|
+
})),
|
|
47
|
+
redirectUrl: (0, guards_1.Nullable)(guards_1.IsText),
|
|
48
|
+
webhookUrl: (0, guards_1.Nullable)(guards_1.IsText),
|
|
49
|
+
createdAt: guards_1.IsText,
|
|
50
|
+
authorizedAt: IsTimestamp,
|
|
51
|
+
paidAt: IsTimestamp,
|
|
52
|
+
canceledAt: IsTimestamp,
|
|
53
|
+
expiresAt: IsTimestamp,
|
|
54
|
+
expiredAt: IsTimestamp,
|
|
55
|
+
failedAt: IsTimestamp,
|
|
56
|
+
isCancelable: (0, guards_1.Nullable)(guards_1.IsFlag),
|
|
57
|
+
_links: (0, guards_1.RecordOf)((0, guards_1.Nullable)(IsMollieLink)),
|
|
58
|
+
});
|
|
59
|
+
exports.IsMollieRefund = (0, guards_1.ObjectWith)({
|
|
60
|
+
resource: (0, guards_1.OneOf)(["refund"]),
|
|
61
|
+
id: guards_1.IsText,
|
|
62
|
+
amount: IsMollieAmount,
|
|
63
|
+
status: (0, guards_1.OneOf)([
|
|
64
|
+
"queued",
|
|
65
|
+
"pending",
|
|
66
|
+
"processing",
|
|
67
|
+
"refunded",
|
|
68
|
+
"failed",
|
|
69
|
+
"canceled",
|
|
70
|
+
]),
|
|
71
|
+
paymentId: guards_1.IsText,
|
|
72
|
+
description: (0, guards_1.Optional)(guards_1.IsText),
|
|
73
|
+
metadata: IsMetadata,
|
|
74
|
+
createdAt: guards_1.IsText,
|
|
75
|
+
});
|
|
76
|
+
exports.IsMollieCapture = (0, guards_1.ObjectWith)({
|
|
77
|
+
resource: (0, guards_1.OneOf)(["capture"]),
|
|
78
|
+
id: guards_1.IsText,
|
|
79
|
+
mode: (0, guards_1.OneOf)(["live", "test"]),
|
|
80
|
+
amount: (0, guards_1.Nullable)(IsMollieAmount),
|
|
81
|
+
status: (0, guards_1.OneOf)(["pending", "succeeded", "failed"]),
|
|
82
|
+
paymentId: guards_1.IsText,
|
|
83
|
+
metadata: IsMetadata,
|
|
84
|
+
createdAt: guards_1.IsText,
|
|
85
|
+
});
|
|
86
|
+
exports.IsMollieCustomer = (0, guards_1.ObjectWith)({
|
|
87
|
+
resource: (0, guards_1.OneOf)(["customer"]),
|
|
88
|
+
id: guards_1.IsText,
|
|
89
|
+
name: (0, guards_1.Nullable)(guards_1.IsText),
|
|
90
|
+
email: (0, guards_1.Nullable)(guards_1.IsText),
|
|
91
|
+
metadata: IsMetadata,
|
|
92
|
+
createdAt: guards_1.IsText,
|
|
93
|
+
});
|
|
94
|
+
exports.IsMollieMandate = (0, guards_1.ObjectWith)({
|
|
95
|
+
resource: (0, guards_1.OneOf)(["mandate"]),
|
|
96
|
+
id: guards_1.IsText,
|
|
97
|
+
method: (0, guards_1.OneOf)(["creditcard", "directdebit", "paypal"]),
|
|
98
|
+
status: (0, guards_1.OneOf)(["valid", "pending", "invalid"]),
|
|
99
|
+
scopes: (0, guards_1.Nullable)((0, guards_1.ListOf)(guards_1.IsText)),
|
|
100
|
+
details: (0, guards_1.Nullable)((0, guards_1.ObjectWith)({
|
|
101
|
+
cardNumber: (0, guards_1.Nullable)(guards_1.IsText),
|
|
102
|
+
cardLabel: (0, guards_1.Nullable)(guards_1.IsText),
|
|
103
|
+
cardExpiryDate: (0, guards_1.Nullable)(guards_1.IsText),
|
|
104
|
+
consumerAccount: (0, guards_1.Nullable)(guards_1.IsText),
|
|
105
|
+
})),
|
|
106
|
+
customerId: (0, guards_1.Optional)(guards_1.IsText),
|
|
107
|
+
createdAt: guards_1.IsText,
|
|
108
|
+
});
|
|
109
|
+
exports.IsMollieSubscription = (0, guards_1.ObjectWith)({
|
|
110
|
+
resource: (0, guards_1.OneOf)(["subscription"]),
|
|
111
|
+
id: guards_1.IsText,
|
|
112
|
+
status: (0, guards_1.OneOf)(["pending", "active", "canceled", "suspended", "completed"]),
|
|
113
|
+
amount: IsMollieAmount,
|
|
114
|
+
times: (0, guards_1.Nullable)(guards_1.IsCount),
|
|
115
|
+
timesRemaining: (0, guards_1.Nullable)(guards_1.IsCount),
|
|
116
|
+
interval: guards_1.IsText,
|
|
117
|
+
startDate: guards_1.IsText,
|
|
118
|
+
nextPaymentDate: (0, guards_1.Nullable)(guards_1.IsText),
|
|
119
|
+
description: guards_1.IsText,
|
|
120
|
+
metadata: IsMetadata,
|
|
121
|
+
webhookUrl: (0, guards_1.Nullable)(guards_1.IsText),
|
|
122
|
+
customerId: guards_1.IsText,
|
|
123
|
+
mandateId: (0, guards_1.Nullable)(guards_1.IsText),
|
|
124
|
+
createdAt: guards_1.IsText,
|
|
125
|
+
canceledAt: IsTimestamp,
|
|
126
|
+
});
|
|
127
|
+
exports.IsMolliePaymentPage = (0, guards_1.ObjectWith)({
|
|
128
|
+
_embedded: (0, guards_1.Optional)((0, guards_1.ObjectWith)({
|
|
129
|
+
payments: (0, guards_1.Optional)((0, guards_1.ListOf)(exports.IsMolliePayment)),
|
|
130
|
+
})),
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/mollie/resources.ts"],"names":[],"mappings":";;;AAAA,qCAWkB;AAClB,iCAAqC;AAarC,MAAM,cAAc,GAAG,IAAA,mBAAU,EAAe;IAC9C,QAAQ,EAAE,eAAM;IAChB,KAAK,EAAE,eAAM;CACd,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,IAAA,mBAAU,EAAa;IAC1C,IAAI,EAAE,eAAM;IACZ,IAAI,EAAE,IAAA,iBAAQ,EAAC,eAAM,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,IAAA,iBAAQ,EAAC,kBAAW,CAAC,CAAC;AACzC,MAAM,WAAW,GAAG,IAAA,iB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,EAAE,eAAM;IACV,MAAM,EAAE,IAAA,cAAK,EAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAC1E,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE,IAAA,iBAAQ,EAAC,gBAAO,CAAC;IACxB,cAAc,EAAE,IAAA,iBAAQ,EAAC,gBAAO,CAAC;IACjC,QAAQ,EAAE,eAAM;IAChB,SAAS,EAAE,eAAM;IACjB,eAAe,EAAE,IAAA,iBAAQ,EAAC,eAAM,CAAC;IACjC,WAAW,EAAE,eAAM;IACnB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,IAAA,iBAAQ,EAAC,eAAM,CAAC;IAC5B,UAAU,EAAE,eAAM;IAClB,SAAS,EAAE,IAAA,iBAAQ,EAAC,eAAM,CAAC;IAC3B,SAAS,EAAE,eAAM;IACjB,UAAU,EAAE,WAAW;CACxB,CAAC,CAAC;AAGQ,QAAA,mBAAmB,GAAG,IAAA,mBAAU,EAE1C;IACD,SAAS,EAAE,IAAA,iBAAQ,EACjB,IAAA,mBAAU,EAAiC;QACzC,QAAQ,EAAE,IAAA,iBAAQ,EAAC,IAAA,eAAM,EAAC,uBAAe,CAAC,CAAC;KAC5C,CAAC,CACH;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export interface MollieAmount {
|
|
2
|
+
currency: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
interface MollieLink {
|
|
6
|
+
href: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
}
|
|
9
|
+
type MollieLinks = Record<string, MollieLink | null | undefined>;
|
|
10
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
|
|
11
|
+
export interface JsonObject {
|
|
12
|
+
[key: string]: JsonValue;
|
|
13
|
+
}
|
|
14
|
+
export type MollieMetadata = JsonValue;
|
|
15
|
+
export type MolliePaymentStatus = "open" | "pending" | "authorized" | "paid" | "canceled" | "expired" | "failed";
|
|
16
|
+
export type MollieSequenceType = "oneoff" | "first" | "recurring";
|
|
17
|
+
interface MolliePaymentDetails {
|
|
18
|
+
failureReason?: string | null;
|
|
19
|
+
failureMessage?: string | null;
|
|
20
|
+
bankReasonCode?: string | null;
|
|
21
|
+
bankReason?: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface MolliePayment {
|
|
24
|
+
resource: "payment";
|
|
25
|
+
id: string;
|
|
26
|
+
mode: "live" | "test";
|
|
27
|
+
description: string;
|
|
28
|
+
amount: MollieAmount;
|
|
29
|
+
amountRefunded?: MollieAmount;
|
|
30
|
+
amountRemaining?: MollieAmount;
|
|
31
|
+
amountCaptured?: MollieAmount;
|
|
32
|
+
status: MolliePaymentStatus;
|
|
33
|
+
sequenceType: MollieSequenceType;
|
|
34
|
+
captureMode?: "automatic" | "manual" | null;
|
|
35
|
+
method?: string | null;
|
|
36
|
+
metadata?: MollieMetadata;
|
|
37
|
+
customerId?: string | null;
|
|
38
|
+
mandateId?: string | null;
|
|
39
|
+
subscriptionId?: string | null;
|
|
40
|
+
details?: MolliePaymentDetails | null;
|
|
41
|
+
redirectUrl?: string | null;
|
|
42
|
+
webhookUrl?: string | null;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
authorizedAt?: string | null;
|
|
45
|
+
paidAt?: string | null;
|
|
46
|
+
canceledAt?: string | null;
|
|
47
|
+
expiresAt?: string | null;
|
|
48
|
+
expiredAt?: string | null;
|
|
49
|
+
failedAt?: string | null;
|
|
50
|
+
isCancelable?: boolean | null;
|
|
51
|
+
_links: MollieLinks;
|
|
52
|
+
}
|
|
53
|
+
export type MollieRefundStatus = "queued" | "pending" | "processing" | "refunded" | "failed" | "canceled";
|
|
54
|
+
export interface MollieRefund {
|
|
55
|
+
resource: "refund";
|
|
56
|
+
id: string;
|
|
57
|
+
amount: MollieAmount;
|
|
58
|
+
status: MollieRefundStatus;
|
|
59
|
+
paymentId: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
metadata?: MollieMetadata;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
}
|
|
64
|
+
type MollieCaptureStatus = "pending" | "succeeded" | "failed";
|
|
65
|
+
export interface MollieCapture {
|
|
66
|
+
resource: "capture";
|
|
67
|
+
id: string;
|
|
68
|
+
mode: "live" | "test";
|
|
69
|
+
amount?: MollieAmount | null;
|
|
70
|
+
status: MollieCaptureStatus;
|
|
71
|
+
paymentId: string;
|
|
72
|
+
metadata?: MollieMetadata;
|
|
73
|
+
createdAt: string;
|
|
74
|
+
}
|
|
75
|
+
export interface MollieCustomer {
|
|
76
|
+
resource: "customer";
|
|
77
|
+
id: string;
|
|
78
|
+
name?: string | null;
|
|
79
|
+
email?: string | null;
|
|
80
|
+
metadata?: MollieMetadata;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
}
|
|
83
|
+
type MollieMandateMethod = "creditcard" | "directdebit" | "paypal";
|
|
84
|
+
interface MollieMandateDetails {
|
|
85
|
+
cardNumber?: string | null;
|
|
86
|
+
cardLabel?: string | null;
|
|
87
|
+
cardExpiryDate?: string | null;
|
|
88
|
+
consumerAccount?: string | null;
|
|
89
|
+
}
|
|
90
|
+
export interface MollieMandate {
|
|
91
|
+
resource: "mandate";
|
|
92
|
+
id: string;
|
|
93
|
+
method: MollieMandateMethod;
|
|
94
|
+
status: "valid" | "pending" | "invalid";
|
|
95
|
+
scopes?: string[] | null;
|
|
96
|
+
details?: MollieMandateDetails | null;
|
|
97
|
+
customerId?: string;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
}
|
|
100
|
+
type MollieSubscriptionStatus = "pending" | "active" | "canceled" | "suspended" | "completed";
|
|
101
|
+
export interface MollieSubscription {
|
|
102
|
+
resource: "subscription";
|
|
103
|
+
id: string;
|
|
104
|
+
status: MollieSubscriptionStatus;
|
|
105
|
+
amount: MollieAmount;
|
|
106
|
+
times?: number | null;
|
|
107
|
+
timesRemaining?: number | null;
|
|
108
|
+
interval: string;
|
|
109
|
+
startDate: string;
|
|
110
|
+
nextPaymentDate?: string | null;
|
|
111
|
+
description: string;
|
|
112
|
+
metadata?: MollieMetadata;
|
|
113
|
+
webhookUrl?: string | null;
|
|
114
|
+
customerId: string;
|
|
115
|
+
mandateId?: string | null;
|
|
116
|
+
createdAt: string;
|
|
117
|
+
canceledAt?: string | null;
|
|
118
|
+
}
|
|
119
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mollie/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Introduction
|
|
3
|
+
description: The interfaces the Mollie module implements, its configuration fields, and the shape of the identifiers it returns.
|
|
4
|
+
mode: reference
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
`@antelopejs/mollie` implements two interfaces on Mollie's API:
|
|
8
|
+
|
|
9
|
+
- `@antelopejs/interface-payment` covers payments, hosted checkout, refunds, customers, saved methods and webhooks.
|
|
10
|
+
- `@antelopejs/interface-subscriptions` runs on Mollie's Subscriptions API, because Mollie creates every renewal payment itself.
|
|
11
|
+
|
|
12
|
+
There is no Mollie-specific interface. A backend that needs a Mollie feature that the two interfaces do not model calls Mollie directly.
|
|
13
|
+
|
|
14
|
+
## What it needs
|
|
15
|
+
|
|
16
|
+
The module needs only an API key. It depends on no Redis, database or API module. You call `VerifyWebhook` from your own route to verify webhooks, so the module mounts no route of its own.
|
|
17
|
+
|
|
18
|
+
## Configuration
|
|
19
|
+
|
|
20
|
+
| Field | Required | Meaning |
|
|
21
|
+
| ----------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
22
|
+
| `apiKey` | Yes | A Mollie API key, `test_…` or `live_…` |
|
|
23
|
+
| `webhookUrl` | No | Your public webhook route. The module sends it with every payment and subscription it creates |
|
|
24
|
+
| `accounts` | No | Further accounts, `{ name: { apiKey, webhookUrl } }`, chosen by the `provider` argument |
|
|
25
|
+
| `apiUrl` | No | The API base URL. It is `https://api.mollie.com` unless a test points it elsewhere |
|
|
26
|
+
| `settleTimeoutMs` | No | How long `CapturePayment` waits for Mollie to apply a capture, in every account. A finite number, 0 or more, or the module refuses to start. Default 10000 |
|
|
27
|
+
|
|
28
|
+
Mollie calls the webhook URL given with each payment. Mollie calls these "classic" webhooks. Without `webhookUrl`, Mollie calls nothing. Payments still work and `GetPayment` reads them, but the module raises no event and reports no subscription renewal.
|
|
29
|
+
|
|
30
|
+
A call that names a `provider` with no account under that name rejects with `PaymentError`, or `SubscriptionError` for a subscriptions function.
|
|
31
|
+
|
|
32
|
+
## Identifiers
|
|
33
|
+
|
|
34
|
+
Every identifier is opaque to callers. Some are composites, because Mollie nests the record under another one:
|
|
35
|
+
|
|
36
|
+
| Record | Identifier | Why |
|
|
37
|
+
| -------------------- | --------------------- | ------------------------------------------------------------------- |
|
|
38
|
+
| Payment | `tr_…` | Mollie's own |
|
|
39
|
+
| Checkout session | `tr_…`, the payment's | A Mollie payment is its own hosted page |
|
|
40
|
+
| Customer | `cst_…` | Mollie's own |
|
|
41
|
+
| Saved payment method | `cst_…:mdt_…` | Mollie reads and revokes a mandate under its customer |
|
|
42
|
+
| Refund | `tr_…:re_…` | Mollie reads a refund under its payment |
|
|
43
|
+
| Subscription | `cst_…:sub_…` | Mollie reads, changes and cancels a subscription under its customer |
|
|
44
|
+
|
|
45
|
+
The module reports an identifier of the wrong shape as not found, without asking Mollie.
|
|
46
|
+
|
|
47
|
+
## Where to read next
|
|
48
|
+
|
|
49
|
+
- [Payments](./2.payments.md) covers statuses, the redirect flows, holding funds, refunds, errors and idempotency.
|
|
50
|
+
- [Webhooks](./3.webhooks.md) covers how the module verifies a delivery, and which events exist.
|
|
51
|
+
- [Subscriptions](./4.subscriptions.md) covers how the subscriptions interface maps onto Mollie's.
|
|
52
|
+
- [Testing](./5.testing.md) covers the stand-in, switching to live Mollie, and what the conformance suites cannot check here.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Payments
|
|
3
|
+
description: How the Mollie module maps payment statuses, amounts, payment methods, the hosted page language, held funds, refunds, cancellations, errors and idempotency keys onto Mollie.
|
|
4
|
+
mode: reference
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Statuses
|
|
8
|
+
|
|
9
|
+
Mollie has seven payment statuses. The interface has six.
|
|
10
|
+
|
|
11
|
+
| Mollie | Interface | Why |
|
|
12
|
+
| ---------------------------- | ----------------- | -------------------------------------------------------------------------------------- |
|
|
13
|
+
| `open`, with a checkout link | `requires_action` | The payer must go to the link, which is the payment's `redirectUrl` |
|
|
14
|
+
| `open`, without one | `pending` | An off-session charge that Mollie has not settled yet |
|
|
15
|
+
| `pending` | `pending` | Awaiting the bank |
|
|
16
|
+
| `authorized` | `authorized` | Funds held, awaiting capture |
|
|
17
|
+
| `authorized`, with a capture | `pending` | Mollie has accepted a capture and not applied it yet |
|
|
18
|
+
| `paid` | `succeeded` | |
|
|
19
|
+
| `failed` | `failed` | `failure` comes from Mollie's `failureReason` (cards) or `bankReasonCode` (SEPA) |
|
|
20
|
+
| `canceled` | `canceled` | |
|
|
21
|
+
| `expired` | `canceled` | In Mollie's terms, the payer abandoned it, or nobody captured an authorization in time |
|
|
22
|
+
|
|
23
|
+
The module normalises `failure.code` from Mollie's reasons:
|
|
24
|
+
|
|
25
|
+
| Mollie reason | `failure.code` |
|
|
26
|
+
| ---------------------------------------------------------------------------------------------------------------- | ----------------------- |
|
|
27
|
+
| `insufficient_funds`, SEPA `AM04` | `insufficient_funds` |
|
|
28
|
+
| `card_expired` | `expired_card` |
|
|
29
|
+
| `invalid_card_holder_name`, `invalid_card_number`, `invalid_cvv`, SEPA `AC01` | `incorrect_details` |
|
|
30
|
+
| `authentication_abandoned`, `authentication_failed`, `authentication_required`, `authentication_unavailable_acs` | `authentication_failed` |
|
|
31
|
+
| Any other reason, `invalid_card_type` included | `declined` |
|
|
32
|
+
|
|
33
|
+
`failure.providerCode` holds the reason verbatim.
|
|
34
|
+
|
|
35
|
+
## Amounts
|
|
36
|
+
|
|
37
|
+
Mollie takes an amount as a string with the currency's decimals. Mollie uses two decimals for every currency it lists, and none for `ISK` and `JPY` (Mollie: _Multicurrency_). The module converts from the interface's minor units with Mollie's table, not with the runtime's currency data, because the two disagree for some currencies that Mollie supports. Node's ICU data gives `HUF` no decimals and Mollie gives it two, so `{ value: 1050, currency: "HUF" }` is `"10.50"`. For a currency that Mollie does not list, the module falls back to the runtime's currency data (`Intl.NumberFormat`).
|
|
38
|
+
|
|
39
|
+
## What `paymentMethod` may be
|
|
40
|
+
|
|
41
|
+
| Value | Meaning | Mollie request |
|
|
42
|
+
| ------------------ | -------------------------------------------------------------------- | ------------------------------------------------ |
|
|
43
|
+
| `cst_…:mdt_…` | A saved method, from `ListPaymentMethods` | `sequenceType: recurring`, the mandate |
|
|
44
|
+
| `tkn_…` | A card token from Mollie Components, collected by your own card form | `method: creditcard`, `cardToken` |
|
|
45
|
+
| a Mollie method id | The method your own picker chose: `ideal`, `creditcard`, `paypal`, … | `method`, and the payer skips Mollie's selection |
|
|
46
|
+
| absent | Mollie's hosted page lets the payer choose | no `method` |
|
|
47
|
+
|
|
48
|
+
Any other value rejects with `CustomerNotFoundError` for the payment method.
|
|
49
|
+
|
|
50
|
+
The module charges a saved method as a Mollie recurring payment, which needs no payer, whether or not `offSession` is set. A saved method belongs to one customer. Charging it for another customer rejects with `CustomerNotFoundError` for the method. `offSession` needs a saved method, and `offSession` combined with `savePaymentMethod` rejects with `PaymentError`.
|
|
51
|
+
|
|
52
|
+
## Payer-present payments are redirects
|
|
53
|
+
|
|
54
|
+
Mollie has no payment that completes inside the creating call while the payer is present. `CreatePayment` without a saved method, and `CreateCheckoutSession`, both return `requires_action` with Mollie's checkout URL. So `CreatePayment` requires `returnUrl` unless it charges a saved method.
|
|
55
|
+
|
|
56
|
+
`savePaymentMethod` needs a `customer`. It makes the payment a Mollie `first` payment. Once the payer completes it, Mollie creates a mandate for the customer, and `ListPaymentMethods` lists it. `ListPaymentMethods` lists a Mollie mandate when the mandate is `valid` and usable without the payer (scope `customer-not-present`). It does not list a card saved for one-click checkout only, because that card cannot be charged off-session.
|
|
57
|
+
|
|
58
|
+
Mollie reports a first card payment `paid` a few hundred milliseconds before it turns the mandate from `pending` to `valid` (250 to 570 ms in Mollie's test mode). So when `GetPayment` or `VerifyWebhook` reads a paid card payment that saves a method, the module first waits until the mandate is `valid`, at most 5 seconds after the payment's `paidAt`. A card that is saved is therefore listed once the payment reads `succeeded`. If the mandate is still `pending` after the 5 seconds, the payment is returned as it is, and later reads do not wait again. `ListPaymentMethods` never waits. Only cards wait: a bank mandate, such as SEPA Direct Debit, can stay `pending` for days, and the module does not hold those payments back.
|
|
59
|
+
|
|
60
|
+
## The hosted page language
|
|
61
|
+
|
|
62
|
+
`CreateCheckoutSession` turns its `locale` into Mollie's `locale`, which sets the language of Mollie's hosted page (Mollie: _Create payment_, `locale`). Mollie names a language with its region, such as `en_GB` or `fr_FR`, and accepts only the locales it lists. The module picks one in three steps:
|
|
63
|
+
|
|
64
|
+
1. A locale Mollie accepts as it is goes with `-` replaced by `_`. Of the interface's values, only `en-GB` does, and becomes `en_GB`.
|
|
65
|
+
2. A bare language, or a regional one Mollie does not offer, gets the region Mollie offers that language in. So `fr` is `fr_FR`, `en` is `en_US`, and `pt-BR` is `pt_PT`.
|
|
66
|
+
3. A language Mollie does not offer, and `auto`, send no locale. Mollie then picks the language from the payer's browser.
|
|
67
|
+
|
|
68
|
+
| `locale` | Mollie `locale` |
|
|
69
|
+
| ------------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
|
70
|
+
| `en-GB` | `en_GB` |
|
|
71
|
+
| `en` | `en_US` |
|
|
72
|
+
| `es`, `es-419` | `es_ES` |
|
|
73
|
+
| `fr`, `fr-CA` | `fr_FR` |
|
|
74
|
+
| `pt`, `pt-BR` | `pt_PT` |
|
|
75
|
+
| `de` | `de_DE` |
|
|
76
|
+
| `nl` | `nl_NL` |
|
|
77
|
+
| `nb` | `nb_NO` |
|
|
78
|
+
| `cs` | `cs_CZ` |
|
|
79
|
+
| `da` | `da_DK` |
|
|
80
|
+
| `el` | `el_GR` |
|
|
81
|
+
| `fi` | `fi_FI` |
|
|
82
|
+
| `hu` | `hu_HU` |
|
|
83
|
+
| `it` | `it_IT` |
|
|
84
|
+
| `lt` | `lt_LT` |
|
|
85
|
+
| `lv` | `lv_LV` |
|
|
86
|
+
| `pl` | `pl_PL` |
|
|
87
|
+
| `sk` | `sk_SK` |
|
|
88
|
+
| `sl` | `sl_SI` |
|
|
89
|
+
| `sv` | `sv_SE` |
|
|
90
|
+
| `tr` | `tr_TR` |
|
|
91
|
+
| `auto`, `bg`, `et`, `fil`, `hr`, `id`, `ja`, `ko`, `ms`, `mt`, `ro`, `ru`, `th`, `vi`, `zh`, `zh-HK`, `zh-TW` | none: Mollie uses the browser |
|
|
92
|
+
|
|
93
|
+
A page that shows another language than the one you asked for is usually a value in the last row. Mollie's own list of locales is in its _Create payment_ reference. `CreatePayment` sends no locale.
|
|
94
|
+
|
|
95
|
+
## Off-session charges settle later
|
|
96
|
+
|
|
97
|
+
Mollie creates a charge against a saved method `open` and settles it afterwards, so `CreatePayment` returns `pending`. The outcome arrives as a `payment.succeeded`, `payment.authorized` or `payment.failed` event, or through `GetPayment`. A decline is a `failed` payment that Mollie reports after the call returns. The interface's rule that a decline is a result, not an exception, still holds, but the result is not in the creating call.
|
|
98
|
+
|
|
99
|
+
## Holding funds with `authorizeOnly`
|
|
100
|
+
|
|
101
|
+
Mollie can hold funds for later capture only for cards, Klarna, Billie, Riverty, Vipps, MobilePay, PayPal and Billink (Mollie: _Place a hold for a payment_). On a hosted page, Mollie charges at once a payer who picks any other method. So the module does the following:
|
|
102
|
+
|
|
103
|
+
- With a saved method, it reads the mandate's method first and refuses a SEPA Direct Debit mandate with a `PaymentError`.
|
|
104
|
+
- With a Mollie method id, it refuses any method outside that list with a `PaymentError`.
|
|
105
|
+
- On a hosted page, it offers the payer only those methods.
|
|
106
|
+
|
|
107
|
+
When the module refuses a request, nothing reaches Mollie. A hold on a saved method reads `pending` until Mollie reports it `authorized`. A hold on a hosted page reads `requires_action` while it waits on the payer. `CapturePayment` captures once. Capturing less than the held amount releases the rest, as Mollie does for cards. `CancelPayment` on an authorized payment releases it, unless a capture is in flight (see [Cancelling](#cancelling)). Mollie processes a release asynchronously, so the payment may still read `authorized` for a moment.
|
|
108
|
+
|
|
109
|
+
## Captures settle after the call
|
|
110
|
+
|
|
111
|
+
Mollie accepts a capture as `pending` and applies it to the payment afterwards. In test mode in November 2026, that took 0.75 to 1.8 seconds. Until then, Mollie still reports the payment `authorized` with nothing captured.
|
|
112
|
+
|
|
113
|
+
- `CapturePayment` reads the payment and its capture again until Mollie has applied the capture, for at most `settleTimeoutMs` (10 seconds by default). Then it returns the payment `succeeded`.
|
|
114
|
+
- `settleTimeoutMs` is a finite number of milliseconds, 0 or more. Any other value, such as `"5"`, `-1`, `NaN` or `Infinity`, makes the module refuse to start.
|
|
115
|
+
- When that budget runs out first, `CapturePayment` returns the payment `pending`, with `amountCaptured` set to the amount being captured. `GetPayment` reports the payment the same way until Mollie applies the capture. The outcome then arrives as a `payment.succeeded` event, or through `GetPayment`.
|
|
116
|
+
- With `settleTimeoutMs: 0`, `CapturePayment` returns as soon as Mollie accepts the capture.
|
|
117
|
+
- Each read is cut short when the budget runs out, so `CapturePayment` takes at most `settleTimeoutMs` plus one 250 ms poll, however slowly Mollie answers.
|
|
118
|
+
- Once Mollie has accepted the capture, a read that fails, a 5xx or a network failure for instance, ends the wait as the budget does. `CapturePayment` returns the payment `pending` with the amount being captured, not an error, since the capture exists at Mollie. Read the payment again, or replay the key, to learn the outcome.
|
|
119
|
+
- Mollie lists `failed` among a capture's statuses, and rejects a capture once the authorization has expired (Mollie: _Get capture_, _Place a hold for a payment_). A failed capture ends the wait at once. `CapturePayment` rejects with a `PaymentError` whose `providerCode` is `capture_failed`, and a replay of its key rejects the same way. The payment keeps the status Mollie reports: `authorized` with nothing captured while the hold lasts, `canceled` once it has expired.
|
|
120
|
+
- Mollie takes one capture per authorization. Once a payment has a capture that has not failed, a capture under another key rejects with `InvalidPaymentStateError` before it reaches Mollie. Its `status` is `pending` while the first capture is in flight and `succeeded` once Mollie has applied it. A failed capture blocks neither a capture under another key nor a cancellation. The module sends those to Mollie, which decides: Mollie does not document whether it takes a second capture after a failed one.
|
|
121
|
+
|
|
122
|
+
## Refunds
|
|
123
|
+
|
|
124
|
+
Mollie requires an amount, so a refund without one refunds what Mollie reports as remaining. Mollie has no refund reason. The module keeps the reason and the idempotency key in the refund's metadata, outside what `Refund.metadata` returns, and also writes the reason into the refund's description. Refund statuses map as follows:
|
|
125
|
+
|
|
126
|
+
- `queued`, `pending` and `processing` are `pending`.
|
|
127
|
+
- `refunded` is `succeeded`.
|
|
128
|
+
- `failed` and `canceled` are `failed`.
|
|
129
|
+
|
|
130
|
+
### The refunded amount
|
|
131
|
+
|
|
132
|
+
A payment's `amountRefunded` is the sum of its refunds that have settled, the refunds Mollie reports `refunded` (`succeeded`). The interface defines it as "zero until a refund settles". Mollie moves its own `amountRefunded` field when a refund settles, but it can trail the refund's status for a moment, so the module reads that field only when Mollie fails to list the payment's refunds. The read then still returns the payment, with Mollie's figure, rather than an error.
|
|
133
|
+
|
|
134
|
+
- A `queued`, `pending` or `processing` refund is not counted yet, and neither is a `failed` or `canceled` one. A refund joins the total on the read after Mollie reports it `refunded`. Mollie's test mode can keep a refund `pending` for minutes, so `amountRefunded` stays `0` that long.
|
|
135
|
+
- A pending refund already lowers what can still be refunded. Mollie takes a refund out of `amountRemaining` as soon as it creates it, so `RefundPayment` limits a refund by what is left after every refund Mollie holds, settled or not.
|
|
136
|
+
- `GetPayment`, a `CapturePayment` replay and a webhook delivery list the payment's refunds, every page of them, when Mollie links `refunds` on the payment, which it does from the first refund on. A payment with no refund costs no extra request. The module does not infer refunds from `amountRemaining`: Mollie's test mode reports it above the payment's amount on some paid payments.
|
|
137
|
+
|
|
138
|
+
## Cancelling
|
|
139
|
+
|
|
140
|
+
The module cancels an `open` or `pending` payment with Mollie's cancel endpoint while Mollie says it can (`isCancelable`). The module returns a payment that is already `canceled` or `expired` as it is, so a repeated cancellation is harmless. Any other payment rejects with `InvalidPaymentStateError`.
|
|
141
|
+
|
|
142
|
+
An `authorized` payment is released, after the module has read its captures. Mollie reports a payment `authorized` until it applies the capture it has accepted, so a capture in flight makes `CancelPayment` reject with `InvalidPaymentStateError`, `status` `pending`, and nothing reaches Mollie. Once the capture has settled, the payment is `succeeded` and refunding it is the way back.
|
|
143
|
+
|
|
144
|
+
## Errors
|
|
145
|
+
|
|
146
|
+
- **Not found.** The module reports Mollie's 404, Mollie's 410 for a deleted customer, and an identifier of the wrong shape, as not found. A payment or checkout session created for a deleted customer, or for a saved method of one, rejects with `CustomerNotFoundError` for the customer, never `PaymentNotFoundError` for a payment nobody named.
|
|
147
|
+
- **State errors.** `InvalidPaymentStateError` comes only from the module's own reading of the payment. Examples are capturing what is not authorized or already has a capture, refunding what is not paid or more than remains, and cancelling what has settled. The module never reads a refusal from Mollie as a state error. Mollie answers 422 for a request it will not process, and, per its documentation, also when the account's payment services are suspended. A 422 is a `PaymentError`, so the module never reports an account problem as "this payment cannot be refunded".
|
|
148
|
+
- **A capture refused with 422.** Mollie also answers 422 to a capture of a payment that already has one, made by another caller after the module read the payment. The module then reads the payment and its captures again. A capture under another key, or a payment that is no longer `authorized`, is an `InvalidPaymentStateError`. A capture under the caller's key is returned as a replay. Otherwise the 422 stays a `PaymentError`.
|
|
149
|
+
- **A capture Mollie failed.** A `PaymentError` with `providerCode` `capture_failed` (see [Captures settle after the call](#captures-settle-after-the-call)).
|
|
150
|
+
- **Everything else.** A 401, a 429, a 5xx or a network failure is a `PaymentError`, except on the reads `CapturePayment` makes after Mollie has accepted the capture. Its `providerCode` carries the HTTP status, and the field Mollie names when there is one.
|
|
151
|
+
|
|
152
|
+
## Idempotency
|
|
153
|
+
|
|
154
|
+
Mollie honours `Idempotency-Key` on every POST for **one hour**, and answers 400 when a caller reuses a key with other parameters (Mollie: _API idempotency_).
|
|
155
|
+
|
|
156
|
+
- `RefundPayment` and `CapturePayment` replay at any time. A key reused with other parameters returns the earlier result instead of Mollie's 400. The module stores the key in the refund's or capture's own metadata, and each call first looks among the payment's refunds or captures for one made under that key. A replay returns the original refund, or the payment with the original capture, followed as a new capture is. That holds even after the payment's state no longer allows the operation, and even after Mollie has forgotten the key. A partial refund replayed after the hour does not refund twice.
|
|
157
|
+
- `CreatePayment`, `CreateCheckoutSession`, `CreateCustomer` and a release replay within the hour, through Mollie's own key handling. After the hour, Mollie treats the key as new. That is Mollie's limit, and the module does not widen it for these calls.
|
|
158
|
+
- `CreateSubscription` replays at any time (see [Subscriptions](./4.subscriptions.md)).
|
|
159
|
+
|
|
160
|
+
Mollie ignores the key on DELETE. Cancelling a payment, deleting a customer and detaching a method are DELETEs. A repeated cancellation returns the cancelled payment, while a repeated deletion or detachment reports the record as not found.
|