rerobe-js-orm 3.7.7 → 3.7.9

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.
@@ -5,7 +5,7 @@ const Order_1 = require("../../models/Order");
5
5
  const order_constants_1 = require("../../constants/order-constants");
6
6
  class OrderFromFormState extends OrderFactory_1.default {
7
7
  createOrder(fs) {
8
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
8
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
9
9
  const currencyCode = fs.fields.currencyCode.inputValue || 'SEK';
10
10
  const customer = fs.fields.customer.selectedValue || {};
11
11
  const customerAttr = {
@@ -98,7 +98,13 @@ class OrderFromFormState extends OrderFactory_1.default {
98
98
  fulfillmentStatus: fs.fields.fulfillmentStatus.selectedValue,
99
99
  statusUrl: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.statusUrl) || '',
100
100
  };
101
- const orderAttributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, totalPricesAttr), presentmentTotalPricesAttr), discountsAttr), shippingAndLocationAttr), customerAttr), statusesAttr), { id: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.id) || '', documentId: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.documentId) || '', name: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.name) || '', orderNumber: (_o = fs.props) === null || _o === void 0 ? void 0 : _o.orderNumber, ribbnOrderNumber: (_p = fs.props) === null || _p === void 0 ? void 0 : _p.ribbnOrderNumber, merchantId: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.merchantId) || '', currencyCode: fs.fields.currencyCode.inputValue, lineItems: fs.fields.lineItems.selectedValues || [], fulfillments: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.fulfillments) || [], refunds: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.refunds) || [], paymentType: fs.fields.paymentType.selectedValue, paymentMethod: fs.fields.paymentMethod.selectedValue || '', paymentDetails: fs.fields.paymentDetails.selectedValue || {}, notes: fs.fields.notes.inputValue || '', tags: fs.fields.tags.selectedValues || [], cancelReason: fs.fields.cancelReason.selectedValue || '', canceledAt: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.canceledAt) || '', processedAt: ((_u = fs.props) === null || _u === void 0 ? void 0 : _u.processedAt) || new Date().toUTCString(), adjustments: ((_v = fs.props) === null || _v === void 0 ? void 0 : _v.adjustments) || [], createdAtTimestamp: 0, updatedAtTimestamp: 0, createdByUserId: ((_w = fs.props) === null || _w === void 0 ? void 0 : _w.createdByUserId) || '', taxTitle: fs.fields.taxTitle.inputValue || '' });
101
+ const orderAttributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, totalPricesAttr), presentmentTotalPricesAttr), discountsAttr), shippingAndLocationAttr), customerAttr), statusesAttr), { id: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.id) || '', documentId: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.documentId) || '', name: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.name) || '', orderNumber: (_o = fs.props) === null || _o === void 0 ? void 0 : _o.orderNumber, ribbnOrderNumber: (_p = fs.props) === null || _p === void 0 ? void 0 : _p.ribbnOrderNumber, merchantId: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.merchantId) || '', currencyCode: fs.fields.currencyCode.inputValue, lineItems: fs.fields.lineItems.selectedValues || [], fulfillments: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.fulfillments) || [], refunds: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.refunds) || [], paymentType: fs.fields.paymentType.selectedValue, paymentMethod: fs.fields.paymentMethod.selectedValue || '', paymentDetails: fs.fields.paymentDetails.selectedValue || {}, notes: fs.fields.notes.inputValue || '', tags: fs.fields.tags.selectedValues || [], cancelReason: fs.fields.cancelReason.selectedValue || '', canceledAt: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.canceledAt) || '', processedAt: ((_u = fs.props) === null || _u === void 0 ? void 0 : _u.processedAt) || new Date().toUTCString(), adjustments: ((_v = fs.props) === null || _v === void 0 ? void 0 : _v.adjustments) || [], createdAtTimestamp: 0, updatedAtTimestamp: 0, createdByUserId: ((_w = fs.props) === null || _w === void 0 ? void 0 : _w.createdByUserId) || '', taxTitle: fs.fields.taxTitle.inputValue || '' }), (((_x = fs.props) === null || _x === void 0 ? void 0 : _x.zettleTransactionObj) && {
102
+ zettleTransactionObj: (_y = fs.props) === null || _y === void 0 ? void 0 : _y.zettleTransactionObj,
103
+ })), (((_z = fs.props) === null || _z === void 0 ? void 0 : _z.paymentIntentObj) && {
104
+ paymentIntentObj: (_0 = fs.props) === null || _0 === void 0 ? void 0 : _0.paymentIntentObj,
105
+ })), (((_1 = fs.props) === null || _1 === void 0 ? void 0 : _1.paymentIntentId) && {
106
+ paymentIntentId: (_2 = fs.props) === null || _2 === void 0 ? void 0 : _2.paymentIntentId,
107
+ }));
102
108
  return new Order_1.default(Object.assign({}, orderAttributes));
