@dotdev/harmony-sdk 1.18.0 → 1.19.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/HarmonyAPI.d.ts +5 -2
- package/dist/HarmonyAPI.js +9 -0
- package/dist/modules/carrier/carrier.module.d.ts +1 -1
- package/dist/modules/carrier/carrier.module.js +1 -1
- package/dist/modules/carrier/carrier.module.spec.js +1 -1
- package/dist/modules/point-of-sale/mappings/process-returns.mapper.d.ts +15 -0
- package/dist/modules/point-of-sale/mappings/process-returns.mapper.js +128 -0
- package/dist/modules/point-of-sale/point-of-sale.module.d.ts +4 -3
- package/dist/modules/point-of-sale/point-of-sale.module.js +42 -3
- package/dist/modules/point-of-sale/types/process-returns.interface.d.ts +3 -1
- package/package.json +1 -1
package/dist/HarmonyAPI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAxiosRetryConfig } from "axios-retry";
|
|
2
|
-
import { AuthenticationToken, Carrier, CarrierShipment, CreateDiaryQueryParams, Diary, GetCarrierShipmentByTimeQueryParams, GetDiaryQueryParams, ProcessInvoiceQueryParams, ProcessSaleOrderQueryParams, ProcessSaleOrderWithoutPaymentQueryParams, SizeGrid, Stock, StockBarcode, StockCategory, StockClassification, StockClassificationType, StockColor, StockLevel, StockLevelLookupQueryParams, StockLookupRequestParams, Warehouse } from "./modules";
|
|
2
|
+
import { AuthenticationToken, Carrier, CarrierShipment, CreateDiaryQueryParams, Diary, DispatchData, GetCarrierShipmentByTimeQueryParams, GetDiaryQueryParams, GetDispatchDataByTimeQueryParams, ProcessInvoiceQueryParams, ProcessReturnsQueryParams, ProcessSaleOrderQueryParams, ProcessSaleOrderWithoutPaymentQueryParams, SizeGrid, Stock, StockBarcode, StockCategory, StockClassification, StockClassificationType, StockColor, StockLevel, StockLevelLookupQueryParams, StockLookupRequestParams, Warehouse } from "./modules";
|
|
3
3
|
import { GiftVoucher, GiftVoucherLookupQueryParams, GiftVoucherReservationQueryParams, GiftVoucherUsedQueryParams, GiftVoucherVerificationKeyQueryParams } from "./modules/gift-voucher/types";
|
|
4
4
|
export declare class HarmonyAPI {
|
|
5
5
|
private baseUrl;
|
|
@@ -25,12 +25,15 @@ export declare class HarmonyAPI {
|
|
|
25
25
|
processSalesOrder(params: ProcessSaleOrderQueryParams, sessionId: string): Promise<boolean>;
|
|
26
26
|
processSalesOrderWithoutPayment(params: ProcessSaleOrderWithoutPaymentQueryParams, sessionId: string): Promise<boolean>;
|
|
27
27
|
mapOrderPayloadToXml(params: Partial<ProcessSaleOrderQueryParams>, sessionId: string, method?: "ProcessSalesOrder" | "ProcessSalesOrderWithoutPayment" | "ProcessInvoice"): Promise<string>;
|
|
28
|
+
mapReturnPayloadToXml(params: ProcessReturnsQueryParams, sessionId: string): Promise<string>;
|
|
28
29
|
processInvoice(params: ProcessInvoiceQueryParams, sessionId: string): Promise<boolean>;
|
|
29
|
-
processReturns(params:
|
|
30
|
+
processReturns(params: ProcessReturnsQueryParams, sessionId: string): Promise<boolean>;
|
|
30
31
|
modifyExistingSalesOrder(params: ProcessSaleOrderQueryParams, sessionId: string): Promise<boolean>;
|
|
31
32
|
cancelExistingSalesOrder(params: ProcessSaleOrderQueryParams, sessionId: string): Promise<boolean>;
|
|
32
33
|
getCarrier(sessionId: string): Promise<Carrier[]>;
|
|
33
34
|
getCarrierShipmentByOrderNo(orderNo: string, sessionId: string): Promise<CarrierShipment[]>;
|
|
35
|
+
getDispatchDataByTime(params: GetDispatchDataByTimeQueryParams, sessionId: string): Promise<DispatchData[]>;
|
|
36
|
+
getDispatchDataByOrderNo(orderNo: string, sessionId: string): Promise<DispatchData[]>;
|
|
34
37
|
getCarrierBySysTime(params: GetCarrierShipmentByTimeQueryParams, sessionId: string): Promise<CarrierShipment[]>;
|
|
35
38
|
getDiaryBy(params: GetDiaryQueryParams, sessionId: string): Promise<Diary[]>;
|
|
36
39
|
createDiary(params: CreateDiaryQueryParams, sessionId: string): Promise<boolean>;
|
package/dist/HarmonyAPI.js
CHANGED
|
@@ -91,6 +91,9 @@ export class HarmonyAPI {
|
|
|
91
91
|
async mapOrderPayloadToXml(params, sessionId, method) {
|
|
92
92
|
return await this.pointOfSaleModule.mapOrderPayloadToXml(params, sessionId, method);
|
|
93
93
|
}
|
|
94
|
+
async mapReturnPayloadToXml(params, sessionId) {
|
|
95
|
+
return await this.pointOfSaleModule.mapReturnPayloadToXml(params, sessionId);
|
|
96
|
+
}
|
|
94
97
|
// Post fulfilled orders
|
|
95
98
|
async processInvoice(params, sessionId) {
|
|
96
99
|
return await this.pointOfSaleModule.processInvoice(params, sessionId);
|
|
@@ -111,6 +114,12 @@ export class HarmonyAPI {
|
|
|
111
114
|
async getCarrierShipmentByOrderNo(orderNo, sessionId) {
|
|
112
115
|
return await this.carrierModule.getCarrierShipmentByOrderNumber(orderNo, sessionId);
|
|
113
116
|
}
|
|
117
|
+
async getDispatchDataByTime(params, sessionId) {
|
|
118
|
+
return await this.carrierModule.getDispatchDataByTime(params, sessionId);
|
|
119
|
+
}
|
|
120
|
+
async getDispatchDataByOrderNo(orderNo, sessionId) {
|
|
121
|
+
return await this.carrierModule.getDispatchDataByOrderNo(orderNo, sessionId);
|
|
122
|
+
}
|
|
114
123
|
async getCarrierBySysTime(params, sessionId) {
|
|
115
124
|
return await this.carrierModule.getCarrierShipmentBySysTime(params, sessionId);
|
|
116
125
|
}
|
|
@@ -7,6 +7,6 @@ export declare class CarrierModule {
|
|
|
7
7
|
getCarrier(sessionId: string): Promise<Carrier[]>;
|
|
8
8
|
getCarrierShipmentByOrderNumber(orderNo: string, sessionId: string): Promise<CarrierShipment[]>;
|
|
9
9
|
getCarrierShipmentBySysTime(params: GetCarrierShipmentByTimeQueryParams, sessionId: string): Promise<CarrierShipment[]>;
|
|
10
|
-
|
|
10
|
+
getDispatchDataByOrderNo(orderNo: string, sessionId: string): Promise<DispatchData[]>;
|
|
11
11
|
getDispatchDataByTime(params: GetDispatchDataByTimeQueryParams, sessionId: string): Promise<DispatchData[]>;
|
|
12
12
|
}
|
|
@@ -36,7 +36,7 @@ export class CarrierModule {
|
|
|
36
36
|
throw await ApiHelper.parseError(error);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
async
|
|
39
|
+
async getDispatchDataByOrderNo(orderNo, sessionId) {
|
|
40
40
|
const bodyStr = mapGetDispatchDataByOrderNoQueryParams(orderNo);
|
|
41
41
|
try {
|
|
42
42
|
const response = await ApiHelper.sendServiceRequest(this.SERVICE_URL, ["GetDispatchDataByOrderNumber", "Request"], sessionId, ServiceAlias.CARRIER, this.axiosInstance, bodyStr);
|
|
@@ -257,7 +257,7 @@ describe("CarrierModule.getDispatchDataByOrderNo()", () => {
|
|
|
257
257
|
sysModTime: '23-08-2024 16:11:24'
|
|
258
258
|
};
|
|
259
259
|
mAxios.post.mockResolvedValueOnce(mockedResp);
|
|
260
|
-
const response = await carrierModule.
|
|
260
|
+
const response = await carrierModule.getDispatchDataByOrderNo(orderNo, token);
|
|
261
261
|
// Test that expected response is correct
|
|
262
262
|
expect(Array.isArray(response)).toBe(true);
|
|
263
263
|
expect(response.length).toBe(1);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProcessReturnsQueryDebtor, ProcessReturnsQueryExtra, ProcessReturnsQueryHeader, ProcessReturnsQueryParams, ProcessReturnsQueryStock } from "../types";
|
|
2
|
+
export declare function mapProcessReturnsQueryParams(params: ProcessReturnsQueryParams): string;
|
|
3
|
+
export declare function mapProcessReturnsBaseQueryParams(params: ProcessReturnsQueryParams): {
|
|
4
|
+
mode: import("../types").PosQueryMode | undefined;
|
|
5
|
+
audit_no: string;
|
|
6
|
+
export_no: string | undefined;
|
|
7
|
+
header: string;
|
|
8
|
+
extra: string;
|
|
9
|
+
stock: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare function mapProcessReturnsQueryHeaders(params: ProcessReturnsQueryHeader): string;
|
|
12
|
+
export declare function mapProcessReturnsQueryExtra(params: ProcessReturnsQueryExtra): string;
|
|
13
|
+
export declare function mapReturnsInvoiceQuery(params: ProcessReturnsQueryParams): string;
|
|
14
|
+
export declare function mapProcessReturnsQueryStock(params: ProcessReturnsQueryStock): string;
|
|
15
|
+
export declare function mapProcessReturnsQueryDebtor(params: ProcessReturnsQueryDebtor): string;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Utils } from "../../../helpers";
|
|
2
|
+
export function mapProcessReturnsQueryParams(params) {
|
|
3
|
+
const body = {
|
|
4
|
+
...mapProcessReturnsBaseQueryParams(params),
|
|
5
|
+
invoice: mapReturnsInvoiceQuery(params),
|
|
6
|
+
debtor: (params?.debtor ?? []).map(mapProcessReturnsQueryDebtor),
|
|
7
|
+
};
|
|
8
|
+
return Utils.toXml(Utils.deleteEmptyProps(body));
|
|
9
|
+
}
|
|
10
|
+
export function mapProcessReturnsBaseQueryParams(params) {
|
|
11
|
+
return {
|
|
12
|
+
mode: params?.mode,
|
|
13
|
+
audit_no: params?.auditNo,
|
|
14
|
+
export_no: params?.exportNo,
|
|
15
|
+
header: mapProcessReturnsQueryHeaders(params?.header),
|
|
16
|
+
extra: params?.extra ? mapProcessReturnsQueryExtra(params.extra) : "",
|
|
17
|
+
stock: params?.stock.map(mapProcessReturnsQueryStock),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function mapProcessReturnsQueryHeaders(params) {
|
|
21
|
+
// XML body in JSON format, to be converted to XML string
|
|
22
|
+
const body = {
|
|
23
|
+
credit_no: params?.creditNo,
|
|
24
|
+
customer_order_no: params?.customerOrderNo,
|
|
25
|
+
transaction_date: params?.transactionDate,
|
|
26
|
+
transaction_time_hour: params?.transactionTimeHour,
|
|
27
|
+
transaction_time_min: params?.transactionTimeMin,
|
|
28
|
+
transaction_time_sec: params?.transactionTimeSec,
|
|
29
|
+
shop_debtor: params?.shopDebtor,
|
|
30
|
+
diary: params?.diary,
|
|
31
|
+
diary_name_1: params?.diaryName1,
|
|
32
|
+
diary_name_2: params?.diaryName2,
|
|
33
|
+
warehouse: params?.warehouse,
|
|
34
|
+
originated_warehouse: params?.originatedWarehouse,
|
|
35
|
+
agent_zone_1: params?.agentZone1,
|
|
36
|
+
agent_zone_2: params?.agentZone2 ?? "",
|
|
37
|
+
agent_zone_3: params?.agentZone3 ?? "",
|
|
38
|
+
terminal_id: params?.terminalId,
|
|
39
|
+
order_class: params?.orderClass,
|
|
40
|
+
user: params?.user,
|
|
41
|
+
comment_1: params?.comment1,
|
|
42
|
+
comment_2: params?.comment2,
|
|
43
|
+
comment_3: params?.comment3,
|
|
44
|
+
comment_4: params?.comment4,
|
|
45
|
+
comment_5: params?.comment5,
|
|
46
|
+
comment_6: params?.comment6,
|
|
47
|
+
comment_7: params?.comment7,
|
|
48
|
+
comment_8: params?.comment8,
|
|
49
|
+
comment_9: params?.comment9,
|
|
50
|
+
comment_10: params?.comment10,
|
|
51
|
+
order_tax_exemption: params?.orderTaxExemption,
|
|
52
|
+
originator_software: params?.originatorSoftware,
|
|
53
|
+
account_sale_flag: params?.accountSaleFlag,
|
|
54
|
+
};
|
|
55
|
+
return Utils.deleteEmptyProps(body);
|
|
56
|
+
}
|
|
57
|
+
export function mapProcessReturnsQueryExtra(params) {
|
|
58
|
+
// XML body in JSON format, to be converted to XML string
|
|
59
|
+
const body = {
|
|
60
|
+
email: params?.email,
|
|
61
|
+
telephone_home: params?.telephoneHome,
|
|
62
|
+
telephone_mobile: params?.telephoneMobile,
|
|
63
|
+
telephone_work: params?.telephoneWork,
|
|
64
|
+
billing_surname: params?.billingSurname,
|
|
65
|
+
billing_first_name: params?.billingFirstname,
|
|
66
|
+
billing_address_1: params?.billingAddress1,
|
|
67
|
+
billing_address_2: params?.billingAddress2,
|
|
68
|
+
billing_address_3: params?.billingAddress3,
|
|
69
|
+
billing_address_4: params?.billingAddress4,
|
|
70
|
+
billing_postcode: params?.billingPostcode,
|
|
71
|
+
billing_telephone_home: params?.billingTelephoneHome,
|
|
72
|
+
billing_telephone_mobile: params?.billingTelephoneMobile,
|
|
73
|
+
billing_telephone_work: params?.billingTelephoneWork,
|
|
74
|
+
customised_info: params?.customisedInfo,
|
|
75
|
+
};
|
|
76
|
+
return Utils.deleteEmptyProps(body);
|
|
77
|
+
}
|
|
78
|
+
export function mapReturnsInvoiceQuery(params) {
|
|
79
|
+
const body = {
|
|
80
|
+
invoice_price_inc: params?.invoice?.invoicePriceInc,
|
|
81
|
+
rounding: params?.invoice?.rounding,
|
|
82
|
+
total_tax: params?.invoice?.totalTax,
|
|
83
|
+
cash_drawer_id: params?.invoice?.cashDrawerId,
|
|
84
|
+
};
|
|
85
|
+
return Utils.deleteEmptyProps(body);
|
|
86
|
+
}
|
|
87
|
+
export function mapProcessReturnsQueryStock(params) {
|
|
88
|
+
// XML body in JSON format, to be converted to XML string
|
|
89
|
+
const body = {
|
|
90
|
+
stock: params?.stock,
|
|
91
|
+
stock_description: params?.stockDescription,
|
|
92
|
+
size: params?.size,
|
|
93
|
+
qdp: params?.qdp,
|
|
94
|
+
pdp: params?.pdp,
|
|
95
|
+
return_qty: params?.returnQty,
|
|
96
|
+
discount_price: params?.discountPrice,
|
|
97
|
+
line_tax: params?.lineTax,
|
|
98
|
+
discount_rate: params?.discountRate,
|
|
99
|
+
discount_reason: params?.discountReason,
|
|
100
|
+
credit_note_reason: params?.creditNoteReason,
|
|
101
|
+
serial_no: params?.serialNo,
|
|
102
|
+
comment: params?.comment,
|
|
103
|
+
credit_note_reference: params?.creditNoteReference,
|
|
104
|
+
current_rrp_inc: params?.currentRrpInc,
|
|
105
|
+
per: params?.per,
|
|
106
|
+
singles_per_pack: params?.singlesPerPack,
|
|
107
|
+
packs_per_carton: params?.packsPerCarton,
|
|
108
|
+
size_pack_name: params?.sizePackName,
|
|
109
|
+
};
|
|
110
|
+
return Utils.deleteEmptyProps(body);
|
|
111
|
+
}
|
|
112
|
+
export function mapProcessReturnsQueryDebtor(params) {
|
|
113
|
+
// XML body in JSON format, to be converted to XML string
|
|
114
|
+
const body = {
|
|
115
|
+
payment_type: params?.paymentType,
|
|
116
|
+
payment_amount: params?.paymentAmount,
|
|
117
|
+
card_name: params?.cardName,
|
|
118
|
+
card_no: params?.cardNo,
|
|
119
|
+
card_holder: params?.cardHolder,
|
|
120
|
+
card_expiry_month: params?.cardExpiryMonth,
|
|
121
|
+
card_expiry_year: params?.cardExpiryYear,
|
|
122
|
+
comment: params?.comment,
|
|
123
|
+
cash_drawer_id: params?.cashDrawerId,
|
|
124
|
+
gift_voucher_stock: params?.giftVoucherStock,
|
|
125
|
+
gift_voucher_serial_no: params?.giftVoucherSerialNo,
|
|
126
|
+
};
|
|
127
|
+
return Utils.deleteEmptyProps(body);
|
|
128
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import { ProcessInvoiceQueryParams, ProcessSaleOrderQueryParams, ProcessSaleOrderWithoutPaymentQueryParams } from "./types";
|
|
2
|
+
import { ProcessInvoiceQueryParams, ProcessReturnsQueryParams, ProcessSaleOrderQueryParams, ProcessSaleOrderWithoutPaymentQueryParams } from "./types";
|
|
3
3
|
export declare class PointOfSaleModule {
|
|
4
4
|
private axiosInstance;
|
|
5
5
|
private readonly SERVICE_URL;
|
|
@@ -22,6 +22,7 @@ export declare class PointOfSaleModule {
|
|
|
22
22
|
* @param {string} sessionId
|
|
23
23
|
*/
|
|
24
24
|
mapOrderPayloadToXml(params: Partial<ProcessSaleOrderQueryParams>, sessionId: string, method?: "ProcessSalesOrder" | "ProcessSalesOrderWithoutPayment" | "ProcessInvoice"): Promise<string>;
|
|
25
|
+
mapReturnPayloadToXml(params: ProcessReturnsQueryParams, sessionId: string): Promise<string>;
|
|
25
26
|
/**
|
|
26
27
|
* Function to call the ProcessSalesOrderWithoutPayment endpoint in Harmony Point Of Sale service
|
|
27
28
|
*
|
|
@@ -42,11 +43,11 @@ export declare class PointOfSaleModule {
|
|
|
42
43
|
* Function to call the ProcessReturns endpoint in Harmony Point Of Sale service
|
|
43
44
|
*
|
|
44
45
|
* @async
|
|
45
|
-
* @param {
|
|
46
|
+
* @param {ProcessReturnsQueryParams} params
|
|
46
47
|
* @param {string} sessionId
|
|
47
48
|
* @returns {Promise<boolean>}
|
|
48
49
|
*/
|
|
49
|
-
processReturns(params:
|
|
50
|
+
processReturns(params: ProcessReturnsQueryParams, sessionId: string): Promise<boolean>;
|
|
50
51
|
/**
|
|
51
52
|
* Function to call the ModifyExistingSalesOrder endpoint in Harmony Point Of Sale service
|
|
52
53
|
*
|
|
@@ -3,6 +3,7 @@ import { ServiceAlias } from "../shared";
|
|
|
3
3
|
import { mapPosInvoiceQuery, mapProcessInvoiceQueryParams, mapProcessSaleOrderQueryDebtor, mapProcessSaleOrderQueryExtra, mapProcessSaleOrderQueryHeaders, mapProcessSaleOrderQueryParams, mapProcessSaleOrderQueryStock, mapProcessSaleOrderWithoutPaymentQueryParams, } from "./mappings/process-sale-order.mapper";
|
|
4
4
|
import { promisify } from "util";
|
|
5
5
|
import { parseString } from "xml2js";
|
|
6
|
+
import { mapProcessReturnsQueryExtra, mapProcessReturnsQueryHeaders, mapProcessReturnsQueryParams, mapProcessReturnsQueryStock, mapReturnsInvoiceQuery } from "./mappings/process-returns.mapper";
|
|
6
7
|
const parseXml = promisify(parseString);
|
|
7
8
|
export class PointOfSaleModule {
|
|
8
9
|
axiosInstance;
|
|
@@ -81,6 +82,38 @@ export class PointOfSaleModule {
|
|
|
81
82
|
const parsedJson = await parseXml(fullXml);
|
|
82
83
|
return Utils.objectToXml(parsedJson);
|
|
83
84
|
}
|
|
85
|
+
async mapReturnPayloadToXml(params, sessionId) {
|
|
86
|
+
const soapNamespace = "S";
|
|
87
|
+
// Extract method name and construct corresponding properties for the body of the SOAP request and the response from the API
|
|
88
|
+
const bodyMethodName = "ProcessReturnsRequest";
|
|
89
|
+
let body = {
|
|
90
|
+
mode: params?.mode,
|
|
91
|
+
audit_no: params?.auditNo,
|
|
92
|
+
export_no: params?.exportNo,
|
|
93
|
+
header: mapProcessReturnsQueryHeaders(params?.header),
|
|
94
|
+
extra: params?.extra ? mapProcessReturnsQueryExtra(params.extra) : "",
|
|
95
|
+
stock: params?.stock?.map(mapProcessReturnsQueryStock),
|
|
96
|
+
invoice: mapReturnsInvoiceQuery(params),
|
|
97
|
+
debtor: (params?.debtor ?? []).map(mapProcessSaleOrderQueryDebtor)
|
|
98
|
+
};
|
|
99
|
+
const soapBodyJson = {};
|
|
100
|
+
soapBodyJson[`${ServiceAlias.POINT_OF_SALE}:${bodyMethodName}`] =
|
|
101
|
+
body;
|
|
102
|
+
const soapBody = Utils.objectToXml(soapBodyJson);
|
|
103
|
+
const soapHeader = `
|
|
104
|
+
<${ServiceAlias.POINT_OF_SALE}:SessionId>${sessionId}</${ServiceAlias.POINT_OF_SALE}:SessionId>
|
|
105
|
+
`;
|
|
106
|
+
const fullXml = `
|
|
107
|
+
<${soapNamespace}:Envelope xmlns:${soapNamespace}="http://schemas.xmlsoap.org/soap/envelope/" xmlns:${ServiceAlias.POINT_OF_SALE}="http://${ServiceAlias.POINT_OF_SALE}.ws.fbsaust.com.au">
|
|
108
|
+
<${soapNamespace}:Header>${soapHeader}</${soapNamespace}:Header>
|
|
109
|
+
<${soapNamespace}:Body>
|
|
110
|
+
${soapBody}
|
|
111
|
+
</${soapNamespace}:Body>
|
|
112
|
+
</${soapNamespace}:Envelope>
|
|
113
|
+
`;
|
|
114
|
+
const parsedJson = await parseXml(fullXml);
|
|
115
|
+
return Utils.objectToXml(parsedJson);
|
|
116
|
+
}
|
|
84
117
|
/**
|
|
85
118
|
* Function to call the ProcessSalesOrderWithoutPayment endpoint in Harmony Point Of Sale service
|
|
86
119
|
*
|
|
@@ -119,13 +152,19 @@ export class PointOfSaleModule {
|
|
|
119
152
|
* Function to call the ProcessReturns endpoint in Harmony Point Of Sale service
|
|
120
153
|
*
|
|
121
154
|
* @async
|
|
122
|
-
* @param {
|
|
155
|
+
* @param {ProcessReturnsQueryParams} params
|
|
123
156
|
* @param {string} sessionId
|
|
124
157
|
* @returns {Promise<boolean>}
|
|
125
158
|
*/
|
|
126
159
|
async processReturns(params, sessionId) {
|
|
127
|
-
|
|
128
|
-
|
|
160
|
+
try {
|
|
161
|
+
const requestBody = mapProcessReturnsQueryParams(params);
|
|
162
|
+
const response = await ApiHelper.sendServiceRequest(this.SERVICE_URL, ["ProcessReturns", "Request"], sessionId, ServiceAlias.POINT_OF_SALE, this.axiosInstance, requestBody);
|
|
163
|
+
return Boolean(response?.result[0] ?? "false");
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
throw await ApiHelper.parseError(error);
|
|
167
|
+
}
|
|
129
168
|
}
|
|
130
169
|
/**
|
|
131
170
|
* Function to call the ModifyExistingSalesOrder endpoint in Harmony Point Of Sale service
|
|
@@ -14,4 +14,6 @@ export interface ProcessReturnsQueryStock extends PosQueryStock {
|
|
|
14
14
|
}
|
|
15
15
|
export type ProcessReturnsQueryExtra = PosQueryExtra;
|
|
16
16
|
export type ProcessReturnsQueryInvoice = PosQueryInvoice;
|
|
17
|
-
export type ProcessReturnsQueryDebtor = PosQueryDebtor
|
|
17
|
+
export type ProcessReturnsQueryDebtor = Omit<PosQueryDebtor, "creditReference" | "reservationHistoryNo"> & {
|
|
18
|
+
cashDrawerId: string;
|
|
19
|
+
};
|