@delopay/sdk 0.139.0 → 0.141.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/README.md +7 -2
- package/dist/{chunk-OMJ6MVD4.js → chunk-YZABVF2X.js} +66 -2
- package/dist/chunk-YZABVF2X.js.map +1 -0
- package/dist/index.cjs +66 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +366 -4
- package/dist/index.d.ts +366 -4
- package/dist/index.js +3 -1
- package/dist/internal.cjs +66 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +3 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-OMJ6MVD4.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -157,6 +157,7 @@ __export(index_exports, {
|
|
|
157
157
|
isCheckboxChecked: () => isCheckboxChecked,
|
|
158
158
|
isDarkSurface: () => isDarkSurface,
|
|
159
159
|
isHexColor: () => isHexColor,
|
|
160
|
+
isSubscriptionLifecycleWebhook: () => isSubscriptionLifecycleWebhook,
|
|
160
161
|
knownSectionLabelKey: () => knownSectionLabelKey,
|
|
161
162
|
leaf: () => leaf,
|
|
162
163
|
logoDimensions: () => logoDimensions,
|
|
@@ -1972,6 +1973,45 @@ var Payments = class {
|
|
|
1972
1973
|
options
|
|
1973
1974
|
);
|
|
1974
1975
|
}
|
|
1976
|
+
/**
|
|
1977
|
+
* The routing decision recorded behind each attempt of a payment: which rule
|
|
1978
|
+
* matched, which candidates routing produced and which filter removed each,
|
|
1979
|
+
* which volume bucket was drawn and what the counters read, which
|
|
1980
|
+
* configuration version was live.
|
|
1981
|
+
*
|
|
1982
|
+
* This is the only truthful account of **how the connector was chosen**.
|
|
1983
|
+
* `routing_approach` on the payment is seeded on creation and several paths —
|
|
1984
|
+
* mandate, pre-routed and pinned-account among them — return before it is
|
|
1985
|
+
* overwritten, so it can still read `default_fallback` on a payment that was
|
|
1986
|
+
* routed by a rule. Read {@link RoutingDecision.decision_kind} instead.
|
|
1987
|
+
*
|
|
1988
|
+
* An attempt with `decision: null` simply has no record: the recorder is
|
|
1989
|
+
* best-effort, attempts that never reached routing have nothing to record,
|
|
1990
|
+
* and attempts predating the record exist in quantity. It is not an error.
|
|
1991
|
+
*
|
|
1992
|
+
* `GET /payments/{paymentId}/routing-decisions`
|
|
1993
|
+
*
|
|
1994
|
+
* @param paymentId - The payment intent ID.
|
|
1995
|
+
* @param options - Optional per-call extras: extra `headers`, a `timeout`
|
|
1996
|
+
* override, and an `AbortSignal`.
|
|
1997
|
+
* @returns Every attempt returned for this payment, with its decision.
|
|
1998
|
+
*
|
|
1999
|
+
* @example
|
|
2000
|
+
* ```typescript
|
|
2001
|
+
* const { attempts } = await delopay.payments.routingDecisions('pay_abc123');
|
|
2002
|
+
* for (const attempt of attempts) {
|
|
2003
|
+
* if (!attempt.decision) continue;
|
|
2004
|
+
* console.log(attempt.connector, attempt.decision.decision_kind);
|
|
2005
|
+
* }
|
|
2006
|
+
* ```
|
|
2007
|
+
*/
|
|
2008
|
+
async routingDecisions(paymentId, options) {
|
|
2009
|
+
return this.request(
|
|
2010
|
+
"GET",
|
|
2011
|
+
`/payments/${encodeURIComponent(paymentId)}/routing-decisions`,
|
|
2012
|
+
options
|
|
2013
|
+
);
|
|
2014
|
+
}
|
|
1975
2015
|
/**
|
|
1976
2016
|
* Soft-delete a payment. Only payments whose status is in the merchant's
|
|
1977
2017
|
* delete policy (see {@link Payments.getDeletePolicy}) can be deleted;
|
|
@@ -3818,6 +3858,9 @@ var Verification = class {
|
|
|
3818
3858
|
};
|
|
3819
3859
|
|
|
3820
3860
|
// src/resources/webhooks.ts
|
|
3861
|
+
function isSubscriptionLifecycleWebhook(object) {
|
|
3862
|
+
return typeof object.transition_id === "string";
|
|
3863
|
+
}
|
|
3821
3864
|
function hexToBytes(hex) {
|
|
3822
3865
|
if (hex.length === 0 || hex.length % 2 !== 0) return null;
|
|
3823
3866
|
const bytes = new Uint8Array(hex.length / 2);
|
|
@@ -5682,7 +5725,12 @@ var SURCHARGE_POSITIONS = [
|
|
|
5682
5725
|
"cornerStart",
|
|
5683
5726
|
"cornerEnd"
|
|
5684
5727
|
];
|
|
5685
|
-
var NATIVE_ELEMENT_POSITIONS = [
|
|
5728
|
+
var NATIVE_ELEMENT_POSITIONS = [
|
|
5729
|
+
"top",
|
|
5730
|
+
"belowFields",
|
|
5731
|
+
"belowCard",
|
|
5732
|
+
"bottom"
|
|
5733
|
+
];
|
|
5686
5734
|
var SURCHARGE_STYLES = [
|
|
5687
5735
|
"plain",
|
|
5688
5736
|
"underline",
|
|
@@ -6098,6 +6146,8 @@ var DEFAULT_BRANDING_BASE = {
|
|
|
6098
6146
|
// The button is the surface a buyer recognises fastest; it leads its section
|
|
6099
6147
|
// unless the merchant says otherwise.
|
|
6100
6148
|
nativeElementPosition: "top",
|
|
6149
|
+
// Side by side — see the field.
|
|
6150
|
+
nativeElementStacked: false,
|
|
6101
6151
|
surchargeStyle: "badge",
|
|
6102
6152
|
surchargeSize: "sm",
|
|
6103
6153
|
surchargeShape: "pill",
|
|
@@ -6165,6 +6215,8 @@ var DEFAULT_BRANDING_BASE = {
|
|
|
6165
6215
|
airwallexCardPreset: "",
|
|
6166
6216
|
// Off. With this on, no buyer can pay by card on the shop.
|
|
6167
6217
|
airwallexHideCard: false,
|
|
6218
|
+
// Off: the section is named, like every other section on the surface.
|
|
6219
|
+
airwallexHideCardTitle: false,
|
|
6168
6220
|
airwallexFieldChrome: "outlined",
|
|
6169
6221
|
airwallexLabelStyle: "",
|
|
6170
6222
|
airwallexFieldFontSize: "md",
|
|
@@ -6761,6 +6813,10 @@ function decodeBranding(source) {
|
|
|
6761
6813
|
SURCHARGE_POSITIONS,
|
|
6762
6814
|
DEFAULT_BRANDING.surchargePosition
|
|
6763
6815
|
),
|
|
6816
|
+
nativeElementStacked: parseBool(
|
|
6817
|
+
extras["nativeElementStacked"],
|
|
6818
|
+
DEFAULT_BRANDING.nativeElementStacked
|
|
6819
|
+
),
|
|
6764
6820
|
nativeElementPosition: pickEnum(
|
|
6765
6821
|
extras["nativeElementPosition"],
|
|
6766
6822
|
NATIVE_ELEMENT_POSITIONS,
|
|
@@ -6866,6 +6922,10 @@ function decodeBranding(source) {
|
|
|
6866
6922
|
AIRWALLEX_CARD_PRESETS
|
|
6867
6923
|
),
|
|
6868
6924
|
airwallexHideCard: parseBool(extras["airwallexHideCard"], DEFAULT_BRANDING.airwallexHideCard),
|
|
6925
|
+
airwallexHideCardTitle: parseBool(
|
|
6926
|
+
extras["airwallexHideCardTitle"],
|
|
6927
|
+
DEFAULT_BRANDING.airwallexHideCardTitle
|
|
6928
|
+
),
|
|
6869
6929
|
airwallexFieldChrome: pickEnum(
|
|
6870
6930
|
extras["airwallexFieldChrome"],
|
|
6871
6931
|
AIRWALLEX_FIELD_CHROMES,
|
|
@@ -6933,6 +6993,7 @@ function encodeBranding(branding, base) {
|
|
|
6933
6993
|
showSurcharge: String(branding.showSurcharge),
|
|
6934
6994
|
surchargePosition: branding.surchargePosition,
|
|
6935
6995
|
nativeElementPosition: branding.nativeElementPosition,
|
|
6996
|
+
nativeElementStacked: String(branding.nativeElementStacked),
|
|
6936
6997
|
surchargeStyle: branding.surchargeStyle,
|
|
6937
6998
|
surchargeSize: branding.surchargeSize,
|
|
6938
6999
|
surchargeShape: branding.surchargeShape,
|
|
@@ -6965,6 +7026,7 @@ function encodeBranding(branding, base) {
|
|
|
6965
7026
|
// by accident, which is how `summaryOrder` was lost.
|
|
6966
7027
|
airwallexCardPreset: branding.airwallexCardPreset,
|
|
6967
7028
|
airwallexHideCard: String(branding.airwallexHideCard),
|
|
7029
|
+
airwallexHideCardTitle: String(branding.airwallexHideCardTitle),
|
|
6968
7030
|
airwallexFieldChrome: branding.airwallexFieldChrome,
|
|
6969
7031
|
airwallexLabelStyle: branding.airwallexLabelStyle,
|
|
6970
7032
|
airwallexFieldFontSize: branding.airwallexFieldFontSize,
|
|
@@ -7106,6 +7168,7 @@ function parseImportedBranding(raw) {
|
|
|
7106
7168
|
SURCHARGE_POSITIONS,
|
|
7107
7169
|
dflt.surchargePosition
|
|
7108
7170
|
),
|
|
7171
|
+
nativeElementStacked: parseBool(root["nativeElementStacked"], dflt.nativeElementStacked),
|
|
7109
7172
|
nativeElementPosition: pickEnum(
|
|
7110
7173
|
root["nativeElementPosition"],
|
|
7111
7174
|
NATIVE_ELEMENT_POSITIONS,
|
|
@@ -7210,6 +7273,7 @@ function parseImportedBranding(raw) {
|
|
|
7210
7273
|
AIRWALLEX_CARD_PRESETS
|
|
7211
7274
|
),
|
|
7212
7275
|
airwallexHideCard: parseBool(root["airwallexHideCard"], dflt.airwallexHideCard),
|
|
7276
|
+
airwallexHideCardTitle: parseBool(root["airwallexHideCardTitle"], dflt.airwallexHideCardTitle),
|
|
7213
7277
|
airwallexFieldChrome: pickEnum(
|
|
7214
7278
|
root["airwallexFieldChrome"],
|
|
7215
7279
|
AIRWALLEX_FIELD_CHROMES,
|
|
@@ -8216,6 +8280,7 @@ var encodeNativePanes = encodePanes;
|
|
|
8216
8280
|
isCheckboxChecked,
|
|
8217
8281
|
isDarkSurface,
|
|
8218
8282
|
isHexColor,
|
|
8283
|
+
isSubscriptionLifecycleWebhook,
|
|
8219
8284
|
knownSectionLabelKey,
|
|
8220
8285
|
leaf,
|
|
8221
8286
|
logoDimensions,
|