@delopay/sdk 0.204.0 → 0.208.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/README.md +16 -0
- package/dist/{chunk-KXLZ4RS7.js → chunk-B4ABMM47.js} +439 -6
- package/dist/chunk-B4ABMM47.js.map +1 -0
- package/dist/index.cjs +441 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +942 -10
- package/dist/index.d.ts +942 -10
- package/dist/index.js +7 -1
- package/dist/internal.cjs +495 -5
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +42 -3
- package/dist/internal.d.ts +42 -3
- package/dist/internal.js +60 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-KXLZ4RS7.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -54,6 +54,8 @@ import {
|
|
|
54
54
|
Forex,
|
|
55
55
|
GOOGLE_PAY_BUTTON_COLORS,
|
|
56
56
|
GOOGLE_PAY_BUTTON_TYPES,
|
|
57
|
+
InvoiceSettingsResource,
|
|
58
|
+
Invoices,
|
|
57
59
|
LOCALIZABLE_COPY_FIELDS,
|
|
58
60
|
MAX_SECTION_LABEL_LENGTH,
|
|
59
61
|
MAX_SECTION_ORDER,
|
|
@@ -103,6 +105,7 @@ import {
|
|
|
103
105
|
SURCHARGE_WEIGHTS,
|
|
104
106
|
Search,
|
|
105
107
|
SellToRestrictions,
|
|
108
|
+
Settings,
|
|
106
109
|
Settlement,
|
|
107
110
|
Subscriptions,
|
|
108
111
|
UNKNOWN_SECTION_ORDER,
|
|
@@ -216,7 +219,7 @@ import {
|
|
|
216
219
|
validatePanes,
|
|
217
220
|
verticalGapValue,
|
|
218
221
|
visibleCustomFields
|
|
219
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-B4ABMM47.js";
|
|
220
223
|
export {
|
|
221
224
|
AIRWALLEX_AUTOFILL_TREATMENTS,
|
|
222
225
|
AIRWALLEX_CARD_LAYOUTS,
|
|
@@ -273,6 +276,8 @@ export {
|
|
|
273
276
|
Forex,
|
|
274
277
|
GOOGLE_PAY_BUTTON_COLORS,
|
|
275
278
|
GOOGLE_PAY_BUTTON_TYPES,
|
|
279
|
+
InvoiceSettingsResource,
|
|
280
|
+
Invoices,
|
|
276
281
|
LOCALIZABLE_COPY_FIELDS,
|
|
277
282
|
MAX_SECTION_LABEL_LENGTH,
|
|
278
283
|
MAX_SECTION_ORDER,
|
|
@@ -322,6 +327,7 @@ export {
|
|
|
322
327
|
SURCHARGE_WEIGHTS,
|
|
323
328
|
Search,
|
|
324
329
|
SellToRestrictions,
|
|
330
|
+
Settings,
|
|
325
331
|
Settlement,
|
|
326
332
|
Subscriptions,
|
|
327
333
|
UNKNOWN_SECTION_ORDER,
|
package/dist/internal.cjs
CHANGED
|
@@ -86,6 +86,8 @@ __export(internal_exports, {
|
|
|
86
86
|
GOOGLE_PAY_BUTTON_COLORS: () => GOOGLE_PAY_BUTTON_COLORS,
|
|
87
87
|
GOOGLE_PAY_BUTTON_TYPES: () => GOOGLE_PAY_BUTTON_TYPES,
|
|
88
88
|
Gsm: () => Gsm,
|
|
89
|
+
InvoiceSettingsResource: () => InvoiceSettingsResource,
|
|
90
|
+
Invoices: () => Invoices,
|
|
89
91
|
LOCALIZABLE_COPY_FIELDS: () => LOCALIZABLE_COPY_FIELDS,
|
|
90
92
|
MAX_SECTION_LABEL_LENGTH: () => MAX_SECTION_LABEL_LENGTH,
|
|
91
93
|
MAX_SECTION_ORDER: () => MAX_SECTION_ORDER,
|
|
@@ -112,6 +114,7 @@ __export(internal_exports, {
|
|
|
112
114
|
PaypalDisputes: () => PaypalDisputes,
|
|
113
115
|
PlatformBilling: () => PlatformBilling,
|
|
114
116
|
PlatformFees: () => PlatformFees,
|
|
117
|
+
PlatformSettings: () => PlatformSettings,
|
|
115
118
|
ProcessorCosts: () => ProcessorCosts,
|
|
116
119
|
Products: () => Products,
|
|
117
120
|
RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
|
|
@@ -138,6 +141,7 @@ __export(internal_exports, {
|
|
|
138
141
|
SURCHARGE_WEIGHTS: () => SURCHARGE_WEIGHTS,
|
|
139
142
|
Search: () => Search,
|
|
140
143
|
SellToRestrictions: () => SellToRestrictions,
|
|
144
|
+
Settings: () => Settings,
|
|
141
145
|
Settlement: () => Settlement,
|
|
142
146
|
Subscriptions: () => Subscriptions,
|
|
143
147
|
UNKNOWN_SECTION_ORDER: () => UNKNOWN_SECTION_ORDER,
|
|
@@ -347,6 +351,29 @@ var ApiKeys = class {
|
|
|
347
351
|
`/api-keys/${encodeURIComponent(merchantId)}/${encodeURIComponent(keyId)}`
|
|
348
352
|
);
|
|
349
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Replace an API key's secret. The key keeps its id, name, scope, shop,
|
|
356
|
+
* origin rule, rate cap and expiry. The old secret stops working
|
|
357
|
+
* immediately, with no grace period, so deploy the new one as part of the
|
|
358
|
+
* same change. Refused with `IR_16` (HTTP 400) while the deployment runs
|
|
359
|
+
* partial authentication; create a new key and revoke the old one instead.
|
|
360
|
+
* `POST /api-keys/{merchantId}/{keyId}/rotate`
|
|
361
|
+
*
|
|
362
|
+
* @param merchantId - The merchant account ID.
|
|
363
|
+
* @param keyId - The API key ID to rotate.
|
|
364
|
+
* @returns The key with its new plaintext secret (shown once only).
|
|
365
|
+
*
|
|
366
|
+
* @example
|
|
367
|
+
* ```typescript
|
|
368
|
+
* const { api_key } = await delopay.apiKeys.rotate('merch_123', 'key_abc');
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
async rotate(merchantId, keyId) {
|
|
372
|
+
return this.request(
|
|
373
|
+
"POST",
|
|
374
|
+
`/api-keys/${encodeURIComponent(merchantId)}/${encodeURIComponent(keyId)}/rotate`
|
|
375
|
+
);
|
|
376
|
+
}
|
|
350
377
|
/**
|
|
351
378
|
* List all API keys for a merchant.
|
|
352
379
|
*
|
|
@@ -441,6 +468,22 @@ var ApiKeys = class {
|
|
|
441
468
|
`/account/${encodeURIComponent(merchantId)}/profile/api-keys/${encodeURIComponent(keyId)}`
|
|
442
469
|
);
|
|
443
470
|
}
|
|
471
|
+
/**
|
|
472
|
+
* Replace the secret of an API key pinned to the caller's shop. The key
|
|
473
|
+
* keeps its id, name, scope, origin rule, rate cap and expiry. The old
|
|
474
|
+
* secret stops working immediately, with no grace period.
|
|
475
|
+
* `POST /account/{merchantId}/profile/api-keys/{keyId}/rotate`
|
|
476
|
+
*
|
|
477
|
+
* @param merchantId - The merchant account ID.
|
|
478
|
+
* @param keyId - The API key ID to rotate.
|
|
479
|
+
* @returns The key with its new plaintext secret (shown once only).
|
|
480
|
+
*/
|
|
481
|
+
async rotateByProfile(merchantId, keyId) {
|
|
482
|
+
return this.request(
|
|
483
|
+
"POST",
|
|
484
|
+
`/account/${encodeURIComponent(merchantId)}/profile/api-keys/${encodeURIComponent(keyId)}/rotate`
|
|
485
|
+
);
|
|
486
|
+
}
|
|
444
487
|
};
|
|
445
488
|
|
|
446
489
|
// src/resources/authentication.ts
|
|
@@ -4694,7 +4737,9 @@ var Analytics = class {
|
|
|
4694
4737
|
* merchant, and to your single shop for profile-scoped users — so pass only
|
|
4695
4738
|
* `project_id` / `shop_id` to drill and the window / `sections` fields.
|
|
4696
4739
|
* Returns one drill level: the scope's daily series + previous window,
|
|
4697
|
-
* processor mix and direct children.
|
|
4740
|
+
* processor mix and direct children. Accepts a dashboard session or an API
|
|
4741
|
+
* key, including a `statistics_read` key; a shop-bound key reads only its
|
|
4742
|
+
* shop. `GET /analytics/scope`
|
|
4698
4743
|
*/
|
|
4699
4744
|
async scope(params) {
|
|
4700
4745
|
return this.request("GET", "/analytics/scope", {
|
|
@@ -4707,8 +4752,8 @@ var Analytics = class {
|
|
|
4707
4752
|
* channel mix, time-to-pay), pinned server-side to your own merchant and
|
|
4708
4753
|
* drillable via `project_id` / `shop_id` exactly like `scope`. Gated on the
|
|
4709
4754
|
* client-context optimisation-use switch: when it is off the server answers
|
|
4710
|
-
* 200 with `enabled: false` and a caveat naming the switch.
|
|
4711
|
-
* `GET /analytics/devices`
|
|
4755
|
+
* 200 with `enabled: false` and a caveat naming the switch. Accepts an API
|
|
4756
|
+
* key like `scope`. `GET /analytics/devices`
|
|
4712
4757
|
*/
|
|
4713
4758
|
async devices(params) {
|
|
4714
4759
|
return this.request("GET", "/analytics/devices", {
|
|
@@ -4720,7 +4765,7 @@ var Analytics = class {
|
|
|
4720
4765
|
* country totals, city bubbles (IP mode), buyer languages, buyer-local
|
|
4721
4766
|
* purchase hours and the IP-vs-billing mismatch share. `mode` selects the
|
|
4722
4767
|
* location claim (`ip` default, `billing`); the two are never coalesced.
|
|
4723
|
-
* Same drill, window and
|
|
4768
|
+
* Same drill, window, gating and API-key contract as `devices`.
|
|
4724
4769
|
* `GET /analytics/geo`
|
|
4725
4770
|
*/
|
|
4726
4771
|
async geo(params) {
|
|
@@ -4787,7 +4832,8 @@ var Analytics = class {
|
|
|
4787
4832
|
* Half the figures are **stocks** — a snapshot at the window's end rather
|
|
4788
4833
|
* than a sum over it — so `est_monthly_volume_usd` and `active` can match
|
|
4789
4834
|
* across a 7-day and a 30-day window while `billed_volume_usd` does not.
|
|
4790
|
-
* Day granularity only.
|
|
4835
|
+
* Day granularity only. Accepts an API key like `scope`.
|
|
4836
|
+
* `GET /analytics/subscriptions`
|
|
4791
4837
|
*/
|
|
4792
4838
|
async subscriptions(params) {
|
|
4793
4839
|
return this.request("GET", "/analytics/subscriptions", {
|
|
@@ -5825,6 +5871,343 @@ var Products = class {
|
|
|
5825
5871
|
}
|
|
5826
5872
|
};
|
|
5827
5873
|
|
|
5874
|
+
// src/resources/invoices.ts
|
|
5875
|
+
var Invoices = class {
|
|
5876
|
+
constructor(request) {
|
|
5877
|
+
this.request = request;
|
|
5878
|
+
}
|
|
5879
|
+
/**
|
|
5880
|
+
* Create a draft from a paid payment or subscription cycle, and with
|
|
5881
|
+
* `finalize: true` issue it in the same call.
|
|
5882
|
+
* `POST /invoices`
|
|
5883
|
+
*
|
|
5884
|
+
* Send an `Idempotency-Key` header in `options.headers` to make this safe to
|
|
5885
|
+
* retry: the same key and body return the document it created, in its
|
|
5886
|
+
* current state, even after a lost response, and a different body under the
|
|
5887
|
+
* same key answers 409. A retry of a `finalize: true` request whose draft
|
|
5888
|
+
* was committed but not finalised finalises that draft.
|
|
5889
|
+
*/
|
|
5890
|
+
async create(params, options) {
|
|
5891
|
+
return this.request("POST", "/invoices", { body: params, ...options });
|
|
5892
|
+
}
|
|
5893
|
+
/**
|
|
5894
|
+
* One page of documents, newest first. List rows carry no `lines` unless
|
|
5895
|
+
* `include_lines` is set, and never a `refund` summary.
|
|
5896
|
+
* `GET /invoices`
|
|
5897
|
+
*/
|
|
5898
|
+
async list(params, options) {
|
|
5899
|
+
return this.request("GET", "/invoices", {
|
|
5900
|
+
query: params === void 0 ? void 0 : { ...params },
|
|
5901
|
+
...options
|
|
5902
|
+
});
|
|
5903
|
+
}
|
|
5904
|
+
/**
|
|
5905
|
+
* One page of a payment's invoice and its credit notes, lines included. The
|
|
5906
|
+
* page also says whether a merchant of record sold the payment
|
|
5907
|
+
* (`merchant_of_record`, which `create` then refuses) and what was refunded
|
|
5908
|
+
* (`refunded_amount`, and `refund` on each invoice). Needs the payment read
|
|
5909
|
+
* grant as well.
|
|
5910
|
+
* `GET /payments/{payment_id}/invoices`
|
|
5911
|
+
*/
|
|
5912
|
+
async listForPayment(paymentId, params, options) {
|
|
5913
|
+
return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/invoices`, {
|
|
5914
|
+
query: params === void 0 ? void 0 : { ...params },
|
|
5915
|
+
...options
|
|
5916
|
+
});
|
|
5917
|
+
}
|
|
5918
|
+
/**
|
|
5919
|
+
* The documents with a line of one product; a bundle's components count,
|
|
5920
|
+
* flagged `included`. Takes the list filters; the product is the path's.
|
|
5921
|
+
* `GET /products/{product_id}/invoices`
|
|
5922
|
+
*/
|
|
5923
|
+
async listForProduct(productId, params, options) {
|
|
5924
|
+
return this.request("GET", `/products/${encodeURIComponent(productId)}/invoices`, {
|
|
5925
|
+
query: params === void 0 ? void 0 : { ...params },
|
|
5926
|
+
...options
|
|
5927
|
+
});
|
|
5928
|
+
}
|
|
5929
|
+
/**
|
|
5930
|
+
* The documents of one period as CSV (`text/csv; charset=utf-8`), with the
|
|
5931
|
+
* list's filters. Amounts are decimal in each document's currency; drafts
|
|
5932
|
+
* have an empty number.
|
|
5933
|
+
* `GET /invoices/export`
|
|
5934
|
+
*/
|
|
5935
|
+
async export(params, options) {
|
|
5936
|
+
return this.request("GET", "/invoices/export", {
|
|
5937
|
+
query: { ...params },
|
|
5938
|
+
responseType: "blob",
|
|
5939
|
+
...options
|
|
5940
|
+
});
|
|
5941
|
+
}
|
|
5942
|
+
/**
|
|
5943
|
+
* One document, lines included.
|
|
5944
|
+
* `GET /invoices/{invoice_id}`
|
|
5945
|
+
*/
|
|
5946
|
+
async retrieve(invoiceId, options) {
|
|
5947
|
+
return this.request("GET", `/invoices/${encodeURIComponent(invoiceId)}`, { ...options });
|
|
5948
|
+
}
|
|
5949
|
+
/**
|
|
5950
|
+
* Edit a draft: its words, buyer, dates and tax treatment, never what was
|
|
5951
|
+
* paid. Absent fields stay; `null` clears a clearable one. A document that
|
|
5952
|
+
* is not a draft is refused (`not_a_draft`).
|
|
5953
|
+
* `PATCH /invoices/{invoice_id}`
|
|
5954
|
+
*/
|
|
5955
|
+
async update(invoiceId, params, options) {
|
|
5956
|
+
return this.request("PATCH", `/invoices/${encodeURIComponent(invoiceId)}`, {
|
|
5957
|
+
body: params,
|
|
5958
|
+
...options
|
|
5959
|
+
});
|
|
5960
|
+
}
|
|
5961
|
+
/**
|
|
5962
|
+
* Delete a draft. A draft has no number, so nothing leaves a gap; an issued
|
|
5963
|
+
* document is refused (`not_a_draft`) — void or credit it instead.
|
|
5964
|
+
* `DELETE /invoices/{invoice_id}`
|
|
5965
|
+
*/
|
|
5966
|
+
async delete(invoiceId, options) {
|
|
5967
|
+
return this.request("DELETE", `/invoices/${encodeURIComponent(invoiceId)}`, { ...options });
|
|
5968
|
+
}
|
|
5969
|
+
/**
|
|
5970
|
+
* Issue a draft: allocate its number, freeze it and store its PDF. It is
|
|
5971
|
+
* immutable afterwards. A document that would be legally incomplete is
|
|
5972
|
+
* refused with `IR_06` and a reason (`seller_tax_id_missing`,
|
|
5973
|
+
* `line_tax_unexplained`, …) that says what to fix and where.
|
|
5974
|
+
* `POST /invoices/{invoice_id}/finalize`
|
|
5975
|
+
*/
|
|
5976
|
+
async finalize(invoiceId, options) {
|
|
5977
|
+
return this.request("POST", `/invoices/${encodeURIComponent(invoiceId)}/finalize`, {
|
|
5978
|
+
...options
|
|
5979
|
+
});
|
|
5980
|
+
}
|
|
5981
|
+
/**
|
|
5982
|
+
* Withdraw an issued document with a reason; its number stays used. For a
|
|
5983
|
+
* document that never reached the buyer — one they hold is corrected with
|
|
5984
|
+
* `createCreditNote`. An invoice with live credit notes is refused
|
|
5985
|
+
* (`has_credit_notes`).
|
|
5986
|
+
* `POST /invoices/{invoice_id}/void`
|
|
5987
|
+
*/
|
|
5988
|
+
async void(invoiceId, params, options) {
|
|
5989
|
+
return this.request("POST", `/invoices/${encodeURIComponent(invoiceId)}/void`, {
|
|
5990
|
+
body: params,
|
|
5991
|
+
...options
|
|
5992
|
+
});
|
|
5993
|
+
}
|
|
5994
|
+
/**
|
|
5995
|
+
* Correct an issued invoice with a credit note: all of what it has left, or
|
|
5996
|
+
* the named lines. Returns the **credit note**, not the invoice.
|
|
5997
|
+
* `POST /invoices/{invoice_id}/credit-note`
|
|
5998
|
+
*/
|
|
5999
|
+
async createCreditNote(invoiceId, params, options) {
|
|
6000
|
+
return this.request("POST", `/invoices/${encodeURIComponent(invoiceId)}/credit-note`, {
|
|
6001
|
+
body: params,
|
|
6002
|
+
...options
|
|
6003
|
+
});
|
|
6004
|
+
}
|
|
6005
|
+
/**
|
|
6006
|
+
* The document as a PDF. An issued document is its stored copy; a draft
|
|
6007
|
+
* renders live under a DRAFT banner, and a voided one under a VOIDED banner.
|
|
6008
|
+
* `GET /invoices/{invoice_id}/pdf`
|
|
6009
|
+
*/
|
|
6010
|
+
async downloadPdf(invoiceId, options) {
|
|
6011
|
+
return this.request("GET", `/invoices/${encodeURIComponent(invoiceId)}/pdf`, {
|
|
6012
|
+
responseType: "blob",
|
|
6013
|
+
...options
|
|
6014
|
+
});
|
|
6015
|
+
}
|
|
6016
|
+
/**
|
|
6017
|
+
* A public link to an issued document's stored PDF, valid for 7 days.
|
|
6018
|
+
* **Anyone holding the link can open the document**, without logging in. A
|
|
6019
|
+
* document that is not issued is refused (`not_issued`).
|
|
6020
|
+
* `POST /invoices/{invoice_id}/share-link`
|
|
6021
|
+
*/
|
|
6022
|
+
async createShareLink(invoiceId, options) {
|
|
6023
|
+
return this.request("POST", `/invoices/${encodeURIComponent(invoiceId)}/share-link`, {
|
|
6024
|
+
...options
|
|
6025
|
+
});
|
|
6026
|
+
}
|
|
6027
|
+
};
|
|
6028
|
+
|
|
6029
|
+
// src/resources/invoiceSettings.ts
|
|
6030
|
+
var InvoiceSettingsResource = class {
|
|
6031
|
+
constructor(request) {
|
|
6032
|
+
this.request = request;
|
|
6033
|
+
}
|
|
6034
|
+
// --- Settings -------------------------------------------------------------
|
|
6035
|
+
/**
|
|
6036
|
+
* The merchant default.
|
|
6037
|
+
* `GET /invoice-settings`
|
|
6038
|
+
*/
|
|
6039
|
+
async retrieve(options) {
|
|
6040
|
+
return this.request("GET", "/invoice-settings", { ...options });
|
|
6041
|
+
}
|
|
6042
|
+
/**
|
|
6043
|
+
* Replace the merchant default (every field but the logo).
|
|
6044
|
+
* `PUT /invoice-settings`
|
|
6045
|
+
*/
|
|
6046
|
+
async update(settings, options) {
|
|
6047
|
+
return this.request("PUT", "/invoice-settings", { body: settings, ...options });
|
|
6048
|
+
}
|
|
6049
|
+
/**
|
|
6050
|
+
* One shop's override. A `null` field inherits the merchant default.
|
|
6051
|
+
* `GET /invoice-settings/profiles/{profile_id}`
|
|
6052
|
+
*/
|
|
6053
|
+
async retrieveForShop(profileId, options) {
|
|
6054
|
+
return this.request("GET", `/invoice-settings/profiles/${encodeURIComponent(profileId)}`, {
|
|
6055
|
+
...options
|
|
6056
|
+
});
|
|
6057
|
+
}
|
|
6058
|
+
/**
|
|
6059
|
+
* Replace one shop's override (every field but the logo).
|
|
6060
|
+
* `PUT /invoice-settings/profiles/{profile_id}`
|
|
6061
|
+
*/
|
|
6062
|
+
async updateForShop(profileId, settings, options) {
|
|
6063
|
+
return this.request("PUT", `/invoice-settings/profiles/${encodeURIComponent(profileId)}`, {
|
|
6064
|
+
body: settings,
|
|
6065
|
+
...options
|
|
6066
|
+
});
|
|
6067
|
+
}
|
|
6068
|
+
/**
|
|
6069
|
+
* The settings a shop's next document is finalised with, and where each
|
|
6070
|
+
* value came from (`shop`, `merchant` or `default`).
|
|
6071
|
+
* `GET /invoice-settings/profiles/{profile_id}/effective`
|
|
6072
|
+
*/
|
|
6073
|
+
async retrieveEffective(profileId, options) {
|
|
6074
|
+
return this.request(
|
|
6075
|
+
"GET",
|
|
6076
|
+
`/invoice-settings/profiles/${encodeURIComponent(profileId)}/effective`,
|
|
6077
|
+
{ ...options }
|
|
6078
|
+
);
|
|
6079
|
+
}
|
|
6080
|
+
/**
|
|
6081
|
+
* A sample invoice PDF rendered from the effective settings with unsaved
|
|
6082
|
+
* values laid over them, so a form can show what saving would produce.
|
|
6083
|
+
* Writes nothing.
|
|
6084
|
+
* `POST /invoice-settings/preview`
|
|
6085
|
+
*/
|
|
6086
|
+
async preview(params, options) {
|
|
6087
|
+
return this.request("POST", "/invoice-settings/preview", {
|
|
6088
|
+
body: params,
|
|
6089
|
+
responseType: "blob",
|
|
6090
|
+
...options
|
|
6091
|
+
});
|
|
6092
|
+
}
|
|
6093
|
+
// --- Logo -----------------------------------------------------------------
|
|
6094
|
+
/**
|
|
6095
|
+
* The merchant default's logo image.
|
|
6096
|
+
* `GET /invoice-settings/logo`
|
|
6097
|
+
*/
|
|
6098
|
+
async retrieveLogo(options) {
|
|
6099
|
+
return this.request("GET", "/invoice-settings/logo", { responseType: "blob", ...options });
|
|
6100
|
+
}
|
|
6101
|
+
/**
|
|
6102
|
+
* Set the merchant default's logo: PNG or JPEG, at most 1 MB, as base64.
|
|
6103
|
+
* `PUT /invoice-settings/logo`
|
|
6104
|
+
*/
|
|
6105
|
+
async updateLogo(params, options) {
|
|
6106
|
+
return this.request("PUT", "/invoice-settings/logo", { body: params, ...options });
|
|
6107
|
+
}
|
|
6108
|
+
/**
|
|
6109
|
+
* Remove the merchant default's logo.
|
|
6110
|
+
* `DELETE /invoice-settings/logo`
|
|
6111
|
+
*/
|
|
6112
|
+
async deleteLogo(options) {
|
|
6113
|
+
return this.request("DELETE", "/invoice-settings/logo", { ...options });
|
|
6114
|
+
}
|
|
6115
|
+
/**
|
|
6116
|
+
* One shop's own logo image.
|
|
6117
|
+
* `GET /invoice-settings/profiles/{profile_id}/logo`
|
|
6118
|
+
*/
|
|
6119
|
+
async retrieveLogoForShop(profileId, options) {
|
|
6120
|
+
return this.request("GET", `/invoice-settings/profiles/${encodeURIComponent(profileId)}/logo`, {
|
|
6121
|
+
responseType: "blob",
|
|
6122
|
+
...options
|
|
6123
|
+
});
|
|
6124
|
+
}
|
|
6125
|
+
/**
|
|
6126
|
+
* Set one shop's own logo: PNG or JPEG, at most 1 MB, as base64.
|
|
6127
|
+
* `PUT /invoice-settings/profiles/{profile_id}/logo`
|
|
6128
|
+
*/
|
|
6129
|
+
async updateLogoForShop(profileId, params, options) {
|
|
6130
|
+
return this.request("PUT", `/invoice-settings/profiles/${encodeURIComponent(profileId)}/logo`, {
|
|
6131
|
+
body: params,
|
|
6132
|
+
...options
|
|
6133
|
+
});
|
|
6134
|
+
}
|
|
6135
|
+
/**
|
|
6136
|
+
* Remove one shop's own logo; the shop then inherits the merchant default's.
|
|
6137
|
+
* `DELETE /invoice-settings/profiles/{profile_id}/logo`
|
|
6138
|
+
*/
|
|
6139
|
+
async deleteLogoForShop(profileId, options) {
|
|
6140
|
+
return this.request(
|
|
6141
|
+
"DELETE",
|
|
6142
|
+
`/invoice-settings/profiles/${encodeURIComponent(profileId)}/logo`,
|
|
6143
|
+
{ ...options }
|
|
6144
|
+
);
|
|
6145
|
+
}
|
|
6146
|
+
// --- Tax rules ------------------------------------------------------------
|
|
6147
|
+
/**
|
|
6148
|
+
* The merchant's tax rules, which every shop without a list of its own uses.
|
|
6149
|
+
* `GET /invoice-settings/tax-rules`
|
|
6150
|
+
*/
|
|
6151
|
+
async retrieveTaxRules(options) {
|
|
6152
|
+
return this.request("GET", "/invoice-settings/tax-rules", { ...options });
|
|
6153
|
+
}
|
|
6154
|
+
/**
|
|
6155
|
+
* Replace the merchant's whole rule list; the order is the priority.
|
|
6156
|
+
* `PUT /invoice-settings/tax-rules`
|
|
6157
|
+
*/
|
|
6158
|
+
async updateTaxRules(params, options) {
|
|
6159
|
+
return this.request("PUT", "/invoice-settings/tax-rules", { body: params, ...options });
|
|
6160
|
+
}
|
|
6161
|
+
/**
|
|
6162
|
+
* The rules one shop uses: its own list, or the merchant's it inherits, as
|
|
6163
|
+
* `own_rules` says.
|
|
6164
|
+
* `GET /invoice-settings/profiles/{profile_id}/tax-rules`
|
|
6165
|
+
*/
|
|
6166
|
+
async retrieveTaxRulesForShop(profileId, options) {
|
|
6167
|
+
return this.request(
|
|
6168
|
+
"GET",
|
|
6169
|
+
`/invoice-settings/profiles/${encodeURIComponent(profileId)}/tax-rules`,
|
|
6170
|
+
{ ...options }
|
|
6171
|
+
);
|
|
6172
|
+
}
|
|
6173
|
+
/**
|
|
6174
|
+
* Give one shop a list of its own, replacing the merchant's for that shop —
|
|
6175
|
+
* even when empty, which leaves every line of the shop to the settings'
|
|
6176
|
+
* default rate.
|
|
6177
|
+
* `PUT /invoice-settings/profiles/{profile_id}/tax-rules`
|
|
6178
|
+
*/
|
|
6179
|
+
async updateTaxRulesForShop(profileId, params, options) {
|
|
6180
|
+
return this.request(
|
|
6181
|
+
"PUT",
|
|
6182
|
+
`/invoice-settings/profiles/${encodeURIComponent(profileId)}/tax-rules`,
|
|
6183
|
+
{ body: params, ...options }
|
|
6184
|
+
);
|
|
6185
|
+
}
|
|
6186
|
+
/**
|
|
6187
|
+
* Drop one shop's own list, so it inherits the merchant's again. Returns
|
|
6188
|
+
* the list the shop now uses.
|
|
6189
|
+
* `DELETE /invoice-settings/profiles/{profile_id}/tax-rules`
|
|
6190
|
+
*/
|
|
6191
|
+
async deleteTaxRulesForShop(profileId, options) {
|
|
6192
|
+
return this.request(
|
|
6193
|
+
"DELETE",
|
|
6194
|
+
`/invoice-settings/profiles/${encodeURIComponent(profileId)}/tax-rules`,
|
|
6195
|
+
{ ...options }
|
|
6196
|
+
);
|
|
6197
|
+
}
|
|
6198
|
+
/**
|
|
6199
|
+
* Which saved rule a buyer and a product tax category would meet, and what
|
|
6200
|
+
* the line would be taxed at. Writes nothing.
|
|
6201
|
+
* `POST /invoice-settings/tax-rules/evaluate`
|
|
6202
|
+
*/
|
|
6203
|
+
async evaluateTaxRules(params, options) {
|
|
6204
|
+
return this.request("POST", "/invoice-settings/tax-rules/evaluate", {
|
|
6205
|
+
body: params,
|
|
6206
|
+
...options
|
|
6207
|
+
});
|
|
6208
|
+
}
|
|
6209
|
+
};
|
|
6210
|
+
|
|
5828
6211
|
// src/resources/processorCosts.ts
|
|
5829
6212
|
var ProcessorCosts = class {
|
|
5830
6213
|
constructor(request) {
|
|
@@ -7097,6 +7480,54 @@ var ReplayRetention = class {
|
|
|
7097
7480
|
}
|
|
7098
7481
|
};
|
|
7099
7482
|
|
|
7483
|
+
// src/resources/settings.ts
|
|
7484
|
+
function projectQuery(query) {
|
|
7485
|
+
return query.project_id ? { project_id: query.project_id } : {};
|
|
7486
|
+
}
|
|
7487
|
+
var Settings = class {
|
|
7488
|
+
constructor(request) {
|
|
7489
|
+
this.request = request;
|
|
7490
|
+
}
|
|
7491
|
+
/**
|
|
7492
|
+
* The merchant's settings, or one project's.
|
|
7493
|
+
*
|
|
7494
|
+
* `GET /settings/merchant`
|
|
7495
|
+
*/
|
|
7496
|
+
async retrieveMerchant(query = {}) {
|
|
7497
|
+
return this.request("GET", "/settings/merchant", { query: projectQuery(query) });
|
|
7498
|
+
}
|
|
7499
|
+
/**
|
|
7500
|
+
* Change the merchant's own settings, or one project's. All changes are
|
|
7501
|
+
* applied or none is.
|
|
7502
|
+
*
|
|
7503
|
+
* `PATCH /settings/merchant`
|
|
7504
|
+
*/
|
|
7505
|
+
async updateMerchant(params, query = {}) {
|
|
7506
|
+
return this.request("PATCH", "/settings/merchant", {
|
|
7507
|
+
body: params,
|
|
7508
|
+
query: projectQuery(query)
|
|
7509
|
+
});
|
|
7510
|
+
}
|
|
7511
|
+
/**
|
|
7512
|
+
* One shop's settings.
|
|
7513
|
+
*
|
|
7514
|
+
* `GET /settings/shops/{profileId}`
|
|
7515
|
+
*/
|
|
7516
|
+
async retrieveShop(profileId) {
|
|
7517
|
+
return this.request("GET", `/settings/shops/${encodeURIComponent(profileId)}`);
|
|
7518
|
+
}
|
|
7519
|
+
/**
|
|
7520
|
+
* Change one shop's own settings.
|
|
7521
|
+
*
|
|
7522
|
+
* `PATCH /settings/shops/{profileId}`
|
|
7523
|
+
*/
|
|
7524
|
+
async updateShop(profileId, params) {
|
|
7525
|
+
return this.request("PATCH", `/settings/shops/${encodeURIComponent(profileId)}`, {
|
|
7526
|
+
body: params
|
|
7527
|
+
});
|
|
7528
|
+
}
|
|
7529
|
+
};
|
|
7530
|
+
|
|
7100
7531
|
// src/resources/risk.ts
|
|
7101
7532
|
var Risk = class {
|
|
7102
7533
|
constructor(request) {
|
|
@@ -7359,6 +7790,7 @@ var Delopay = class {
|
|
|
7359
7790
|
this.settlement = new Settlement(request);
|
|
7360
7791
|
this.operationLimits = new OperationLimits(request);
|
|
7361
7792
|
this.replayRetention = new ReplayRetention(request);
|
|
7793
|
+
this.settings = new Settings(request);
|
|
7362
7794
|
this.risk = new Risk(request);
|
|
7363
7795
|
this.subscriptions = new Subscriptions(request);
|
|
7364
7796
|
this.buyerPortal = new BuyerPortal(request);
|
|
@@ -7371,6 +7803,8 @@ var Delopay = class {
|
|
|
7371
7803
|
this.costRules = new CostRules(request);
|
|
7372
7804
|
this.externalRecords = new ExternalRecords(request);
|
|
7373
7805
|
this.products = new Products(request);
|
|
7806
|
+
this.invoices = new Invoices(request);
|
|
7807
|
+
this.invoiceSettings = new InvoiceSettingsResource(request);
|
|
7374
7808
|
this.processorCosts = new ProcessorCosts(request);
|
|
7375
7809
|
this.checkoutBrowserInfo = new CheckoutBrowserInfo(request);
|
|
7376
7810
|
this.checkoutMethods = new CheckoutMethods(request);
|
|
@@ -12866,6 +13300,57 @@ var PlatformFeeRulesManager = class {
|
|
|
12866
13300
|
}
|
|
12867
13301
|
};
|
|
12868
13302
|
|
|
13303
|
+
// src/internal/resources/platformSettings.ts
|
|
13304
|
+
var PlatformSettings = class {
|
|
13305
|
+
constructor(request) {
|
|
13306
|
+
this.request = request;
|
|
13307
|
+
}
|
|
13308
|
+
/** `GET /admin-portal/settings` */
|
|
13309
|
+
async retrieve() {
|
|
13310
|
+
return this.request("GET", "/admin-portal/settings");
|
|
13311
|
+
}
|
|
13312
|
+
/**
|
|
13313
|
+
* Change platform settings. All changes are applied or none is.
|
|
13314
|
+
*
|
|
13315
|
+
* `PATCH /admin-portal/settings`
|
|
13316
|
+
*/
|
|
13317
|
+
async update(params) {
|
|
13318
|
+
return this.request("PATCH", "/admin-portal/settings", { body: params });
|
|
13319
|
+
}
|
|
13320
|
+
/** `GET /admin-portal/accounts/{merchantId}/settings` */
|
|
13321
|
+
async retrieveMerchant(merchantId, query = {}) {
|
|
13322
|
+
return this.request(
|
|
13323
|
+
"GET",
|
|
13324
|
+
`/admin-portal/accounts/${encodeURIComponent(merchantId)}/settings`,
|
|
13325
|
+
{
|
|
13326
|
+
query: projectQuery2(query)
|
|
13327
|
+
}
|
|
13328
|
+
);
|
|
13329
|
+
}
|
|
13330
|
+
/** `PATCH /admin-portal/accounts/{merchantId}/settings` */
|
|
13331
|
+
async updateMerchant(merchantId, params, query = {}) {
|
|
13332
|
+
return this.request(
|
|
13333
|
+
"PATCH",
|
|
13334
|
+
`/admin-portal/accounts/${encodeURIComponent(merchantId)}/settings`,
|
|
13335
|
+
{ body: params, query: projectQuery2(query) }
|
|
13336
|
+
);
|
|
13337
|
+
}
|
|
13338
|
+
/** `GET /admin-portal/accounts/{merchantId}/shops/{profileId}/settings` */
|
|
13339
|
+
async retrieveShop(merchantId, profileId) {
|
|
13340
|
+
return this.request("GET", shopPath(merchantId, profileId));
|
|
13341
|
+
}
|
|
13342
|
+
/** `PATCH /admin-portal/accounts/{merchantId}/shops/{profileId}/settings` */
|
|
13343
|
+
async updateShop(merchantId, profileId, params) {
|
|
13344
|
+
return this.request("PATCH", shopPath(merchantId, profileId), { body: params });
|
|
13345
|
+
}
|
|
13346
|
+
};
|
|
13347
|
+
function shopPath(merchantId, profileId) {
|
|
13348
|
+
return `/admin-portal/accounts/${encodeURIComponent(merchantId)}/shops/${encodeURIComponent(profileId)}/settings`;
|
|
13349
|
+
}
|
|
13350
|
+
function projectQuery2(query) {
|
|
13351
|
+
return query.project_id ? { project_id: query.project_id } : {};
|
|
13352
|
+
}
|
|
13353
|
+
|
|
12869
13354
|
// src/internal/resources/nativeRenewals.ts
|
|
12870
13355
|
var NativeRenewals = class {
|
|
12871
13356
|
constructor(request, serviceKey) {
|
|
@@ -12903,6 +13388,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
12903
13388
|
this.gsm = new Gsm(request);
|
|
12904
13389
|
this.platformBilling = new PlatformBilling(request);
|
|
12905
13390
|
this.platformFees = new PlatformFees(request);
|
|
13391
|
+
this.platformSettings = new PlatformSettings(request);
|
|
12906
13392
|
this.nativeRenewals = new NativeRenewals(request, args[0] ?? "");
|
|
12907
13393
|
}
|
|
12908
13394
|
};
|
|
@@ -12974,6 +13460,8 @@ var DelopayInternal = class extends Delopay {
|
|
|
12974
13460
|
GOOGLE_PAY_BUTTON_COLORS,
|
|
12975
13461
|
GOOGLE_PAY_BUTTON_TYPES,
|
|
12976
13462
|
Gsm,
|
|
13463
|
+
InvoiceSettingsResource,
|
|
13464
|
+
Invoices,
|
|
12977
13465
|
LOCALIZABLE_COPY_FIELDS,
|
|
12978
13466
|
MAX_SECTION_LABEL_LENGTH,
|
|
12979
13467
|
MAX_SECTION_ORDER,
|
|
@@ -13000,6 +13488,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
13000
13488
|
PaypalDisputes,
|
|
13001
13489
|
PlatformBilling,
|
|
13002
13490
|
PlatformFees,
|
|
13491
|
+
PlatformSettings,
|
|
13003
13492
|
ProcessorCosts,
|
|
13004
13493
|
Products,
|
|
13005
13494
|
RTL_CHECKOUT_LOCALES,
|
|
@@ -13026,6 +13515,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
13026
13515
|
SURCHARGE_WEIGHTS,
|
|
13027
13516
|
Search,
|
|
13028
13517
|
SellToRestrictions,
|
|
13518
|
+
Settings,
|
|
13029
13519
|
Settlement,
|
|
13030
13520
|
Subscriptions,
|
|
13031
13521
|
UNKNOWN_SECTION_ORDER,
|