@delopay/sdk 0.158.0 → 0.162.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.
@@ -2690,8 +2690,9 @@ var Routing = class {
2690
2690
  });
2691
2691
  }
2692
2692
  /**
2693
- * A shop's lifetime per-connector payment caps, each with how much of it is
2694
- * already spent.
2693
+ * A shop's per-connector caps, each with its unit and window and how much of
2694
+ * the current window is spent (`used`) or held by payments in flight
2695
+ * (`reserved`).
2695
2696
  *
2696
2697
  * `GET /routing/connector-caps/{profileId}`
2697
2698
  */
@@ -2716,13 +2717,17 @@ var Routing = class {
2716
2717
  return this.request("GET", `/routing/volume-counters/${encodeURIComponent(profileId)}`);
2717
2718
  }
2718
2719
  /**
2719
- * Replace a shop's per-connector payment caps.
2720
+ * Replace a shop's per-connector caps.
2720
2721
  *
2721
2722
  * Whole-set replacement, not a patch: the list sent becomes the complete set
2722
2723
  * of capped connectors, and an empty list clears them all — which is how
2723
2724
  * acquirer onboarding finishes, the new account ceasing to be a special case.
2725
+ * Re-send every other cap with its `unit`, `window` and `currency` as read:
2726
+ * an amount cap sent back without its `unit` is refused, because it carries a
2727
+ * currency and would otherwise be a payment count.
2724
2728
  *
2725
2729
  * Every account named must belong to this shop; one that does not is refused.
2730
+ * So is an amount cap without a `currency`, and a payment cap with one.
2726
2731
  *
2727
2732
  * `PUT /routing/connector-caps/{profileId}`
2728
2733
  */
@@ -4388,6 +4393,161 @@ var SellToRestrictions = class {
4388
4393
  }
4389
4394
  };
4390
4395
 
