@misiki/gocommerce-connector 0.26.0 → 0.28.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-BWwh1d1q.d.cts → index-BaFtBtaA.d.cts} +10 -1
- package/dist/{index-BWwh1d1q.d.ts → index-BaFtBtaA.d.ts} +10 -1
- package/dist/index.cjs +12 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +12 -3
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +12 -3
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -386,6 +386,8 @@ type Order = {
|
|
|
386
386
|
shipping: Money;
|
|
387
387
|
shipping_method?: string;
|
|
388
388
|
discount: Money;
|
|
389
|
+
/** What the payment method added (D165): cash on delivery's extra charge. Absent on an engine before it. */
|
|
390
|
+
payment_fee?: Money;
|
|
389
391
|
tax: Money;
|
|
390
392
|
tax_inclusive: boolean;
|
|
391
393
|
total: Money;
|
|
@@ -413,9 +415,11 @@ type CheckoutResult = {
|
|
|
413
415
|
};
|
|
414
416
|
type CheckoutOptions = {
|
|
415
417
|
payment_methods: string[];
|
|
418
|
+
/** `fee` is what choosing the method adds to the order (D165); absent, it adds nothing. */
|
|
416
419
|
methods: {
|
|
417
420
|
code: string;
|
|
418
421
|
name: string;
|
|
422
|
+
fee?: Money;
|
|
419
423
|
}[];
|
|
420
424
|
currency: string;
|
|
421
425
|
};
|
|
@@ -558,6 +562,8 @@ type StoreProfile = {
|
|
|
558
562
|
phone: string;
|
|
559
563
|
support_url: string;
|
|
560
564
|
language: string;
|
|
565
|
+
/** Whether the store's prices include tax (D177); absent on an engine before it. */
|
|
566
|
+
prices_include_tax?: boolean;
|
|
561
567
|
/** Where the engine serves this store's pictures resized (D139); absent on an engine before it. */
|
|
562
568
|
images_path?: string;
|
|
563
569
|
/** The store's logo, logo for dark backgrounds and square icon (D148); empty or absent when it has none. */
|
|
@@ -1530,7 +1536,9 @@ declare class BaseService {
|
|
|
1530
1536
|
* Prices a cart at the signed-in shopper's customer-group prices. The
|
|
1531
1537
|
* engine does this only for an account whose email is confirmed (403
|
|
1532
1538
|
* otherwise), and the cart stays the shopper's either way — so a refusal
|
|
1533
|
-
* is not an error, and neither is a build without ext/identity.
|
|
1539
|
+
* is not an error, and neither is a build without ext/identity. A refused
|
|
1540
|
+
* claim still gives the cart the account's email, which the claim would
|
|
1541
|
+
* have set, or the checkout asks the shopper for it again.
|
|
1534
1542
|
*/
|
|
1535
1543
|
protected claimCartForAccount(cartId: string): Promise<void>;
|
|
1536
1544
|
/**
|
|
@@ -4874,6 +4882,7 @@ declare class PaymentMethodService extends BaseService {
|
|
|
4874
4882
|
title: string;
|
|
4875
4883
|
description: string;
|
|
4876
4884
|
img: string | null;
|
|
4885
|
+
fee: number;
|
|
4877
4886
|
rank: number;
|
|
4878
4887
|
active: boolean;
|
|
4879
4888
|
isActive: boolean;
|
|
@@ -386,6 +386,8 @@ type Order = {
|
|
|
386
386
|
shipping: Money;
|
|
387
387
|
shipping_method?: string;
|
|
388
388
|
discount: Money;
|
|
389
|
+
/** What the payment method added (D165): cash on delivery's extra charge. Absent on an engine before it. */
|
|
390
|
+
payment_fee?: Money;
|
|
389
391
|
tax: Money;
|
|
390
392
|
tax_inclusive: boolean;
|
|
391
393
|
total: Money;
|
|
@@ -413,9 +415,11 @@ type CheckoutResult = {
|
|
|
413
415
|
};
|
|
414
416
|
type CheckoutOptions = {
|
|
415
417
|
payment_methods: string[];
|
|
418
|
+
/** `fee` is what choosing the method adds to the order (D165); absent, it adds nothing. */
|
|
416
419
|
methods: {
|
|
417
420
|
code: string;
|
|
418
421
|
name: string;
|
|
422
|
+
fee?: Money;
|
|
419
423
|
}[];
|
|
420
424
|
currency: string;
|
|
421
425
|
};
|
|
@@ -558,6 +562,8 @@ type StoreProfile = {
|
|
|
558
562
|
phone: string;
|
|
559
563
|
support_url: string;
|
|
560
564
|
language: string;
|
|
565
|
+
/** Whether the store's prices include tax (D177); absent on an engine before it. */
|
|
566
|
+
prices_include_tax?: boolean;
|
|
561
567
|
/** Where the engine serves this store's pictures resized (D139); absent on an engine before it. */
|
|
562
568
|
images_path?: string;
|
|
563
569
|
/** The store's logo, logo for dark backgrounds and square icon (D148); empty or absent when it has none. */
|
|
@@ -1530,7 +1536,9 @@ declare class BaseService {
|
|
|
1530
1536
|
* Prices a cart at the signed-in shopper's customer-group prices. The
|
|
1531
1537
|
* engine does this only for an account whose email is confirmed (403
|
|
1532
1538
|
* otherwise), and the cart stays the shopper's either way — so a refusal
|
|
1533
|
-
* is not an error, and neither is a build without ext/identity.
|
|
1539
|
+
* is not an error, and neither is a build without ext/identity. A refused
|
|
1540
|
+
* claim still gives the cart the account's email, which the claim would
|
|
1541
|
+
* have set, or the checkout asks the shopper for it again.
|
|
1534
1542
|
*/
|
|
1535
1543
|
protected claimCartForAccount(cartId: string): Promise<void>;
|
|
1536
1544
|
/**
|
|
@@ -4874,6 +4882,7 @@ declare class PaymentMethodService extends BaseService {
|
|
|
4874
4882
|
title: string;
|
|
4875
4883
|
description: string;
|
|
4876
4884
|
img: string | null;
|
|
4885
|
+
fee: number;
|
|
4877
4886
|
rank: number;
|
|
4878
4887
|
active: boolean;
|
|
4879
4888
|
isActive: boolean;
|
package/dist/index.cjs
CHANGED
|
@@ -440,12 +440,19 @@ var BaseService = class _BaseService {
|
|
|
440
440
|
* Prices a cart at the signed-in shopper's customer-group prices. The
|
|
441
441
|
* engine does this only for an account whose email is confirmed (403
|
|
442
442
|
* otherwise), and the cart stays the shopper's either way — so a refusal
|
|
443
|
-
* is not an error, and neither is a build without ext/identity.
|
|
443
|
+
* is not an error, and neither is a build without ext/identity. A refused
|
|
444
|
+
* claim still gives the cart the account's email, which the claim would
|
|
445
|
+
* have set, or the checkout asks the shopper for it again.
|
|
444
446
|
*/
|
|
445
447
|
async claimCartForAccount(cartId) {
|
|
446
448
|
try {
|
|
447
449
|
await this.engine("/x/identity/me/carts", { method: "POST", body: { cart_id: cartId }, auth: true });
|
|
448
450
|
} catch {
|
|
451
|
+
const email = currentMe()?.email;
|
|
452
|
+
if (email)
|
|
453
|
+
await this.engine(`/api/carts/${encodeURIComponent(cartId)}/email`, { method: "PUT", body: { email } }).catch(
|
|
454
|
+
() => void 0
|
|
455
|
+
);
|
|
449
456
|
}
|
|
450
457
|
}
|
|
451
458
|
// ------------------------------------------------------------ Litekart verbs
|
|
@@ -993,7 +1000,7 @@ function toOrder(o) {
|
|
|
993
1000
|
taxIncluded: o.tax_inclusive,
|
|
994
1001
|
total: toMajor(o.total),
|
|
995
1002
|
refunded: toMajor(o.refunded),
|
|
996
|
-
codCharges:
|
|
1003
|
+
codCharges: toMajor(o.payment_fee),
|
|
997
1004
|
coupon: code ? { code } : null,
|
|
998
1005
|
userEmail: o.email,
|
|
999
1006
|
email: o.email,
|
|
@@ -2384,6 +2391,7 @@ var PaymentMethodService = class extends BaseService {
|
|
|
2384
2391
|
title: m.name,
|
|
2385
2392
|
description: "",
|
|
2386
2393
|
img: drive(m.code).img ?? null,
|
|
2394
|
+
fee: toMajor(m.fee),
|
|
2387
2395
|
rank: i,
|
|
2388
2396
|
active: true,
|
|
2389
2397
|
isActive: true
|
|
@@ -3248,7 +3256,8 @@ var StoreService = class extends BaseService {
|
|
|
3248
3256
|
currency: {
|
|
3249
3257
|
...base.currency ?? {},
|
|
3250
3258
|
code,
|
|
3251
|
-
symbol: sameCurrency ? base.currency?.symbol ?? symbolFor(code) : symbolFor(code)
|
|
3259
|
+
symbol: sameCurrency ? base.currency?.symbol ?? symbolFor(code) : symbolFor(code),
|
|
3260
|
+
includesTax: profile?.prices_include_tax
|
|
3252
3261
|
},
|
|
3253
3262
|
language: ready.language,
|
|
3254
3263
|
plugins: {
|