@delopay/sdk 0.138.0 → 0.140.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/dist/index.cjs CHANGED
@@ -1972,6 +1972,45 @@ var Payments = class {
1972
1972
  options
1973
1973
  );
1974
1974
  }
1975
+ /**
1976
+ * The routing decision recorded behind each attempt of a payment: which rule
1977
+ * matched, which candidates routing produced and which filter removed each,
1978
+ * which volume bucket was drawn and what the counters read, which
1979
+ * configuration version was live.
1980
+ *
1981
+ * This is the only truthful account of **how the connector was chosen**.
1982
+ * `routing_approach` on the payment is seeded on creation and several paths —
1983
+ * mandate, pre-routed and pinned-account among them — return before it is
1984
+ * overwritten, so it can still read `default_fallback` on a payment that was
1985
+ * routed by a rule. Read {@link RoutingDecision.decision_kind} instead.
1986
+ *
1987
+ * An attempt with `decision: null` simply has no record: the recorder is
1988
+ * best-effort, attempts that never reached routing have nothing to record,
1989
+ * and attempts predating the record exist in quantity. It is not an error.
1990
+ *
1991
+ * `GET /payments/{paymentId}/routing-decisions`
1992
+ *
1993
+ * @param paymentId - The payment intent ID.
1994
+ * @param options - Optional per-call extras: extra `headers`, a `timeout`
1995
+ * override, and an `AbortSignal`.
1996
+ * @returns Every attempt returned for this payment, with its decision.
1997
+ *
1998
+ * @example
1999
+ * ```typescript
2000
+ * const { attempts } = await delopay.payments.routingDecisions('pay_abc123');
2001
+ * for (const attempt of attempts) {
2002
+ * if (!attempt.decision) continue;
2003
+ * console.log(attempt.connector, attempt.decision.decision_kind);
2004
+ * }
2005
+ * ```
2006
+ */
2007
+ async routingDecisions(paymentId, options) {
2008
+ return this.request(
2009
+ "GET",
2010
+ `/payments/${encodeURIComponent(paymentId)}/routing-decisions`,
2011
+ options
2012
+ );
2013
+ }
1975
2014
  /**
1976
2015
  * Soft-delete a payment. Only payments whose status is in the merchant's
1977
2016
  * delete policy (see {@link Payments.getDeletePolicy}) can be deleted;
@@ -5682,7 +5721,12 @@ var SURCHARGE_POSITIONS = [
5682
5721
  "cornerStart",
5683
5722
  "cornerEnd"
5684
5723
  ];
5685
- var NATIVE_ELEMENT_POSITIONS = ["top", "bottom"];
5724
+ var NATIVE_ELEMENT_POSITIONS = [
5725
+ "top",
5726
+ "belowFields",
5727
+ "belowCard",
5728
+ "bottom"
5729
+ ];
5686
5730
  var SURCHARGE_STYLES = [
5687
5731
  "plain",
5688
5732
  "underline",
@@ -6098,6 +6142,8 @@ var DEFAULT_BRANDING_BASE = {
6098
6142
  // The button is the surface a buyer recognises fastest; it leads its section
6099
6143
  // unless the merchant says otherwise.
6100
6144
  nativeElementPosition: "top",
6145
+ // Side by side — see the field.
6146
+ nativeElementStacked: false,
6101
6147
  surchargeStyle: "badge",
6102
6148
  surchargeSize: "sm",
6103
6149
  surchargeShape: "pill",
@@ -6165,6 +6211,8 @@ var DEFAULT_BRANDING_BASE = {
6165
6211
  airwallexCardPreset: "",
6166
6212
  // Off. With this on, no buyer can pay by card on the shop.
6167
6213
  airwallexHideCard: false,
6214
+ // Off: the section is named, like every other section on the surface.
6215
+ airwallexHideCardTitle: false,
6168
6216
  airwallexFieldChrome: "outlined",
6169
6217
  airwallexLabelStyle: "",
6170
6218
  airwallexFieldFontSize: "md",
@@ -6761,6 +6809,10 @@ function decodeBranding(source) {
6761
6809
  SURCHARGE_POSITIONS,
6762
6810
  DEFAULT_BRANDING.surchargePosition
6763
6811
  ),
6812
+ nativeElementStacked: parseBool(
6813
+ extras["nativeElementStacked"],
6814
+ DEFAULT_BRANDING.nativeElementStacked
6815
+ ),
6764
6816
  nativeElementPosition: pickEnum(
6765
6817
  extras["nativeElementPosition"],
6766
6818
  NATIVE_ELEMENT_POSITIONS,
@@ -6866,6 +6918,10 @@ function decodeBranding(source) {
6866
6918
  AIRWALLEX_CARD_PRESETS
6867
6919
  ),
6868
6920
  airwallexHideCard: parseBool(extras["airwallexHideCard"], DEFAULT_BRANDING.airwallexHideCard),
6921
+ airwallexHideCardTitle: parseBool(
6922
+ extras["airwallexHideCardTitle"],
6923
+ DEFAULT_BRANDING.airwallexHideCardTitle
6924
+ ),
6869
6925
  airwallexFieldChrome: pickEnum(
6870
6926
  extras["airwallexFieldChrome"],
6871
6927
  AIRWALLEX_FIELD_CHROMES,
@@ -6933,6 +6989,7 @@ function encodeBranding(branding, base) {
6933
6989
  showSurcharge: String(branding.showSurcharge),
6934
6990
  surchargePosition: branding.surchargePosition,
6935
6991
  nativeElementPosition: branding.nativeElementPosition,
6992
+ nativeElementStacked: String(branding.nativeElementStacked),
6936
6993
  surchargeStyle: branding.surchargeStyle,
6937
6994
  surchargeSize: branding.surchargeSize,
6938
6995
  surchargeShape: branding.surchargeShape,
@@ -6965,6 +7022,7 @@ function encodeBranding(branding, base) {
6965
7022
  // by accident, which is how `summaryOrder` was lost.
6966
7023
  airwallexCardPreset: branding.airwallexCardPreset,
6967
7024
  airwallexHideCard: String(branding.airwallexHideCard),
7025
+ airwallexHideCardTitle: String(branding.airwallexHideCardTitle),
6968
7026
  airwallexFieldChrome: branding.airwallexFieldChrome,
6969
7027
  airwallexLabelStyle: branding.airwallexLabelStyle,
6970
7028
  airwallexFieldFontSize: branding.airwallexFieldFontSize,
@@ -7106,6 +7164,7 @@ function parseImportedBranding(raw) {
7106
7164
  SURCHARGE_POSITIONS,
7107
7165
  dflt.surchargePosition
7108
7166
  ),
7167
+ nativeElementStacked: parseBool(root["nativeElementStacked"], dflt.nativeElementStacked),
7109
7168
  nativeElementPosition: pickEnum(
7110
7169
  root["nativeElementPosition"],
7111
7170
  NATIVE_ELEMENT_POSITIONS,
@@ -7210,6 +7269,7 @@ function parseImportedBranding(raw) {
7210
7269
  AIRWALLEX_CARD_PRESETS
7211
7270
  ),
7212
7271
  airwallexHideCard: parseBool(root["airwallexHideCard"], dflt.airwallexHideCard),
7272
+ airwallexHideCardTitle: parseBool(root["airwallexHideCardTitle"], dflt.airwallexHideCardTitle),
7213
7273
  airwallexFieldChrome: pickEnum(
7214
7274
  root["airwallexFieldChrome"],
7215
7275
  AIRWALLEX_FIELD_CHROMES,