4396
+ // src/resources/costRules.ts
4397
+ var CostRules = class {
4398
+ constructor(request) {
4399
+ this.request = request;
4400
+ }
4401
+ /**
4402
+ * Every cost rule of the merchant.
4403
+ * `GET /cost-rules`
4404
+ *
4405
+ * @param merchantId - The merchant account ID.
4406
+ */
4407
+ async list(merchantId) {
4408
+ return this.request("GET", "/cost-rules", { query: { merchant_id: merchantId } });
4409
+ }
4410
+ /**
4411
+ * Record a cost rule.
4412
+ * `POST /cost-rules`
4413
+ *
4414
+ * @param params - The rule.
4415
+ * @param merchantId - The merchant account ID.
4416
+ */
4417
+ async create(params, merchantId) {
4418
+ return this.request("POST", "/cost-rules", {
4419
+ body: params,
4420
+ query: { merchant_id: merchantId }
4421
+ });
4422
+ }
4423
+ /**
4424
+ * Close, deactivate or rename a cost rule.
4425
+ * `PUT /cost-rules/{rule_id}`
4426
+ *
4427
+ * @param ruleId - The rule ID.
4428
+ * @param params - What to change.
4429
+ * @param merchantId - The merchant account ID.
4430
+ */
4431
+ async update(ruleId, params, merchantId) {
4432
+ return this.request("PUT", `/cost-rules/${encodeURIComponent(ruleId)}`, {
4433
+ body: params,
4434
+ query: { merchant_id: merchantId }
4435
+ });
4436
+ }
4437
+ /**
4438
+ * Delete a cost rule.
4439
+ * `DELETE /cost-rules/{rule_id}`
4440
+ *
4441
+ * @param ruleId - The rule ID.
4442
+ * @param merchantId - The merchant account ID.
4443
+ */
4444
+ async delete(ruleId, merchantId) {
4445
+ return this.request("DELETE", `/cost-rules/${encodeURIComponent(ruleId)}`, {
4446
+ query: { merchant_id: merchantId }
4447
+ });
4448
+ }
4449
+ };
4450
+
4451
+ // src/resources/processorCosts.ts
4452
+ var ProcessorCosts = class {
4453
+ constructor(request) {
4454
+ this.request = request;
4455
+ }
4456
+ /**
4457
+ * Every processor cost schedule of the merchant.
4458
+ * `GET /processor-costs`
4459
+ *
4460
+ * @param merchantId - The merchant account ID.
4461
+ */
4462
+ async list(merchantId) {
4463
+ return this.request("GET", "/processor-costs", { query: { merchant_id: merchantId } });
4464
+ }
4465
+ /**
4466
+ * Record a processor cost schedule.
4467
+ * `POST /processor-costs`
4468
+ *
4469
+ * A `shop_id` that is well formed but not a shop of this merchant is
4470
+ * answered `404` and nothing is recorded: a rate scoped to a shop the
4471
+ * merchant does not own would price no attempt, leaving every line it was
4472
+ * meant to price `unavailable` while the screen showed a configured rate.
4473
+ *
4474
+ * @param params - The schedule.
4475
+ * @param merchantId - The merchant account ID.
4476
+ */
4477
+ async create(params, merchantId) {
4478
+ return this.request("POST", "/processor-costs", {
4479
+ body: params,
4480
+ query: { merchant_id: merchantId }
4481
+ });
4482
+ }
4483
+ /**
4484
+ * Record several schedules at once, all or none — copy a price list across
4485
+ * methods or shops.
4486
+ * `POST /processor-costs/bulk`
4487
+ *
4488
+ * 1 to 200 entries. Every entry is validated before anything is stored: an
4489
+ * invalid one is answered `422` naming its index, and nothing is stored.
4490
+ * The answer lists the created schedules in request order.
4491
+ *
4492
+ * @param params - The schedules.
4493
+ * @param merchantId - The merchant account ID.
4494
+ */
4495
+ async bulkCreate(params, merchantId) {
4496
+ return this.request("POST", "/processor-costs/bulk", {
4497
+ body: params,
4498
+ query: { merchant_id: merchantId }
4499
+ });
4500
+ }
4501
+ /**
4502
+ * Close, deactivate or annotate a schedule. The rate is not editable.
4503
+ * `PUT /processor-costs/{schedule_id}`
4504
+ *
4505
+ * @param scheduleId - The schedule ID.
4506
+ * @param params - What to change.
4507
+ * @param merchantId - The merchant account ID.
4508
+ */
4509
+ async update(scheduleId, params, merchantId) {
4510
+ return this.request("PUT", `/processor-costs/${encodeURIComponent(scheduleId)}`, {
4511
+ body: params,
4512
+ query: { merchant_id: merchantId }
4513
+ });
4514
+ }
4515
+ /**
4516
+ * Close a schedule at `effective_from` and open its successor with the same
4517
+ * scope and the same end, in one step: no transaction is priced by both
4518
+ * rates, and none falls between them.
4519
+ * `POST /processor-costs/{schedule_id}/replace`
4520
+ *
4521
+ * Answers the successor schedule. An `effective_from` outside the old
4522
+ * schedule's window, an inactive schedule, or one a concurrent replacement
4523
+ * already moved is answered `400` — retry against the schedule as it now
4524
+ * stands rather than forcing the write.
4525
+ *
4526
+ * @param scheduleId - The schedule to replace.
4527
+ * @param params - The new rate.
4528
+ * @param merchantId - The merchant account ID.
4529
+ */
4530
+ async replace(scheduleId, params, merchantId) {
4531
+ return this.request("POST", `/processor-costs/${encodeURIComponent(scheduleId)}/replace`, {
4532
+ body: params,
4533
+ query: { merchant_id: merchantId }
4534
+ });
4535
+ }
4536
+ /**
4537
+ * Delete a schedule. Restates nothing: every figure it derived is already
4538
+ * stamped on the settlement lines it priced.
4539
+ * `DELETE /processor-costs/{schedule_id}`
4540
+ *
4541
+ * @param scheduleId - The schedule ID.
4542
+ * @param merchantId - The merchant account ID.
4543
+ */
4544
+ async delete(scheduleId, merchantId) {
4545
+ return this.request("DELETE", `/processor-costs/${encodeURIComponent(scheduleId)}`, {
4546
+ query: { merchant_id: merchantId }
4547
+ });
4548
+ }
4549
+ };
4550
+
4391
4551
  // src/resources/checkoutMethods.ts