103
109
  }
104
110
  }
@@ -214,4 +214,36 @@ export default class OrderHelpers {
214
214
  };
215
215
  shippingFeeTax?: undefined;
216
216
  };
217
+ getPaymentTerminalReceiptInfo(payload?: any): PaymentTerminalReceiptInfo;
218
+ getFormattedFulfillmentLocation(order: ReRobeOrderObj): string;
219
+ buildReceiptObjFromOrder({ order, merchant }: {
220
+ order: ReRobeOrderObj;
221
+ merchant: MerchantObj;
222
+ }): {
223
+ aid: string;
224
+ tvr: string;
225
+ authorizationCode: string;
226
+ entryMode: string;
227
+ applicationName: string;
228
+ cardBrand: string;
229
+ lastFour: string;
230
+ referenceNumber: string;
231
+ merchantName: string;
232
+ storeAddress: string;
233
+ phone: string;
234
+ contactEmail: string;
235
+ organizationNumber: string | undefined;
236
+ primaryDomain: string;
237
+ orderDate: string;
238
+ lineItems: {
239
+ title: string;
240
+ price: string;
241
+ quantity: string | number;
242
+ showUnitPrice: boolean;
243
+ unitPrice: string;
244
+ }[];
245
+ subTotal: string;
246
+ amountPaid: string;
247
+ tax: string;
248
+ };
217
249
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const Order_1 = require("../models/Order");
4
+ const Utilities_1 = require("../helpers/Utilities");
4
5
  class OrderHelpers {
5
6
  getOrderIdFromShopifyObj(order) {
6
7
  const { id, tags } = order;
@@ -467,5 +468,133 @@ class OrderHelpers {
467
468
  totalTaxPresentment: prepareMoneyObj(totalTaxPresentmentAmount),
468
469
  };
469
470
  }
471
+ getPaymentTerminalReceiptInfo(payload) {
472
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
473
+ let aid = '';
474
+ let tvr = '';
475
+ let authorizationCode = '';
476
+ let entryMode = '';
477
+ let applicationName = '';
478
+ let cardBrand = '';
479
+ let lastFour = '';
480
+ let referenceNumber = '';
481
+ if (payload === null || payload === void 0 ? void 0 : payload.zettleTransactionObj) {
482
+ aid = (_b = (_a = payload.zettleTransactionObj) === null || _a === void 0 ? void 0 : _a.applicationIdentifier) !== null && _b !== void 0 ? _b : '';
483
+ tvr = (_d = (_c = payload.zettleTransactionObj) === null || _c === void 0 ? void 0 : _c.tvr) !== null && _d !== void 0 ? _d : '';
484
+ authorizationCode = (_f = (_e = payload.zettleTransactionObj) === null || _e === void 0 ? void 0 : _e.authorizationCode) !== null && _f !== void 0 ? _f : '';
485
+ entryMode = (_h = (_g = payload.zettleTransactionObj) === null || _g === void 0 ? void 0 : _g.entryMode) !== null && _h !== void 0 ? _h : '';
486
+ applicationName = (_k = (_j = payload.zettleTransactionObj) === null || _j === void 0 ? void 0 : _j.applicationName) !== null && _k !== void 0 ? _k : '';
487
+ cardBrand = (_m = (_l = payload.zettleTransactionObj) === null || _l === void 0 ? void 0 : _l.cardBrand) !== null && _m !== void 0 ? _m : '';
488
+ lastFour = (_q = (_p = (_o = payload.zettleTransactionObj) === null || _o === void 0 ? void 0 : _o.obfuscatedPan) === null || _p === void 0 ? void 0 : _p.slice(-4)) !== null && _q !== void 0 ? _q : '';
489
+ referenceNumber = (_s = (_r = payload.zettleTransactionObj) === null || _r === void 0 ? void 0 : _r.referenceNumber) !== null && _s !== void 0 ? _s : '';
490
+ }
491
+ else if (payload === null || payload === void 0 ? void 0 : payload.paymentIntentObj) {
492
+ const charge = (_t = payload.paymentIntentObj.charges) === null || _t === void 0 ? void 0 : _t[0];
493
+ aid = (_x = (_w = (_v = (_u = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _u === void 0 ? void 0 : _u.cardPresentDetails) === null || _v === void 0 ? void 0 : _v.receipt) === null || _w === void 0 ? void 0 : _w.dedicatedFileName) !== null && _x !== void 0 ? _x : '';
494
+ tvr = (_1 = (_0 = (_z = (_y = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _y === void 0 ? void 0 : _y.cardPresentDetails) === null || _z === void 0 ? void 0 : _z.receipt) === null || _0 === void 0 ? void 0 : _0.terminalVerificationResults) !== null && _1 !== void 0 ? _1 : '';
495
+ authorizationCode = (_5 = (_4 = (_3 = (_2 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _2 === void 0 ? void 0 : _2.cardPresentDetails) === null || _3 === void 0 ? void 0 : _3.receipt) === null || _4 === void 0 ? void 0 : _4.authorizationCode) !== null && _5 !== void 0 ? _5 : '';
496
+ entryMode = (_8 = (_7 = (_6 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _6 === void 0 ? void 0 : _6.cardPresentDetails) === null || _7 === void 0 ? void 0 : _7.readMethod) !== null && _8 !== void 0 ? _8 : '';
497
+ applicationName = (_12 = (_11 = (_10 = (_9 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _9 === void 0 ? void 0 : _9.cardPresentDetails) === null || _10 === void 0 ? void 0 : _10.receipt) === null || _11 === void 0 ? void 0 : _11.applicationPreferredName) !== null && _12 !== void 0 ? _12 : '';
498
+ cardBrand = (_15 = (_14 = (_13 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _13 === void 0 ? void 0 : _13.cardPresentDetails) === null || _14 === void 0 ? void 0 : _14.brand) !== null && _15 !== void 0 ? _15 : '';
499
+ lastFour = (_18 = (_17 = (_16 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _16 === void 0 ? void 0 : _16.cardPresentDetails) === null || _17 === void 0 ? void 0 : _17.last4) !== null && _18 !== void 0 ? _18 : '';
500
+ referenceNumber = (_19 = charge === null || charge === void 0 ? void 0 : charge.id) !== null && _19 !== void 0 ? _19 : '';
501
+ }
502
+ return {
503
+ aid,
504
+ tvr,
505
+ authorizationCode,
506
+ entryMode,
507
+ applicationName,
508
+ cardBrand,
509
+ lastFour,
510
+ referenceNumber,
511
+ };
512
+ }
513
+ getFormattedFulfillmentLocation(order) {
514
+ var _a;
515
+ const { fulfillmentLocations = [] } = order;
516
+ if (fulfillmentLocations.length === 0) {
517
+ return 'No fulfillment location available';
518
+ }
519
+ const location = (_a = fulfillmentLocations[0]) === null || _a === void 0 ? void 0 : _a.location;
520
+ return (0, Utilities_1.convertAddressInputToFormatted)(location);
521
+ }
522
+ buildReceiptObjFromOrder({ order, merchant }) {
523
+ var _a, _b, _c, _d, _e, _f, _g;
524
+ const { address: merchantAddress, legalName, contactEmail, phone, organizationNumber, primaryDomain, currency: storeCurrencyCode, } = merchant;
525
+ const currencyCode = ((_a = order.totalPricePresentment) === null || _a === void 0 ? void 0 : _a.currencyCode) || storeCurrencyCode;
526
+ const presentmentLocale = (0, Utilities_1.getPresentmentLocaleByCurrencyCode)(currencyCode);
527
+ const mapLineItem = (l) => {
528
+ var _a, _b, _c;
529
+ let totalPrice = Number((_a = l.presentmentTotalPrice) === null || _a === void 0 ? void 0 : _a.amount);
530
+ if (l.isTaxable && l.taxRate) {
531
+ const taxRate = Number(l.taxRate);
532
+ totalPrice *= 1 + taxRate;
533
+ }
534
+ return {
535
+ title: l.title || l.brand || '',
536
+ price: (0, Utilities_1.formatPrice)({
537
+ currencyCode,
538
+ amount: totalPrice,
539
+ fractionDigits: 2,
540
+ }),
541
+ quantity: l === null || l === void 0 ? void 0 : l.quantity,
542
+ showUnitPrice: Number(l === null || l === void 0 ? void 0 : l.quantity) > 1,
543
+ unitPrice: (0, Utilities_1.formatPrice)({
544
+ currencyCode,
545
+ amount: (_c = (_b = l === null || l === void 0 ? void 0 : l.originalUnitPrice) === null || _b === void 0 ? void 0 : _b.amount) !== null && _c !== void 0 ? _c : '',
546
+ fractionDigits: 2,
547
+ }),
548
+ };
549
+ };
550
+ const buildLineItems = () => {
551
+ var _a, _b, _c, _d;
552
+ let result = order.lineItems.map(mapLineItem);
553
+ if (((_a = order.totalDiscountPresentment) === null || _a === void 0 ? void 0 : _a.amount) && Number((_b = order.totalDiscountPresentment) === null || _b === void 0 ? void 0 : _b.amount) > 0) {
554
+ result = [
555
+ ...result,
556
+ {
557
+ title: 'Discount',
558
+ price: (0, Utilities_1.formatPrice)({
559
+ currencyCode,
560
+ amount: (_c = order.totalDiscountPresentment) === null || _c === void 0 ? void 0 : _c.amount,
561
+ fractionDigits: 2,
562
+ }),
563
+ showUnitPrice: false,
564
+ quantity: 1,
565
+ unitPrice: (0, Utilities_1.formatPrice)({
566
+ currencyCode,
567
+ amount: (_d = order.totalDiscountPresentment) === null || _d === void 0 ? void 0 : _d.amount,
568
+ fractionDigits: 2,
569
+ }),
570
+ },
571
+ ];
572
+ }
573
+ return result;
574
+ };
575
+ const buildStoreAddress = () => {
576
+ let address = this.getFormattedFulfillmentLocation(order);
577
+ if (!address) {
578
+ address = (0, Utilities_1.convertAddressInputToFormatted)(merchantAddress);
579
+ }
580
+ return address;
581
+ };
582
+ return Object.assign({ merchantName: legalName, storeAddress: buildStoreAddress(), phone,
583
+ contactEmail,
584
+ organizationNumber,
585
+ primaryDomain, orderDate: (0, Utilities_1.getFormattedTimestamp)(presentmentLocale), lineItems: buildLineItems(), subTotal: (0, Utilities_1.formatPrice)({
586
+ currencyCode,
587
+ amount: (_c = (_b = order.subtotalPricePresentment) === null || _b === void 0 ? void 0 : _b.amount) !== null && _c !== void 0 ? _c : '',
588
+ fractionDigits: 2,
589
+ }), amountPaid: (0, Utilities_1.formatPrice)({
590
+ currencyCode,
591
+ amount: (_e = (_d = order.totalPricePresentment) === null || _d === void 0 ? void 0 : _d.amount) !== null && _e !== void 0 ? _e : '',
592
+ fractionDigits: 2,
593
+ }), tax: (0, Utilities_1.formatPrice)({
594
+ currencyCode,
595
+ amount: (_g = (_f = order.totalTaxPresentment) === null || _f === void 0 ? void 0 : _f.amount) !== null && _g !== void 0 ? _g : '',
596
+ fractionDigits: 2,
597
+ }) }, this.getPaymentTerminalReceiptInfo(order));
598
+ }
470
599
  }
471
600
  exports.default = OrderHelpers;
@@ -30,3 +30,11 @@ export default class Utilities {
30
30
  humanize(str: string): string;
31
31
  singularizeProductType(word: string): string;
32
32
  }
33
+ export declare function getPresentmentLocaleByCurrencyCode(currencyCode: string): string;
34
+ export declare function convertAddressInputToFormatted(address?: AddressInput | null): string;
35
+ export declare function formatPrice({ currencyCode, amount, fractionDigits, }: {
36
+ currencyCode: string;
37
+ amount: string | number;
38
+ fractionDigits?: number;
39
+ }): string;
40
+ export declare function getFormattedTimestamp(locale: string): string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFormattedTimestamp = exports.formatPrice = exports.convertAddressInputToFormatted = exports.getPresentmentLocaleByCurrencyCode = void 0;
3
4
  // @ts-ignore
4
5
  const lodash_1 = require("lodash");
5
6
  class Utilities {
@@ -205,3 +206,60 @@ class Utilities {
205
206
  }
206
207
  }
207
208
  exports.default = Utilities;
209
+ function initFormatter(locale = 'en-US', currency = 'SEK') {
210
+ return new Intl.NumberFormat(locale, {
211
+ style: 'currency',
212
+ currency: currency || 'SEK',
213
+ // These options are needed to round to whole numbers if that's what you want.
214
+ // minimumFractionDigits: 0, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)
215
+ // maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)
216
+ });
217
+ }
218
+ function getPresentmentLocaleByCurrencyCode(currencyCode) {
219
+ let presentmentLocale = 'en-US';
220
+ if (currencyCode) {
221
+ if (currencyCode === 'SEK') {
222
+ presentmentLocale = 'sv-SE';
223
+ }
224
+ if (currencyCode === 'NOK') {
225
+ presentmentLocale = 'nb-NO';
226
+ }
227
+ if (currencyCode === 'USD') {
228
+ presentmentLocale = 'en-US';
229
+ }
230
+ if (currencyCode === 'GBP') {
231
+ presentmentLocale = 'en-UK';
232
+ }
233
+ if (currencyCode === 'EUR') {
234
+ presentmentLocale = 'en-DE';
235
+ }
236
+ }
237
+ return presentmentLocale;
238
+ }
239
+ exports.getPresentmentLocaleByCurrencyCode = getPresentmentLocaleByCurrencyCode;
240
+ function convertAddressInputToFormatted(address) {
241
+ if (!address) {
242
+ return '';
243
+ }
244
+ const { address1 = '', address2 = '', city = '', province = '', zip = '', country = '' } = address;
245
+ if (!address1 && !city && !zip && !country) {
246
+ return '';
247
+ }
248
+ const formattedAddress = `${address1}${address2 ? `\n${address2}` : ''}\n${city}${province ? `, ${province}` : ''}, ${zip}, ${country}`;
249
+ return formattedAddress;
250
+ }
251
+ exports.convertAddressInputToFormatted = convertAddressInputToFormatted;
252
+ function formatPrice({ currencyCode, amount, fractionDigits = 2, }) {
253
+ const presentmentLocale = getPresentmentLocaleByCurrencyCode(currencyCode);
254
+ const priceFormatter = initFormatter(presentmentLocale, currencyCode);
255
+ const valueToFormat = Number(parseFloat(String(amount)).toFixed(fractionDigits));
256
+ return priceFormatter.format(valueToFormat);
257
+ }
258
+ exports.formatPrice = formatPrice;
259
+ function getFormattedTimestamp(locale) {
260
+ const date = new Date();
261
+ const hours = String(date.getHours()).padStart(2, '0');
262
+ const minutes = String(date.getMinutes()).padStart(2, '0');
263
+ return `${date.toLocaleDateString(locale)} ${hours}:${minutes}`;
264
+ }
265
+ exports.getFormattedTimestamp = getFormattedTimestamp;
@@ -104,6 +104,9 @@ export default class Order extends Base {
104
104
  updatedAtTimestamp: number;
105
105
  adjustments?: OrderAdjustment[];
106
106
  createdByUserId?: string;
107
+ zettleTransactionObj?: ZettleTransactionObj;
108
+ paymentIntentObj?: any;
109
+ paymentIntentId?: string;
107
110
  constructor(props?: any);
108
111
  toObj(): ReRobeOrderObj;
109
112
  generateSchemaForTypesense(name?: string): {
@@ -129,6 +129,15 @@ class Order extends Base_1.default {
129
129
  this.updatedAtTimestamp = (props === null || props === void 0 ? void 0 : props.updatedAtTimestamp) || 0;
130
130
  this.adjustments = (props === null || props === void 0 ? void 0 : props.adjustments) || [];
131
131
  this.createdByUserId = (props === null || props === void 0 ? void 0 : props.createdByUserId) || '';
132
+ if (props === null || props === void 0 ? void 0 : props.zettleTransactionObj) {
133
+ this.zettleTransactionObj = props.zettleTransactionObj;
134
+ }
135
+ if (props === null || props === void 0 ? void 0 : props.paymentIntentObj) {
136
+ this.paymentIntentObj = props.paymentIntentObj;
137
+ }
138
+ if (props === null || props === void 0 ? void 0 : props.paymentIntentId) {
139
+ this.paymentIntentId = props.paymentIntentId;
140
+ }
132
141
  }
133
142
  toObj() {
134
143
  const orderObj = {
@@ -205,6 +214,15 @@ class Order extends Base_1.default {
205
214
  if (this.createdByUserId) {
206
215
  orderObj.createdByUserId = this.createdByUserId;
207
216
  }
217
+ if (this.zettleTransactionObj) {
218
+ this.zettleTransactionObj = this.zettleTransactionObj;
219
+ }
220
+ if (this.paymentIntentObj) {
221
+ orderObj.paymentIntentObj = this.paymentIntentObj;
222
+ }
223
+ if (this.paymentIntentId) {
224
+ orderObj.paymentIntentId = this.paymentIntentId;
225
+ }
208
226
  return orderObj;
209
227
  }
210
228
  generateSchemaForTypesense(name = 'prod_orders_20220809') {
@@ -12,6 +12,25 @@ export default class Product extends Base {
12
12
  toProductInputObjForShopifyV2(locationId: string, weightUnit?: string): any[];
13
13
  toObjForTextTranslation(): TranslatableAttributes;
14
14
  toObjForTypesense(): TypesenseProductObj;
15
+ buildUpdatedFieldsForSalesChannel(): {
16
+ title: string;
17
+ description: string;
18
+ price: string;
19
+ gender: string;
20
+ productCategory: string;
21
+ productType: string;
22
+ productStyle: string[];
23
+ brand: string;
24
+ color: string;
25
+ size: string;
26
+ materialComposition: MaterialComposition;
27
+ salePrice: string;
28
+ isOnSale: string;
29
+ discountType: string;
30
+ discountValue: string;
31
+ selectedForClearance: string;
32
+ status: string;
33
+ };
15
34
  updateSelfFromTranslatedTextArray(translatedTextArray?: string[]): void;
16
35
  autoCreateTitle(): string;
17
36
  autoCreateMetaDataTitle(): string;
@@ -380,6 +380,27 @@ class Product extends Base_1.default {
380
380
  });
381
381
  return stagedObj;
382
382
  }
383
+ buildUpdatedFieldsForSalesChannel() {
384
+ return {
385
+ title: this.attributes.title,
386
+ description: this.attributes.description,
387
+ price: this.attributes.price,
388
+ gender: this.filterAttributes.gender,
389
+ productCategory: this.filterAttributes.productCategory,
390
+ productType: this.filterAttributes.productType,
391
+ productStyle: this.filterAttributes.productStyle,
392
+ brand: this.filterAttributes.brand,
393
+ color: this.filterAttributes.color,
394
+ size: this.filterAttributes.size,
395
+ materialComposition: this.filterAttributes.materialComposition,
396
+ salePrice: this.consignmentAttributes.salePrice,
397
+ isOnSale: this.consignmentAttributes.isOnSale,
398
+ discountType: this.consignmentAttributes.discountType,
399
+ discountValue: this.consignmentAttributes.discountValue,
400
+ selectedForClearance: this.consignmentAttributes.selectedForClearance,
401
+ status: this.consignmentAttributes.status,
402
+ };
403
+ }
383
404
  updateSelfFromTranslatedTextArray(translatedTextArray = []) {
384
405
  const checkFieldTranslated = (val) => {
385
406
  return val !== this.FIELD_NOT_TRANSLATABLE_KEY;
@@ -22,6 +22,7 @@ type MerchantMutableData = {
22
22
  primaryDomain: string;
23
23
  webhooks: MerchantWebHook[];
24
24
  socialLinks: SocialLinksType | null;
25
+ organizationNumber?: string;
25
26
  };
26
27
  type MerchantSystemOnlyMutableData = {
27
28
  paymentTier: RibbnPaymentTiers | string;
@@ -35,6 +36,7 @@ type MerchantSystemOnlyMutableData = {
35
36
  ribbnId: string;
36
37
  webshopHomePageId: string;
37
38
  defaultLocation: string;
39
+ isZettleUser?: boolean;
38
40
  };
39
41
  type MerchantObj = MerchantMutableData & MerchantSystemOnlyMutableData;
40
42
  type MerchantTypes = 'INDIVIDUAL' | 'BUSINESS';
@@ -15,6 +15,30 @@ type DraftOrderObj = {
15
15
  billingAddress?: AddressInput;
16
16
  shippingAddress?: AddressInput;
17
17
  };
18
+ type ZettleTransactionObj = {
19
+ applicationIdentifier: string;
20
+ obfuscatedPan: string;
21
+ cardBrand: string;
22
+ referenceNumber: string;
23
+ transactionId: string;
24
+ gratuityAmount: string;
25
+ tvr: string;
26
+ amount: string;
27
+ authorizationCode: string;
28
+ entryMode: string;
29
+ applicationName: string;
30
+ panHash: string;
31
+ };
32
+ interface PaymentTerminalReceiptInfo {
33
+ aid: string;
34
+ tvr: string;
35
+ authorizationCode: string;
36
+ entryMode: string;
37
+ applicationName: string;
38
+ cardBrand: string;
39
+ lastFour: string;
40
+ referenceNumber: string;
41
+ }
18
42
  type ReRobeOrderObj = {
19
43
  id: string;
20
44
  appliedDiscount: AppliedDiscount;
@@ -82,6 +106,9 @@ type ReRobeOrderObj = {
82
106
  adjustments?: OrderAdjustment[];
83
107
  createdAtTimestamp: number;
84
108
  updatedAtTimestamp: number;
109
+ zettleTransactionObj?: ZettleTransactionObj;
110
+ paymentIntentObj?: any;
111
+ paymentIntentId?: string;
85
112
  };
86
113
  type OrderWithRefundsAndFulfillmentsInfoObj = {
87
114
  documentId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.7.7",
3
+ "version": "3.7.9",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",