@misiki/gocommerce-connector 0.26.0 → 0.27.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.
@@ -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. */
@@ -4874,6 +4880,7 @@ declare class PaymentMethodService extends BaseService {
4874
4880
  title: string;
4875
4881
  description: string;
4876
4882
  img: string | null;
4883
+ fee: number;
4877
4884
  rank: number;
4878
4885
  active: boolean;
4879
4886
  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. */
@@ -4874,6 +4880,7 @@ declare class PaymentMethodService extends BaseService {
4874
4880
  title: string;
4875
4881
  description: string;
4876
4882
  img: string | null;
4883
+ fee: number;
4877
4884
  rank: number;
4878
4885
  active: boolean;
4879
4886
  isActive: boolean;
package/dist/index.cjs CHANGED
@@ -993,7 +993,7 @@ function toOrder(o) {
993
993
  taxIncluded: o.tax_inclusive,
994
994
  total: toMajor(o.total),
995
995
  refunded: toMajor(o.refunded),
996
- codCharges: 0,
996
+ codCharges: toMajor(o.payment_fee),
997
997
  coupon: code ? { code } : null,
998
998
  userEmail: o.email,
999
999
  email: o.email,
@@ -2384,6 +2384,7 @@ var PaymentMethodService = class extends BaseService {
2384
2384
  title: m.name,
2385
2385
  description: "",
2386
2386
  img: drive(m.code).img ?? null,
2387
+ fee: toMajor(m.fee),
2387
2388
  rank: i,
2388
2389
  active: true,
2389
2390
  isActive: true
@@ -3248,7 +3249,8 @@ var StoreService = class extends BaseService {
3248
3249
  currency: {
3249
3250
  ...base.currency ?? {},
3250
3251
  code,
3251
- symbol: sameCurrency ? base.currency?.symbol ?? symbolFor(code) : symbolFor(code)
3252
+ symbol: sameCurrency ? base.currency?.symbol ?? symbolFor(code) : symbolFor(code),
3253
+ includesTax: profile?.prices_include_tax
3252
3254
  },
3253
3255
  language: ready.language,
3254
3256
  plugins: {