4392
4552
  var CheckoutMethods = class {
4393
4553
  constructor(request) {
@@ -5308,6 +5468,8 @@ var Delopay = class {
5308
5468
  this.regions = new Regions(request);
5309
5469
  this.availabilityOverrides = new AvailabilityOverrides(request);
5310
5470
  this.sellToRestrictions = new SellToRestrictions(request);
5471
+ this.costRules = new CostRules(request);
5472
+ this.processorCosts = new ProcessorCosts(request);
5311
5473
  this.checkoutMethods = new CheckoutMethods(request);
5312
5474
  this.analytics = new Analytics(request);
5313
5475
  this.analyticsDashboard = new AnalyticsDashboard(request);
@@ -8197,11 +8359,62 @@ var CheckoutSession = class {
8197
8359
  *
8198
8360
  * `GET /payment-link/{merchantId}/{paymentId}/epayouts/methods`
8199
8361
  *
8362
+ * Pass `{ paypalSdk: true }` from a checkout drawing an experimental PayPal
8363
+ * SDK pane to also receive e-Payouts' PayPal client id
8364
+ * (`paypal_client_id`, `paypal_currency`); it is present only when `ppal`
8365
+ * is among the methods.
8366
+ *
8200
8367
  * @param country - Lowercase ISO 3166-1 alpha-2 country code.
8201
8368
  */
8202
8369
  async epayoutsMethods(country, options) {
8370
+ const { paypalSdk, merchantConnectorId, ...extras } = options ?? {};
8203
8371
  return this.client.request("GET", `${this.linkBase}/epayouts/methods`, {
8204
- query: { cc: country },
8372
+ query: paypalSdk ? {
8373
+ cc: country,
8374
+ paypal_sdk: "true",
8375
+ ...merchantConnectorId ? { merchant_connector_id: merchantConnectorId } : {}
8376
+ } : { cc: country },
8377
+ ...extras,
8378
+ headers: this.bearerHeaders(extras.headers)
8379
+ });
8380
+ }
8381
+ /**
8382
+ * The PayPal order for the payment's e-Payouts access code, from the PayPal
8383
+ * SDK's `createOrder` on an experimental PayPal SDK pane — after the payment
8384
+ * was confirmed through that pane, which mints the code.
8385
+ *
8386
+ * The router reads the order off e-Payouts' own PayPal page for the code, so
8387
+ * `amount` and `currency` are what e-Payouts charges for it. Repeated calls
8388
+ * answer the same order, so a cancelled PayPal popup is retried with the same
8389
+ * code. When `captured` is `true` a capture was already reported: create no
8390
+ * order and wait for the payment's status instead.
8391
+ *
8392
+ * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-order`
8393
+ */
8394
+ async epayoutsPaypalOrder(options) {
8395
+ return this.client.request("POST", `${this.linkBase}/epayouts/paypal-order`, {
8396
+ ...options,
8397
+ headers: this.bearerHeaders(options?.headers)
8398
+ });
8399
+ }
8400
+ /**
8401
+ * Report a PayPal order's progress from `onApprove` on an experimental PayPal
8402
+ * SDK pane: the approval, before asking PayPal to capture — and capture only
8403
+ * once the router has it — then the capture PayPal answered, or a decline.
8404
+ * When the approval's answer is lost, do not capture: report `NOT_CAPTURED`
8405
+ * instead, which releases an approval the router may have recorded.
8406
+ *
8407
+ * The router records each on the payment and relays a capture that took money
8408
+ * to e-Payouts the way e-Payouts' own PayPal page does. It does not mark the
8409
+ * payment paid: that happens only on e-Payouts' notification, so poll the
8410
+ * payment's status afterwards. A repeated report is answered, not recorded
8411
+ * twice.
8412
+ *
8413
+ * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-capture`
8414
+ */
8415
+ async epayoutsPaypalCapture(params, options) {
8416
+ return this.client.request("POST", `${this.linkBase}/epayouts/paypal-capture`, {
8417
+ body: params,
8205
8418
  ...options,
8206
8419
  headers: this.bearerHeaders(options?.headers)
8207
8420
  });
@@ -8275,12 +8488,29 @@ var CheckoutSession = class {
8275
8488
  * checkout payload with `card_connector_server_confirm: true`. Stripe refuses
8276
8489
  * a Stripe.js confirm of such an intent.
8277
8490
  *
8278
- * Send the ConfirmationToken the Payment Element (or Express Checkout
8279
- * Element) produced. The router judges the card's issuing country and the
8280
- * buyer's IP country against the shop's sell-to restrictions before Stripe
8281
- * authorises, and a refusal throws a `DelopayError` with code `DE_10`. When
8282
- * the answer's `status` is `requires_action`, run `stripe.handleNextAction`
8283
- * with its `client_secret`, then call this again without a token to finalize.
8491
+ * Send the PaymentMethod `stripe.createPaymentMethod` produced from the
8492
+ * Payment Element (or Express Checkout Element), which needs
8493
+ * `paymentMethodCreation: 'manual'` on the Elements instance. A
8494
+ * ConfirmationToken is refused with `400`: Stripe will not confirm such an
8495
+ * intent with one.
8496
+ *
8497
+ * The router judges the card's issuing country and the buyer's IP country
8498
+ * against the shop's sell-to restrictions before Stripe authorises, and a
8499
+ * refusal throws a `DelopayError` with code `DE_10`. When the answer's
8500
+ * `status` is `requires_action`, run `stripe.handleNextAction` with its
8501
+ * `client_secret` — safe, because the intent is `confirmation_method=manual`
8502
+ * and that secret confirms nothing without the secret key — then call this
8503
+ * again without a payment method to finalize.
8504
+ *
8505
+ * A PaymentMethod rules out what `stripe.createPaymentMethod` cannot
8506
+ * produce: Stripe names Amazon Pay and Klarna in the Express Checkout
8507
+ * Element, which need `stripe.createConfirmationToken` instead. Neither can
8508
+ * be paid through this route, so a caller must not offer them on a
8509
+ * server-confirmed intent — mount the Express Checkout Element with those
8510
+ * methods `'never'`, as DeloPay's own checkout does. The router drops only
8511
+ * the methods its server-side confirm cannot finish at all (BLIK and ACSS
8512
+ * pre-authorized debits) from the card form's mount, so the rest of the
8513
+ * selection still reaches the element and is the caller's to constrain.
8284
8514
  *
8285
8515
  * `POST /payment-link/{merchantId}/{paymentId}/stripe-confirm`
8286
8516
  */
@@ -8291,6 +8521,27 @@ var CheckoutSession = class {
8291
8521
  headers: this.bearerHeaders(options?.headers)
8292
8522
  });
8293
8523
  }
8524
+ /**
8525
+ * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
8526
+ * form's pre-submit hook.
8527
+ *
8528
+ * Only for a checkout stamped `NomupayOppwaCheckoutData.submit_grant`: the
8529
+ * card form sits beside always-shown wallet buttons of another account, and
8530
+ * this answer closes those buttons before it allows the card. `authorized`
8531
+ * is `false` when the payment no longer waits for a payment method, or when
8532
+ * this is not the attempt's live card-form checkout; when a wallet beside it
8533
+ * is already being paid, the route answers an error instead. Submit the
8534
+ * widget only on `true`.
8535
+ *
8536
+ * `POST /payment-link/{merchantId}/{paymentId}/nomupay-card-authorization`
8537
+ */
8538
+ async nomupayCardAuthorization(params, options) {
8539
+ return this.client.request("POST", `${this.linkBase}/nomupay-card-authorization`, {
8540
+ body: params,
8541
+ ...options,
8542
+ headers: this.bearerHeaders(options?.headers)
8543
+ });
8544
+ }
8294
8545
  /**
8295
8546
  * The payment's current state — status polling for redirect/popup rails.
8296
8547
  *
@@ -8821,6 +9072,8 @@ export {
8821
9072
  Regions,
8822
9073
  AvailabilityOverrides,
8823
9074
  SellToRestrictions,
9075
+ CostRules,
9076
+ ProcessorCosts,
8824
9077
  CheckoutMethods,
8825
9078
  Subscriptions,
8826
9079
  Audit,
@@ -8999,4 +9252,4 @@ export {
8999
9252
  decodeNativePanes,
9000
9253
  encodeNativePanes
9001
9254
  };
9002
- //# sourceMappingURL=chunk-4YLUV3YJ.js.map
9255
+ //# sourceMappingURL=chunk-P2KP3WRS.js.map