@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/internal.cjs
CHANGED
|
@@ -170,6 +170,7 @@ __export(internal_exports, {
|
|
|
170
170
|
isCheckboxChecked: () => isCheckboxChecked,
|
|
171
171
|
isDarkSurface: () => isDarkSurface,
|
|
172
172
|
isHexColor: () => isHexColor,
|
|
173
|
+
isSubscriptionLifecycleWebhook: () => isSubscriptionLifecycleWebhook,
|
|
173
174
|
knownSectionLabelKey: () => knownSectionLabelKey,
|
|
174
175
|
leaf: () => leaf,
|
|
175
176
|
logoDimensions: () => logoDimensions,
|
|
@@ -1985,6 +1986,45 @@ var Payments = class {
|
|
|
1985
1986
|
options
|
|
1986
1987
|
);
|
|
1987
1988
|
}
|
|
1989
|
+
/**
|
|
1990
|
+
* The routing decision recorded behind each attempt of a payment: which rule
|
|
1991
|
+
* matched, which candidates routing produced and which filter removed each,
|
|
1992
|
+
* which volume bucket was drawn and what the counters read, which
|
|
1993
|
+
* configuration version was live.
|
|
1994
|
+
*
|
|
1995
|
+
* This is the only truthful account of **how the connector was chosen**.
|
|
1996
|
+
* `routing_approach` on the payment is seeded on creation and several paths —
|
|
1997
|
+
* mandate, pre-routed and pinned-account among them — return before it is
|
|
1998
|
+
* overwritten, so it can still read `default_fallback` on a payment that was
|
|
1999
|
+
* routed by a rule. Read {@link RoutingDecision.decision_kind} instead.
|
|
2000
|
+
*
|
|
2001
|
+
* An attempt with `decision: null` simply has no record: the recorder is
|
|
2002
|
+
* best-effort, attempts that never reached routing have nothing to record,
|
|
2003
|
+
* and attempts predating the record exist in quantity. It is not an error.
|
|
2004
|
+
*
|
|
2005
|
+
* `GET /payments/{paymentId}/routing-decisions`
|
|
2006
|
+
*
|
|
2007
|
+
* @param paymentId - The payment intent ID.
|
|
2008
|
+
* @param options - Optional per-call extras: extra `headers`, a `timeout`
|
|
2009
|
+
* override, and an `AbortSignal`.
|
|
2010
|
+
* @returns Every attempt returned for this payment, with its decision.
|
|
2011
|
+
*
|
|
2012
|
+
* @example
|
|
2013
|
+
* ```typescript
|
|
2014
|
+
* const { attempts } = await delopay.payments.routingDecisions('pay_abc123');
|
|
2015
|
+
* for (const attempt of attempts) {
|
|
2016
|
+
* if (!attempt.decision) continue;
|
|
2017
|
+
* console.log(attempt.connector, attempt.decision.decision_kind);
|
|
2018
|
+
* }
|
|
2019
|
+
* ```
|
|
2020
|
+
*/
|
|
2021
|
+
async routingDecisions(paymentId, options) {
|
|
2022
|
+
return this.request(
|
|
2023
|
+
"GET",
|
|
2024
|
+
`/payments/${encodeURIComponent(paymentId)}/routing-decisions`,
|
|
2025
|
+
options
|
|
2026
|
+
);
|
|
2027
|
+
}
|
|
1988
2028
|
/**
|
|
1989
2029
|
* Soft-delete a payment. Only payments whose status is in the merchant's
|
|
1990
2030
|
* delete policy (see {@link Payments.getDeletePolicy}) can be deleted;
|
|
@@ -3831,6 +3871,9 @@ var Verification = class {
|
|
|
3831
3871
|
};
|
|
3832
3872
|
|
|
3833
3873
|
// src/resources/webhooks.ts
|
|
3874
|
+
function isSubscriptionLifecycleWebhook(object) {
|
|
3875
|
+
return typeof object.transition_id === "string";
|
|
3876
|
+
}
|
|
3834
3877
|
function hexToBytes(hex) {
|
|
3835
3878
|
if (hex.length === 0 || hex.length % 2 !== 0) return null;
|
|
3836
3879
|
const bytes = new Uint8Array(hex.length / 2);
|
|
@@ -5695,7 +5738,12 @@ var SURCHARGE_POSITIONS = [
|
|
|
5695
5738
|
"cornerStart",
|
|
5696
5739
|
"cornerEnd"
|
|
5697
5740
|
];
|
|
5698
|
-
var NATIVE_ELEMENT_POSITIONS = [
|
|
5741
|
+
var NATIVE_ELEMENT_POSITIONS = [
|
|
5742
|
+
"top",
|
|
5743
|
+
"belowFields",
|
|
5744
|
+
"belowCard",
|
|
5745
|
+
"bottom"
|
|
5746
|
+
];
|
|
5699
5747
|
var SURCHARGE_STYLES = [
|
|
5700
5748
|
"plain",
|
|
5701
5749
|
"underline",
|
|
@@ -6111,6 +6159,8 @@ var DEFAULT_BRANDING_BASE = {
|
|
|
6111
6159
|
// The button is the surface a buyer recognises fastest; it leads its section
|
|
6112
6160
|
// unless the merchant says otherwise.
|
|
6113
6161
|
nativeElementPosition: "top",
|
|
6162
|
+
// Side by side — see the field.
|
|
6163
|
+
nativeElementStacked: false,
|
|
6114
6164
|
surchargeStyle: "badge",
|
|
6115
6165
|
surchargeSize: "sm",
|
|
6116
6166
|
surchargeShape: "pill",
|
|
@@ -6178,6 +6228,8 @@ var DEFAULT_BRANDING_BASE = {
|
|
|
6178
6228
|
airwallexCardPreset: "",
|
|
6179
6229
|
// Off. With this on, no buyer can pay by card on the shop.
|
|
6180
6230
|
airwallexHideCard: false,
|
|
6231
|
+
// Off: the section is named, like every other section on the surface.
|
|
6232
|
+
airwallexHideCardTitle: false,
|
|
6181
6233
|
airwallexFieldChrome: "outlined",
|
|
6182
6234
|
airwallexLabelStyle: "",
|
|
6183
6235
|
airwallexFieldFontSize: "md",
|
|
@@ -6774,6 +6826,10 @@ function decodeBranding(source) {
|
|
|
6774
6826
|
SURCHARGE_POSITIONS,
|
|
6775
6827
|
DEFAULT_BRANDING.surchargePosition
|
|
6776
6828
|
),
|
|
6829
|
+
nativeElementStacked: parseBool(
|
|
6830
|
+
extras["nativeElementStacked"],
|
|
6831
|
+
DEFAULT_BRANDING.nativeElementStacked
|
|
6832
|
+
),
|
|
6777
6833
|
nativeElementPosition: pickEnum(
|
|
6778
6834
|
extras["nativeElementPosition"],
|
|
6779
6835
|
NATIVE_ELEMENT_POSITIONS,
|
|
@@ -6879,6 +6935,10 @@ function decodeBranding(source) {
|
|
|
6879
6935
|
AIRWALLEX_CARD_PRESETS
|
|
6880
6936
|
),
|
|
6881
6937
|
airwallexHideCard: parseBool(extras["airwallexHideCard"], DEFAULT_BRANDING.airwallexHideCard),
|
|
6938
|
+
airwallexHideCardTitle: parseBool(
|
|
6939
|
+
extras["airwallexHideCardTitle"],
|
|
6940
|
+
DEFAULT_BRANDING.airwallexHideCardTitle
|
|
6941
|
+
),
|
|
6882
6942
|
airwallexFieldChrome: pickEnum(
|
|
6883
6943
|
extras["airwallexFieldChrome"],
|
|
6884
6944
|
AIRWALLEX_FIELD_CHROMES,
|
|
@@ -6946,6 +7006,7 @@ function encodeBranding(branding, base) {
|
|
|
6946
7006
|
showSurcharge: String(branding.showSurcharge),
|
|
6947
7007
|
surchargePosition: branding.surchargePosition,
|
|
6948
7008
|
nativeElementPosition: branding.nativeElementPosition,
|
|
7009
|
+
nativeElementStacked: String(branding.nativeElementStacked),
|
|
6949
7010
|
surchargeStyle: branding.surchargeStyle,
|
|
6950
7011
|
surchargeSize: branding.surchargeSize,
|
|
6951
7012
|
surchargeShape: branding.surchargeShape,
|
|
@@ -6978,6 +7039,7 @@ function encodeBranding(branding, base) {
|
|
|
6978
7039
|
// by accident, which is how `summaryOrder` was lost.
|
|
6979
7040
|
airwallexCardPreset: branding.airwallexCardPreset,
|
|
6980
7041
|
airwallexHideCard: String(branding.airwallexHideCard),
|
|
7042
|
+
airwallexHideCardTitle: String(branding.airwallexHideCardTitle),
|
|
6981
7043
|
airwallexFieldChrome: branding.airwallexFieldChrome,
|
|
6982
7044
|
airwallexLabelStyle: branding.airwallexLabelStyle,
|
|
6983
7045
|
airwallexFieldFontSize: branding.airwallexFieldFontSize,
|
|
@@ -7119,6 +7181,7 @@ function parseImportedBranding(raw) {
|
|
|
7119
7181
|
SURCHARGE_POSITIONS,
|
|
7120
7182
|
dflt.surchargePosition
|
|
7121
7183
|
),
|
|
7184
|
+
nativeElementStacked: parseBool(root["nativeElementStacked"], dflt.nativeElementStacked),
|
|
7122
7185
|
nativeElementPosition: pickEnum(
|
|
7123
7186
|
root["nativeElementPosition"],
|
|
7124
7187
|
NATIVE_ELEMENT_POSITIONS,
|
|
@@ -7223,6 +7286,7 @@ function parseImportedBranding(raw) {
|
|
|
7223
7286
|
AIRWALLEX_CARD_PRESETS
|
|
7224
7287
|
),
|
|
7225
7288
|
airwallexHideCard: parseBool(root["airwallexHideCard"], dflt.airwallexHideCard),
|
|
7289
|
+
airwallexHideCardTitle: parseBool(root["airwallexHideCardTitle"], dflt.airwallexHideCardTitle),
|
|
7226
7290
|
airwallexFieldChrome: pickEnum(
|
|
7227
7291
|
root["airwallexFieldChrome"],
|
|
7228
7292
|
AIRWALLEX_FIELD_CHROMES,
|
|
@@ -9435,6 +9499,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
9435
9499
|
isCheckboxChecked,
|
|
9436
9500
|
isDarkSurface,
|
|
9437
9501
|
isHexColor,
|
|
9502
|
+
isSubscriptionLifecycleWebhook,
|
|
9438
9503
|
knownSectionLabelKey,
|
|
9439
9504
|
leaf,
|
|
9440
9505
|
logoDimensions,
|