@delopay/sdk 0.234.0 → 0.235.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
@@ -11569,6 +11569,21 @@ function withoutCredentialHeaders(extra) {
11569
11569
  }
11570
11570
  return out;
11571
11571
  }
11572
+ function vaultFormQuery(params) {
11573
+ const look = params?.appearance;
11574
+ return {
11575
+ locale: params?.locale,
11576
+ form_surface: look?.surface,
11577
+ form_text: look?.text,
11578
+ form_border: look?.border,
11579
+ form_accent: look?.accent,
11580
+ form_danger: look?.danger,
11581
+ form_font: look?.font,
11582
+ form_radius: look?.radius,
11583
+ form_size: look?.size,
11584
+ form_labels: look?.labels
11585
+ };
11586
+ }
11572
11587
  function withoutHeader(headers, name) {
11573
11588
  const out = {};
11574
11589
  for (const [key, value] of Object.entries(headers)) {
@@ -11988,21 +12003,31 @@ var CheckoutSession = class {
11988
12003
  * `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
11989
12004
  */
11990
12005
  async vaultCollectSession(options, params) {
11991
- const look = params?.appearance;
11992
12006
  return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
11993
12007
  ...options,
11994
- query: {
11995
- locale: params?.locale,
11996
- form_surface: look?.surface,
11997
- form_text: look?.text,
11998
- form_border: look?.border,
11999
- form_accent: look?.accent,
12000
- form_danger: look?.danger,
12001
- form_font: look?.font,
12002
- form_radius: look?.radius,
12003
- form_size: look?.size,
12004
- form_labels: look?.labels
12005
- },
12008
+ query: vaultFormQuery(params),
12009
+ headers: this.bearerHeaders(options?.headers)
12010
+ });
12011
+ }
12012
+ /**
12013
+ * The saved cards the buyer of this payment can pay with, on a shop whose
12014
+ * vault keeps the security code itself (Enigma Vault): the cards of the
12015
+ * payment's own customer that the shop's vault holds, most recently used
12016
+ * first. A payment without a customer answers an empty list.
12017
+ *
12018
+ * Draw saved cards from this list, not from the customer's payment-method
12019
+ * list: that one also carries cards the security-code form cannot open.
12020
+ * To pay with one, mint its form with {@link vaultSecurityCodeSession},
12021
+ * and confirm with its `payment_token` once the form reports the code
12022
+ * stored.
12023
+ *
12024
+ * A shop without a vault, and a VGS shop, answer `400`.
12025
+ *
12026
+ * `GET /payment-link/{merchantId}/{paymentId}/vault/saved-cards`
12027
+ */
12028
+ async vaultSavedCards(options) {
12029
+ return this.client.request("GET", `${this.linkBase}/vault/saved-cards`, {
12030
+ ...options,
12006
12031
  headers: this.bearerHeaders(options?.headers)
12007
12032
  });
12008
12033
  }
@@ -12012,15 +12037,24 @@ var CheckoutSession = class {
12012
12037
  * vault's own form, so it never reaches the checkout; confirm with the saved
12013
12038
  * card's `payment_token` once the form reports it stored.
12014
12039
  *
12015
- * `paymentToken` is the saved card's token from the payment-method list. A
12040
+ * `paymentToken` is the saved card's token from {@link vaultSavedCards}. A
12016
12041
  * VGS shop answers `400`: VGS re-collects the code with Collect.
12017
12042
  *
12043
+ * `params.appearance` asks for a form styled to match the page, as on
12044
+ * {@link vaultCollectSession}. The styled form is the security-code field
12045
+ * alone, with no label: draw the label beside the frame, and size the frame
12046
+ * to the answer's `height`. `labels` is ignored. If the vault refuses the
12047
+ * styled form the answer is the plain one, without `height`.
12048
+ *
12049
+ * The form stores one code and then disables itself. After a failed
12050
+ * payment, mint a new form before the buyer tries again.
12051
+ *
12018
12052
  * `GET /payment-link/{merchantId}/{paymentId}/vault/security-code-session`
12019
12053
  */
12020
- async vaultSecurityCodeSession(paymentToken, options) {
12054
+ async vaultSecurityCodeSession(paymentToken, options, params) {
12021
12055
  return this.client.request("GET", `${this.linkBase}/vault/security-code-session`, {
12022
12056
  ...options,
12023
- query: { payment_token: paymentToken },
12057
+ query: { payment_token: paymentToken, ...vaultFormQuery(params) },
12024
12058
  headers: this.bearerHeaders(options?.headers)
12025
12059
  });
12026
12060
  }