@misiki/gocommerce-connector 0.6.0 → 0.7.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.
@@ -4542,6 +4542,219 @@ declare class OrderService extends BaseService {
4542
4542
  noOfPage: number;
4543
4543
  page: number;
4544
4544
  }>;
4545
+ /**
4546
+ * Opens an order with its number and the email or phone on it, no code. The
4547
+ * engine answers one 404 for an unknown number and a wrong contact. The
4548
+ * token it answers is kept like an order placed in this browser, so the
4549
+ * order page and `getOrder` read it again.
4550
+ */
4551
+ openOrder({ orderNo, contact }: {
4552
+ orderNo: string;
4553
+ contact: string;
4554
+ }): Promise<{
4555
+ data: {
4556
+ id: string;
4557
+ orderNo: string;
4558
+ orderNumber: string;
4559
+ number: string;
4560
+ parentOrderNo: string;
4561
+ status: string;
4562
+ engineStatus: string;
4563
+ paymentStatus: string;
4564
+ paymentMethod: string;
4565
+ currencyCode: string;
4566
+ subtotal: number;
4567
+ shippingCharges: number;
4568
+ discount: number;
4569
+ tax: number;
4570
+ taxIncluded: boolean;
4571
+ total: number;
4572
+ refunded: number;
4573
+ codCharges: number;
4574
+ coupon: {
4575
+ code: string;
4576
+ } | null;
4577
+ userEmail: string;
4578
+ email: string;
4579
+ phone: string | null;
4580
+ shippingAddress: {
4581
+ firstName: string;
4582
+ lastName: string;
4583
+ email: string | null;
4584
+ phone: string | null;
4585
+ address_1: string;
4586
+ address_2: string;
4587
+ city: string;
4588
+ state: string;
4589
+ zip: string;
4590
+ country: string;
4591
+ countryCode: string;
4592
+ } | null;
4593
+ billingAddress: {
4594
+ firstName: string;
4595
+ lastName: string;
4596
+ email: string | null;
4597
+ phone: string | null;
4598
+ address_1: string;
4599
+ address_2: string;
4600
+ city: string;
4601
+ state: string;
4602
+ zip: string;
4603
+ country: string;
4604
+ countryCode: string;
4605
+ } | null;
4606
+ shippingMethod: string | null;
4607
+ shippingRate: {
4608
+ name: string;
4609
+ } | null;
4610
+ lineItems: {
4611
+ id: string;
4612
+ productId: string;
4613
+ variantId: string;
4614
+ sku: string;
4615
+ title: string;
4616
+ name: string;
4617
+ slug: string;
4618
+ thumbnail: string | null;
4619
+ img: string | null;
4620
+ variantTitle: string;
4621
+ qty: number;
4622
+ shippedQty: number;
4623
+ price: number;
4624
+ mrp: number;
4625
+ subtotal: number;
4626
+ total: number;
4627
+ currencyCode: string;
4628
+ status: string;
4629
+ files: never[];
4630
+ usedOptions: never[];
4631
+ }[];
4632
+ fulfillments: {
4633
+ id: string;
4634
+ status: string;
4635
+ carrier: string;
4636
+ trackingNumber: string | null;
4637
+ trackingUrl: string | null;
4638
+ lineItems: {
4639
+ id: string;
4640
+ title: string;
4641
+ qty: number;
4642
+ }[];
4643
+ createdAt: string;
4644
+ }[];
4645
+ tracking: never[];
4646
+ orderHistory: never[];
4647
+ isReplaceOrReturn: boolean;
4648
+ createdAt: string;
4649
+ updatedAt: string;
4650
+ }[];
4651
+ }>;
4652
+ /**
4653
+ * Opens an order from the link in its emails, which carries the order's key
4654
+ * (`/order-tracking?order=…&key=…`). The key is kept like an order placed in
4655
+ * this browser, so the page can drop it from the address bar.
4656
+ */
4657
+ openOrderWithKey({ orderNo, key }: {
4658
+ orderNo: string;
4659
+ key: string;
4660
+ }): Promise<{
4661
+ data: {
4662
+ id: string;
4663
+ orderNo: string;
4664
+ orderNumber: string;
4665
+ number: string;
4666
+ parentOrderNo: string;
4667
+ status: string;
4668
+ engineStatus: string;
4669
+ paymentStatus: string;
4670
+ paymentMethod: string;
4671
+ currencyCode: string;
4672
+ subtotal: number;
4673
+ shippingCharges: number;
4674
+ discount: number;
4675
+ tax: number;
4676
+ taxIncluded: boolean;
4677
+ total: number;
4678
+ refunded: number;
4679
+ codCharges: number;
4680
+ coupon: {
4681
+ code: string;
4682
+ } | null;
4683
+ userEmail: string;
4684
+ email: string;
4685
+ phone: string | null;
4686
+ shippingAddress: {
4687
+ firstName: string;
4688
+ lastName: string;
4689
+ email: string | null;
4690
+ phone: string | null;
4691
+ address_1: string;
4692
+ address_2: string;
4693
+ city: string;
4694
+ state: string;
4695
+ zip: string;
4696
+ country: string;
4697
+ countryCode: string;
4698
+ } | null;
4699
+ billingAddress: {
4700
+ firstName: string;
4701
+ lastName: string;
4702
+ email: string | null;
4703
+ phone: string | null;
4704
+ address_1: string;
4705
+ address_2: string;
4706
+ city: string;
4707
+ state: string;
4708
+ zip: string;
4709
+ country: string;
4710
+ countryCode: string;
4711
+ } | null;
4712
+ shippingMethod: string | null;
4713
+ shippingRate: {
4714
+ name: string;
4715
+ } | null;
4716
+ lineItems: {
4717
+ id: string;
4718
+ productId: string;
4719
+ variantId: string;
4720
+ sku: string;
4721
+ title: string;
4722
+ name: string;
4723
+ slug: string;
4724
+ thumbnail: string | null;
4725
+ img: string | null;
4726
+ variantTitle: string;
4727
+ qty: number;
4728
+ shippedQty: number;
4729
+ price: number;
4730
+ mrp: number;
4731
+ subtotal: number;
4732
+ total: number;
4733
+ currencyCode: string;
4734
+ status: string;
4735
+ files: never[];
4736
+ usedOptions: never[];
4737
+ }[];
4738
+ fulfillments: {
4739
+ id: string;
4740
+ status: string;
4741
+ carrier: string;
4742
+ trackingNumber: string | null;
4743
+ trackingUrl: string | null;
4744
+ lineItems: {
4745
+ id: string;
4746
+ title: string;
4747
+ qty: number;
4748
+ }[];
4749
+ createdAt: string;
4750
+ }[];
4751
+ tracking: never[];
4752
+ orderHistory: never[];
4753
+ isReplaceOrReturn: boolean;
4754
+ createdAt: string;
4755
+ updatedAt: string;
4756
+ }[];
4757
+ }>;
4545
4758
  /**
4546
4759
  * Sends a 4-digit code to the email or phone on the order, when `contact`
4547
4760
  * is that email or phone. The engine answers the same either way, so this
@@ -4542,6 +4542,219 @@ declare class OrderService extends BaseService {
4542
4542
  noOfPage: number;
4543
4543
  page: number;
4544
4544
  }>;
4545
+ /**
4546
+ * Opens an order with its number and the email or phone on it, no code. The
4547
+ * engine answers one 404 for an unknown number and a wrong contact. The
4548
+ * token it answers is kept like an order placed in this browser, so the
4549
+ * order page and `getOrder` read it again.
4550
+ */
4551
+ openOrder({ orderNo, contact }: {
4552
+ orderNo: string;
4553
+ contact: string;
4554
+ }): Promise<{
4555
+ data: {
4556
+ id: string;
4557
+ orderNo: string;
4558
+ orderNumber: string;
4559
+ number: string;
4560
+ parentOrderNo: string;
4561
+ status: string;
4562
+ engineStatus: string;
4563
+ paymentStatus: string;
4564
+ paymentMethod: string;
4565
+ currencyCode: string;
4566
+ subtotal: number;
4567
+ shippingCharges: number;
4568
+ discount: number;
4569
+ tax: number;
4570
+ taxIncluded: boolean;
4571
+ total: number;
4572
+ refunded: number;
4573
+ codCharges: number;
4574
+ coupon: {
4575
+ code: string;
4576
+ } | null;
4577
+ userEmail: string;
4578
+ email: string;
4579
+ phone: string | null;
4580
+ shippingAddress: {
4581
+ firstName: string;
4582
+ lastName: string;
4583
+ email: string | null;
4584
+ phone: string | null;
4585
+ address_1: string;
4586
+ address_2: string;
4587
+ city: string;
4588
+ state: string;
4589
+ zip: string;
4590
+ country: string;
4591
+ countryCode: string;
4592
+ } | null;
4593
+ billingAddress: {
4594
+ firstName: string;
4595
+ lastName: string;
4596
+ email: string | null;
4597
+ phone: string | null;
4598
+ address_1: string;
4599
+ address_2: string;
4600
+ city: string;
4601
+ state: string;
4602
+ zip: string;
4603
+ country: string;
4604
+ countryCode: string;
4605
+ } | null;
4606
+ shippingMethod: string | null;
4607
+ shippingRate: {
4608
+ name: string;
4609
+ } | null;
4610
+ lineItems: {
4611
+ id: string;
4612
+ productId: string;
4613
+ variantId: string;
4614
+ sku: string;
4615
+ title: string;
4616
+ name: string;
4617
+ slug: string;
4618
+ thumbnail: string | null;
4619
+ img: string | null;
4620
+ variantTitle: string;
4621
+ qty: number;
4622
+ shippedQty: number;
4623
+ price: number;
4624
+ mrp: number;
4625
+ subtotal: number;
4626
+ total: number;
4627
+ currencyCode: string;
4628
+ status: string;
4629
+ files: never[];
4630
+ usedOptions: never[];
4631
+ }[];
4632
+ fulfillments: {
4633
+ id: string;
4634
+ status: string;
4635
+ carrier: string;
4636
+ trackingNumber: string | null;
4637
+ trackingUrl: string | null;
4638
+ lineItems: {
4639
+ id: string;
4640
+ title: string;
4641
+ qty: number;
4642
+ }[];
4643
+ createdAt: string;
4644
+ }[];
4645
+ tracking: never[];
4646
+ orderHistory: never[];
4647
+ isReplaceOrReturn: boolean;
4648
+ createdAt: string;
4649
+ updatedAt: string;
4650
+ }[];
4651
+ }>;
4652
+ /**
4653
+ * Opens an order from the link in its emails, which carries the order's key
4654
+ * (`/order-tracking?order=…&key=…`). The key is kept like an order placed in
4655
+ * this browser, so the page can drop it from the address bar.
4656
+ */
4657
+ openOrderWithKey({ orderNo, key }: {
4658
+ orderNo: string;
4659
+ key: string;
4660
+ }): Promise<{
4661
+ data: {
4662
+ id: string;
4663
+ orderNo: string;
4664
+ orderNumber: string;
4665
+ number: string;
4666
+ parentOrderNo: string;
4667
+ status: string;
4668
+ engineStatus: string;
4669
+ paymentStatus: string;
4670
+ paymentMethod: string;
4671
+ currencyCode: string;
4672
+ subtotal: number;
4673
+ shippingCharges: number;
4674
+ discount: number;
4675
+ tax: number;
4676
+ taxIncluded: boolean;
4677
+ total: number;
4678
+ refunded: number;
4679
+ codCharges: number;
4680
+ coupon: {
4681
+ code: string;
4682
+ } | null;
4683
+ userEmail: string;
4684
+ email: string;
4685
+ phone: string | null;
4686
+ shippingAddress: {
4687
+ firstName: string;
4688
+ lastName: string;
4689
+ email: string | null;
4690
+ phone: string | null;
4691
+ address_1: string;
4692
+ address_2: string;
4693
+ city: string;
4694
+ state: string;
4695
+ zip: string;
4696
+ country: string;
4697
+ countryCode: string;
4698
+ } | null;
4699
+ billingAddress: {
4700
+ firstName: string;
4701
+ lastName: string;
4702
+ email: string | null;
4703
+ phone: string | null;
4704
+ address_1: string;
4705
+ address_2: string;
4706
+ city: string;
4707
+ state: string;
4708
+ zip: string;
4709
+ country: string;
4710
+ countryCode: string;
4711
+ } | null;
4712
+ shippingMethod: string | null;
4713
+ shippingRate: {
4714
+ name: string;
4715
+ } | null;
4716
+ lineItems: {
4717
+ id: string;
4718
+ productId: string;
4719
+ variantId: string;
4720
+ sku: string;
4721
+ title: string;
4722
+ name: string;
4723
+ slug: string;
4724
+ thumbnail: string | null;
4725
+ img: string | null;
4726
+ variantTitle: string;
4727
+ qty: number;
4728
+ shippedQty: number;
4729
+ price: number;
4730
+ mrp: number;
4731
+ subtotal: number;
4732
+ total: number;
4733
+ currencyCode: string;
4734
+ status: string;
4735
+ files: never[];
4736
+ usedOptions: never[];
4737
+ }[];
4738
+ fulfillments: {
4739
+ id: string;
4740
+ status: string;
4741
+ carrier: string;
4742
+ trackingNumber: string | null;
4743
+ trackingUrl: string | null;
4744
+ lineItems: {
4745
+ id: string;
4746
+ title: string;
4747
+ qty: number;
4748
+ }[];
4749
+ createdAt: string;
4750
+ }[];
4751
+ tracking: never[];
4752
+ orderHistory: never[];
4753
+ isReplaceOrReturn: boolean;
4754
+ createdAt: string;
4755
+ updatedAt: string;
4756
+ }[];
4757
+ }>;
4545
4758
  /**
4546
4759
  * Sends a 4-digit code to the email or phone on the order, when `contact`
4547
4760
  * is that email or phone. The engine answers the same either way, so this
package/dist/index.cjs CHANGED
@@ -2053,6 +2053,31 @@ var OrderService = class extends BaseService {
2053
2053
  async listPublic(_args = {}) {
2054
2054
  return emptyPage();
2055
2055
  }
2056
+ /**
2057
+ * Opens an order with its number and the email or phone on it, no code. The
2058
+ * engine answers one 404 for an unknown number and a wrong contact. The
2059
+ * token it answers is kept like an order placed in this browser, so the
2060
+ * order page and `getOrder` read it again.
2061
+ */
2062
+ async openOrder({ orderNo, contact }) {
2063
+ const res = await this.data(
2064
+ `/api/orders/${encodeURIComponent(orderNo.trim())}/open`,
2065
+ { method: "POST", body: { contact: contact.trim() } }
2066
+ );
2067
+ rememberOrder({ number: res.order.number, token: res.access_token, cartId: "" });
2068
+ return { data: [toOrder(res.order)] };
2069
+ }
2070
+ /**
2071
+ * Opens an order from the link in its emails, which carries the order's key
2072
+ * (`/order-tracking?order=…&key=…`). The key is kept like an order placed in
2073
+ * this browser, so the page can drop it from the address bar.
2074
+ */
2075
+ async openOrderWithKey({ orderNo, key }) {
2076
+ const number = orderNo.trim();
2077
+ const order = await this.data(`/api/orders/${encodeURIComponent(number)}`, { query: { token: key.trim() } });
2078
+ rememberOrder({ number: order.number, token: key.trim(), cartId: "" });
2079
+ return { data: [toOrder(order)] };
2080
+ }
2056
2081
  /**
2057
2082
  * Sends a 4-digit code to the email or phone on the order, when `contact`
2058
2083
  * is that email or phone. The engine answers the same either way, so this