@delopay/sdk 0.162.1 → 0.164.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/{chunk-P2KP3WRS.js → chunk-GCJDY4KX.js} +213 -1
- package/dist/chunk-GCJDY4KX.js.map +1 -0
- package/dist/index.cjs +214 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +613 -1
- package/dist/index.d.ts +613 -1
- package/dist/index.js +5 -1
- package/dist/internal.cjs +214 -0
- 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 +5 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-P2KP3WRS.js.map +0 -1
|
@@ -1763,6 +1763,16 @@ var Payments = class {
|
|
|
1763
1763
|
* Not the hosted-shop settlement API under `settlement.*`, which is host →
|
|
1764
1764
|
* shop owner and manual; this is acquirer → merchant bank, per payment.
|
|
1765
1765
|
*
|
|
1766
|
+
* Each attempt also carries what the rail itself took for it —
|
|
1767
|
+
* `processor_cost_amount` with its own `processor_cost_currency` and
|
|
1768
|
+
* `processor_cost_exponent`, the `processor_cost_source` that says how the
|
|
1769
|
+
* figure was obtained, the `processor_cost_basis` behind an estimate, and
|
|
1770
|
+
* the `connector_method_code` it was priced under. Recorded for **every**
|
|
1771
|
+
* merchant, not only those that host shops. Never present an `estimated`
|
|
1772
|
+
* cost as an observation, and read an absent `processor_cost_source` as
|
|
1773
|
+
* "nothing was ever written", which is not the `unavailable` the rail
|
|
1774
|
+
* answers with.
|
|
1775
|
+
*
|
|
1766
1776
|
* `GET /payments/{paymentId}/settlement`
|
|
1767
1777
|
*
|
|
1768
1778
|
* @param paymentId - The payment intent ID.
|
|
@@ -1781,6 +1791,9 @@ var Payments = class {
|
|
|
1781
1791
|
* if (attempt.status === 'paid_out') {
|
|
1782
1792
|
* console.log(attempt.paid_out_at, attempt.payout_reference);
|
|
1783
1793
|
* }
|
|
1794
|
+
* if (attempt.processor_cost_source === 'estimated') {
|
|
1795
|
+
* // Label it an estimate — it was derived from a cost schedule.
|
|
1796
|
+
* }
|
|
1784
1797
|
* }
|
|
1785
1798
|
* ```
|
|
1786
1799
|
*/
|
|
@@ -4448,6 +4461,142 @@ var CostRules = class {
|
|
|
4448
4461
|
}
|
|
4449
4462
|
};
|
|
4450
4463
|
|
|
4464
|
+
// src/resources/externalRecords.ts
|
|
4465
|
+
var ExternalRecords = class {
|
|
4466
|
+
constructor(request) {
|
|
4467
|
+
this.request = request;
|
|
4468
|
+
}
|
|
4469
|
+
/**
|
|
4470
|
+
* Record one out-of-band transition.
|
|
4471
|
+
* `POST /external-records`
|
|
4472
|
+
*
|
|
4473
|
+
* Which kinds a deployment answers for depends on the payment's connector
|
|
4474
|
+
* and on which arms are live: an arm that is not served answers `501`, which
|
|
4475
|
+
* is a statement about this rail rather than about the request.
|
|
4476
|
+
*
|
|
4477
|
+
* @param params - What happened, and why it is being recorded.
|
|
4478
|
+
*/
|
|
4479
|
+
async create(params) {
|
|
4480
|
+
return this.request("POST", "/external-records", { body: params });
|
|
4481
|
+
}
|
|
4482
|
+
};
|
|
4483
|
+
|
|
4484
|
+
// src/resources/products.ts
|
|
4485
|
+
var Products = class {
|
|
4486
|
+
constructor(request) {
|
|
4487
|
+
this.request = request;
|
|
4488
|
+
}
|
|
4489
|
+
/** The shop scope every route here takes, as the backend expects it. */
|
|
4490
|
+
scoped(profileId, options) {
|
|
4491
|
+
return { ...options, headers: { "X-Profile-Id": profileId, ...options?.headers } };
|
|
4492
|
+
}
|
|
4493
|
+
/**
|
|
4494
|
+
* Create a product together with its prices.
|
|
4495
|
+
* `POST /products`
|
|
4496
|
+
*
|
|
4497
|
+
* @param params - The product, with at least one price.
|
|
4498
|
+
* @param profileId - The shop the product belongs to.
|
|
4499
|
+
*/
|
|
4500
|
+
async create(params, profileId, options) {
|
|
4501
|
+
return this.request("POST", "/products", {
|
|
4502
|
+
body: params,
|
|
4503
|
+
...this.scoped(profileId, options)
|
|
4504
|
+
});
|
|
4505
|
+
}
|
|
4506
|
+
/**
|
|
4507
|
+
* One page of the shop's catalogue.
|
|
4508
|
+
* `GET /products/list`
|
|
4509
|
+
*
|
|
4510
|
+
* Archived products are returned too unless `status` narrows them away —
|
|
4511
|
+
* they are what past charges refer to.
|
|
4512
|
+
*/
|
|
4513
|
+
async list(params, profileId, options) {
|
|
4514
|
+
return this.request("GET", "/products/list", {
|
|
4515
|
+
query: params === void 0 ? void 0 : { ...params },
|
|
4516
|
+
...this.scoped(profileId, options)
|
|
4517
|
+
});
|
|
4518
|
+
}
|
|
4519
|
+
/**
|
|
4520
|
+
* Retrieve one product with its prices.
|
|
4521
|
+
* `GET /products/{product_id}`
|
|
4522
|
+
*/
|
|
4523
|
+
async retrieve(productId, profileId, options) {
|
|
4524
|
+
return this.request("GET", `/products/${encodeURIComponent(productId)}`, {
|
|
4525
|
+
...this.scoped(profileId, options)
|
|
4526
|
+
});
|
|
4527
|
+
}
|
|
4528
|
+
/**
|
|
4529
|
+
* Change a product's name, description or metadata.
|
|
4530
|
+
* `POST /products/{product_id}`
|
|
4531
|
+
*
|
|
4532
|
+
* Its kind and its prices are not editable here — see the class note.
|
|
4533
|
+
*/
|
|
4534
|
+
async update(productId, params, profileId, options) {
|
|
4535
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}`, {
|
|
4536
|
+
body: params,
|
|
4537
|
+
...this.scoped(profileId, options)
|
|
4538
|
+
});
|
|
4539
|
+
}
|
|
4540
|
+
/**
|
|
4541
|
+
* Take a product off sale.
|
|
4542
|
+
* `POST /products/{product_id}/archive`
|
|
4543
|
+
*
|
|
4544
|
+
* It stays readable and keeps its prices: a payment made against it has to
|
|
4545
|
+
* remain explicable after it is withdrawn.
|
|
4546
|
+
*/
|
|
4547
|
+
async archive(productId, profileId, options) {
|
|
4548
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}/archive`, {
|
|
4549
|
+
...this.scoped(profileId, options)
|
|
4550
|
+
});
|
|
4551
|
+
}
|
|
4552
|
+
/**
|
|
4553
|
+
* Put an archived product back on sale.
|
|
4554
|
+
* `POST /products/{product_id}/restore`
|
|
4555
|
+
*/
|
|
4556
|
+
async restore(productId, profileId, options) {
|
|
4557
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}/restore`, {
|
|
4558
|
+
...this.scoped(profileId, options)
|
|
4559
|
+
});
|
|
4560
|
+
}
|
|
4561
|
+
/**
|
|
4562
|
+
* Add a price to an existing product.
|
|
4563
|
+
* `POST /products/{product_id}/prices`
|
|
4564
|
+
*
|
|
4565
|
+
* This is how a price changes: the new figure is added and the old price is
|
|
4566
|
+
* archived, so both remain readable.
|
|
4567
|
+
*/
|
|
4568
|
+
async addPrice(productId, params, profileId, options) {
|
|
4569
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}/prices`, {
|
|
4570
|
+
body: params,
|
|
4571
|
+
...this.scoped(profileId, options)
|
|
4572
|
+
});
|
|
4573
|
+
}
|
|
4574
|
+
/**
|
|
4575
|
+
* Change a price's label, its default flag or its metadata.
|
|
4576
|
+
* `POST /products/{product_id}/prices/{price_id}`
|
|
4577
|
+
*
|
|
4578
|
+
* Not its amount, its currency or its interval: see the class note.
|
|
4579
|
+
*/
|
|
4580
|
+
async updatePrice(productId, priceId, params, profileId, options) {
|
|
4581
|
+
return this.request(
|
|
4582
|
+
"POST",
|
|
4583
|
+
`/products/${encodeURIComponent(productId)}/prices/${encodeURIComponent(priceId)}`,
|
|
4584
|
+
{ body: params, ...this.scoped(profileId, options) }
|
|
4585
|
+
);
|
|
4586
|
+
}
|
|
4587
|
+
/**
|
|
4588
|
+
* Take one price off sale, leaving the product on it.
|
|
4589
|
+
* `POST /products/{product_id}/prices/{price_id}/archive`
|
|
4590
|
+
*/
|
|
4591
|
+
async archivePrice(productId, priceId, profileId, options) {
|
|
4592
|
+
return this.request(
|
|
4593
|
+
"POST",
|
|
4594
|
+
`/products/${encodeURIComponent(productId)}/prices/${encodeURIComponent(priceId)}/archive`,
|
|
4595
|
+
{ ...this.scoped(profileId, options) }
|
|
4596
|
+
);
|
|
4597
|
+
}
|
|
4598
|
+
};
|
|
4599
|
+
|
|
4451
4600
|
// src/resources/processorCosts.ts
|
|
4452
4601
|
var ProcessorCosts = class {
|
|
4453
4602
|
constructor(request) {
|
|
@@ -4880,6 +5029,65 @@ var Settlement = class {
|
|
|
4880
5029
|
...options
|
|
4881
5030
|
});
|
|
4882
5031
|
}
|
|
5032
|
+
/**
|
|
5033
|
+
* What a period's payments cost at the rails, grouped by shop, connector
|
|
5034
|
+
* and payment method. Answers for **every** merchant, including one that
|
|
5035
|
+
* hosts nobody — it reads the per-attempt settlement record rather than the
|
|
5036
|
+
* settlement lines, which exist only where hosting fees are configured.
|
|
5037
|
+
*
|
|
5038
|
+
* A sibling of {@link Settlement.cost} rather than a widening of it. That
|
|
5039
|
+
* endpoint is a profit statement whose revenue term is hosting income, and
|
|
5040
|
+
* a merchant who hosts nobody has none. This publishes cost and never
|
|
5041
|
+
* margin.
|
|
5042
|
+
*
|
|
5043
|
+
* Send `year` and `month` together to report one UTC calendar month, or
|
|
5044
|
+
* neither for the running month so far.
|
|
5045
|
+
*
|
|
5046
|
+
* **The response carries no period total, and a caller must not compute
|
|
5047
|
+
* one here.** Every figure keeps the unit the rail reported it in, and the
|
|
5048
|
+
* unit is part of each bucket's key, so adding two buckets is not addition.
|
|
5049
|
+
* Convert caller-side if you need one number, and say which rates you used.
|
|
5050
|
+
* The counts are totalled, because a count has no unit.
|
|
5051
|
+
*
|
|
5052
|
+
* Two distinctions not to flatten when rendering a bucket:
|
|
5053
|
+
* `cost_amount` covers `reported_count + estimated_count` attempts out of
|
|
5054
|
+
* `attempt_count` and is a lower bound whenever those disagree; and
|
|
5055
|
+
* `unavailable_count` (the rail says it has no figure) means something
|
|
5056
|
+
* different from `unwritten_count` (a gap in our own recording).
|
|
5057
|
+
*
|
|
5058
|
+
* **Merchant scope.** A token scoped to a single shop, a role narrowed to
|
|
5059
|
+
* specific connector accounts, or a role without the settlement-read
|
|
5060
|
+
* permission group is refused `403`: what a rail charged is the merchant's
|
|
5061
|
+
* own cost base, and here it is the whole response, so there is nothing
|
|
5062
|
+
* coherent to redact down to. Gate the surface on the caller's scope rather
|
|
5063
|
+
* than calling it and handling the failure.
|
|
5064
|
+
*
|
|
5065
|
+
* `GET /settlement/processor-cost`
|
|
5066
|
+
*
|
|
5067
|
+
* @example
|
|
5068
|
+
* ```typescript
|
|
5069
|
+
* const period = await delopay.settlement.processorCost({
|
|
5070
|
+
* test_mode: false,
|
|
5071
|
+
* year: 2026,
|
|
5072
|
+
* month: 7,
|
|
5073
|
+
* });
|
|
5074
|
+
* for (const bucket of period.buckets) {
|
|
5075
|
+
* // Each bucket is its own unit — render per bucket, never a sum.
|
|
5076
|
+
* console.log(bucket.connector, bucket.cost_amount, bucket.cost_currency);
|
|
5077
|
+
* }
|
|
5078
|
+
* ```
|
|
5079
|
+
*/
|
|
5080
|
+
async processorCost(params, options) {
|
|
5081
|
+
return this.request("GET", "/settlement/processor-cost", {
|
|
5082
|
+
query: {
|
|
5083
|
+
profile_id: params?.profile_id,
|
|
5084
|
+
test_mode: params?.test_mode,
|
|
5085
|
+
year: params?.year,
|
|
5086
|
+
month: params?.month
|
|
5087
|
+
},
|
|
5088
|
+
...options
|
|
5089
|
+
});
|
|
5090
|
+
}
|
|
4883
5091
|
/**
|
|
4884
5092
|
* List generated settlement statements, newest first.
|
|
4885
5093
|
*
|
|
@@ -5469,6 +5677,8 @@ var Delopay = class {
|
|
|
5469
5677
|
this.availabilityOverrides = new AvailabilityOverrides(request);
|
|
5470
5678
|
this.sellToRestrictions = new SellToRestrictions(request);
|
|
5471
5679
|
this.costRules = new CostRules(request);
|
|
5680
|
+
this.externalRecords = new ExternalRecords(request);
|
|
5681
|
+
this.products = new Products(request);
|
|
5472
5682
|
this.processorCosts = new ProcessorCosts(request);
|
|
5473
5683
|
this.checkoutMethods = new CheckoutMethods(request);
|
|
5474
5684
|
this.analytics = new Analytics(request);
|
|
@@ -9073,6 +9283,8 @@ export {
|
|
|
9073
9283
|
AvailabilityOverrides,
|
|
9074
9284
|
SellToRestrictions,
|
|
9075
9285
|
CostRules,
|
|
9286
|
+
ExternalRecords,
|
|
9287
|
+
Products,
|
|
9076
9288
|
ProcessorCosts,
|
|
9077
9289
|
CheckoutMethods,
|
|
9078
9290
|
Subscriptions,
|
|
@@ -9252,4 +9464,4 @@ export {
|
|
|
9252
9464
|
decodeNativePanes,
|
|
9253
9465
|
encodeNativePanes
|
|
9254
9466
|
};
|
|
9255
|
-
//# sourceMappingURL=chunk-
|
|
9467
|
+
//# sourceMappingURL=chunk-GCJDY4KX.js.map
|