@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/internal.cjs CHANGED
@@ -11585,6 +11585,21 @@ function withoutCredentialHeaders(extra) {
11585
11585
  }
11586
11586
  return out;
11587
11587
  }
11588
+ function vaultFormQuery(params) {
11589
+ const look = params?.appearance;
11590
+ return {
11591
+ locale: params?.locale,
11592
+ form_surface: look?.surface,
11593
+ form_text: look?.text,
11594
+ form_border: look?.border,
11595
+ form_accent: look?.accent,
11596
+ form_danger: look?.danger,
11597
+ form_font: look?.font,
11598
+ form_radius: look?.radius,
11599
+ form_size: look?.size,
11600
+ form_labels: look?.labels
11601
+ };
11602
+ }
11588
11603
  function withoutHeader(headers, name) {
11589
11604
  const out = {};
11590
11605
  for (const [key, value] of Object.entries(headers)) {
@@ -12004,21 +12019,31 @@ var CheckoutSession = class {
12004
12019
  * `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
12005
12020
  */
12006
12021
  async vaultCollectSession(options, params) {
12007
- const look = params?.appearance;
12008
12022
  return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
12009
12023
  ...options,
12010
- query: {
12011
- locale: params?.locale,
12012
- form_surface: look?.surface,
12013
- form_text: look?.text,
12014
- form_border: look?.border,
12015
- form_accent: look?.accent,
12016
- form_danger: look?.danger,
12017
- form_font: look?.font,
12018
- form_radius: look?.radius,
12019
- form_size: look?.size,
12020
- form_labels: look?.labels
12021
- },
12024
+ query: vaultFormQuery(params),
12025
+ headers: this.bearerHeaders(options?.headers)
12026
+ });
12027
+ }
12028
+ /**
12029
+ * The saved cards the buyer of this payment can pay with, on a shop whose
12030
+ * vault keeps the security code itself (Enigma Vault): the cards of the
12031
+ * payment's own customer that the shop's vault holds, most recently used
12032
+ * first. A payment without a customer answers an empty list.
12033
+ *
12034
+ * Draw saved cards from this list, not from the customer's payment-method
12035
+ * list: that one also carries cards the security-code form cannot open.
12036
+ * To pay with one, mint its form with {@link vaultSecurityCodeSession},
12037
+ * and confirm with its `payment_token` once the form reports the code
12038
+ * stored.
12039
+ *
12040
+ * A shop without a vault, and a VGS shop, answer `400`.
12041
+ *
12042
+ * `GET /payment-link/{merchantId}/{paymentId}/vault/saved-cards`
12043
+ */
12044
+ async vaultSavedCards(options) {
12045
+ return this.client.request("GET", `${this.linkBase}/vault/saved-cards`, {
12046
+ ...options,
12022
12047
  headers: this.bearerHeaders(options?.headers)
12023
12048
  });
12024
12049
  }
@@ -12028,15 +12053,24 @@ var CheckoutSession = class {
12028
12053
  * vault's own form, so it never reaches the checkout; confirm with the saved
12029
12054
  * card's `payment_token` once the form reports it stored.
12030
12055
  *
12031
- * `paymentToken` is the saved card's token from the payment-method list. A
12056
+ * `paymentToken` is the saved card's token from {@link vaultSavedCards}. A
12032
12057
  * VGS shop answers `400`: VGS re-collects the code with Collect.
12033
12058
  *
12059
+ * `params.appearance` asks for a form styled to match the page, as on
12060
+ * {@link vaultCollectSession}. The styled form is the security-code field
12061
+ * alone, with no label: draw the label beside the frame, and size the frame
12062
+ * to the answer's `height`. `labels` is ignored. If the vault refuses the
12063
+ * styled form the answer is the plain one, without `height`.
12064
+ *
12065
+ * The form stores one code and then disables itself. After a failed
12066
+ * payment, mint a new form before the buyer tries again.
12067
+ *
12034
12068
  * `GET /payment-link/{merchantId}/{paymentId}/vault/security-code-session`
12035
12069
  */
12036
- async vaultSecurityCodeSession(paymentToken, options) {
12070
+ async vaultSecurityCodeSession(paymentToken, options, params) {
12037
12071
  return this.client.request("GET", `${this.linkBase}/vault/security-code-session`, {
12038
12072
  ...options,
12039
- query: { payment_token: paymentToken },
12073
+ query: { payment_token: paymentToken, ...vaultFormQuery(params) },
12040
12074
  headers: this.bearerHeaders(options?.headers)
12041
12075
  });
12042
12076
  }