@aptos-scp/scp-component-store-selling-features-domain-model 1.46.7 → 1.47.1

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.
@@ -1034,4 +1034,8 @@ export declare enum AssignCustomerForReturnAction {
1034
1034
  Skip = "Skip"
1035
1035
  }
1036
1036
  export declare const DELIVERY_CONTACT_UPDATED_EVENT: string;
1037
+ export declare const PAYMENT_ACCOUNT_LOOKUP_EVENT: string;
1038
+ export interface IPaymentAccountLookupEventData {
1039
+ deviceIds: string[];
1040
+ }
1037
1041
  export declare const DELIVERY_SHIPPING_FEE_UPDATED_EVENT: string;
@@ -1041,5 +1041,6 @@ var AssignCustomerForReturnAction;
1041
1041
  AssignCustomerForReturnAction["Skip"] = "Skip";
1042
1042
  })(AssignCustomerForReturnAction = exports.AssignCustomerForReturnAction || (exports.AssignCustomerForReturnAction = {}));
1043
1043
  exports.DELIVERY_CONTACT_UPDATED_EVENT = "Delivery.ContactUpdated";
1044
+ exports.PAYMENT_ACCOUNT_LOOKUP_EVENT = "PaymentAccount.Lookup";
1044
1045
  exports.DELIVERY_SHIPPING_FEE_UPDATED_EVENT = "Delivery.ShippingFeeUpdated";
1045
1046
  //# sourceMappingURL=Constants.js.map
@@ -0,0 +1,12 @@
1
+ import { ITransactionLine } from "@aptos-scp/scp-component-store-selling-core";
2
+ import { ICardHolder } from "@aptos-scp/scp-types-commerce-devices";
3
+ import { PaymentAccountLookupResult } from "@aptos-scp/scp-types-commerce-transaction";
4
+ export interface IPaymentAccountLookupLine extends ITransactionLine {
5
+ readonly lookupResult: PaymentAccountLookupResult;
6
+ readonly lookupResultReason?: string;
7
+ readonly cardHolder?: ICardHolder;
8
+ readonly accountNumber?: string;
9
+ readonly cardToken?: string;
10
+ readonly referenceNumber?: string;
11
+ readonly authorizationDeviceId?: string;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPaymentAccountLookupLine.js.map
@@ -0,0 +1,29 @@
1
+ import { ITransactionLine, UiBusinessEvent } from "@aptos-scp/scp-component-store-selling-core";
2
+ import { PaymentAccountLookupResult } from "@aptos-scp/scp-types-commerce-transaction";
3
+ import { ICardHolder, ResponseCodes } from "@aptos-scp/scp-types-commerce-devices";
4
+ import { BaseTransactionLine } from "../BaseTransactionLine";
5
+ import { IPaymentAccountLookupLine } from "./IPaymentAccountLookupLine";
6
+ export declare const PAYMENT_ACCOUNT_LOOKUP_LINE_TYPE: string;
7
+ export declare class PaymentAccountLookupLine extends BaseTransactionLine implements IPaymentAccountLookupLine {
8
+ private readonly _cardHolder;
9
+ private readonly _lookupResult;
10
+ private readonly _lookupResultReason?;
11
+ private readonly _accountNumber?;
12
+ private readonly _cardToken?;
13
+ private readonly _referenceNumber?;
14
+ private readonly _authorizationDeviceId?;
15
+ static create(lineNumber: number, lineType: string, uiBusinessEvent: UiBusinessEvent, collectedData: Readonly<Map<string, any>>): PaymentAccountLookupLine;
16
+ static createFromJsonObject(transactionLineJsonObj: any): PaymentAccountLookupLine;
17
+ get couldAffectPricing(): boolean;
18
+ get lookupResult(): PaymentAccountLookupResult;
19
+ get lookupResultReason(): string;
20
+ get cardHolder(): ICardHolder;
21
+ get accountNumber(): string;
22
+ get cardToken(): string;
23
+ get referenceNumber(): string;
24
+ get authorizationDeviceId(): string;
25
+ protected constructor(lineNumber: number, lineType: string, cardHolder: ICardHolder, lookupResult?: PaymentAccountLookupResult, lookupResultReason?: string, accountNumber?: string, cardToken?: string, referenceNumber?: string, authorizationDeviceId?: string);
26
+ protected newTransactionLine(): PaymentAccountLookupLine;
27
+ }
28
+ export declare function isAccountLookupLine(transactionLine: ITransactionLine): transactionLine is PaymentAccountLookupLine;
29
+ export declare function convertLookupResultToResponseCode(lookupResult: PaymentAccountLookupResult): ResponseCodes;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const scp_types_commerce_transaction_1 = require("@aptos-scp/scp-types-commerce-transaction");
4
+ const scp_types_commerce_devices_1 = require("@aptos-scp/scp-types-commerce-devices");
5
+ const BaseTransactionLine_1 = require("../BaseTransactionLine");
6
+ const Constants_1 = require("../Constants");
7
+ exports.PAYMENT_ACCOUNT_LOOKUP_LINE_TYPE = "PaymentAccountLookup";
8
+ class PaymentAccountLookupLine extends BaseTransactionLine_1.BaseTransactionLine {
9
+ constructor(lineNumber, lineType, cardHolder, lookupResult, lookupResultReason, accountNumber, cardToken, referenceNumber, authorizationDeviceId) {
10
+ super(lineNumber, lineType);
11
+ this._cardHolder = cardHolder;
12
+ this._lookupResult = lookupResult;
13
+ this._lookupResultReason = lookupResultReason;
14
+ this._accountNumber = accountNumber;
15
+ this._cardToken = cardToken;
16
+ this._referenceNumber = referenceNumber;
17
+ this._authorizationDeviceId = authorizationDeviceId;
18
+ }
19
+ static create(lineNumber, lineType, uiBusinessEvent, collectedData) {
20
+ var _a, _b, _c, _d, _e, _f;
21
+ const accountLookupResponse = collectedData.get(Constants_1.CollectedDataKey.TenderAuthResponse);
22
+ const lookupResult = convertResponseCodeToLookupResult((_a = accountLookupResponse) === null || _a === void 0 ? void 0 : _a.responseCode);
23
+ const lookupResultReason = (_b = accountLookupResponse) === null || _b === void 0 ? void 0 : _b.status;
24
+ const cardHolder = (_c = accountLookupResponse) === null || _c === void 0 ? void 0 : _c.cardHolder;
25
+ const accountNumber = (_d = accountLookupResponse) === null || _d === void 0 ? void 0 : _d.cardNumber;
26
+ const cardToken = (_e = accountLookupResponse) === null || _e === void 0 ? void 0 : _e.cardToken;
27
+ const referenceNumber = (_f = accountLookupResponse) === null || _f === void 0 ? void 0 : _f.referenceNumber;
28
+ const authorizationDeviceId = collectedData.get(Constants_1.CollectedDataKey.AuthorizationDeviceId);
29
+ return new PaymentAccountLookupLine(lineNumber, lineType, cardHolder, lookupResult, lookupResultReason, accountNumber, cardToken, referenceNumber, authorizationDeviceId);
30
+ }
31
+ static createFromJsonObject(transactionLineJsonObj) {
32
+ const lineNumber = BaseTransactionLine_1.BaseTransactionLine.lineNumberFromJsonObject(transactionLineJsonObj);
33
+ const lineType = BaseTransactionLine_1.BaseTransactionLine.lineTypeFromJsonObject(transactionLineJsonObj);
34
+ const cardHolder = transactionLineJsonObj._cardHolder;
35
+ const lookupResult = transactionLineJsonObj._lookupResult;
36
+ const lookupResultReason = transactionLineJsonObj._lookupResultReason;
37
+ const accountNumber = transactionLineJsonObj._accountNumber;
38
+ const cardToken = transactionLineJsonObj._cardToken;
39
+ const referenceNumber = transactionLineJsonObj._referenceNumber;
40
+ const authorizationDeviceId = transactionLineJsonObj._authorizationDeviceId;
41
+ const accountLookupLine = new PaymentAccountLookupLine(lineNumber, lineType, cardHolder, lookupResult, lookupResultReason, accountNumber, cardToken, referenceNumber, authorizationDeviceId);
42
+ accountLookupLine.loadFromJsonObject(transactionLineJsonObj);
43
+ return accountLookupLine;
44
+ }
45
+ get couldAffectPricing() {
46
+ return false;
47
+ }
48
+ get lookupResult() {
49
+ return this._lookupResult;
50
+ }
51
+ get lookupResultReason() {
52
+ return this._lookupResultReason;
53
+ }
54
+ get cardHolder() {
55
+ return this._cardHolder;
56
+ }
57
+ get accountNumber() {
58
+ return this._accountNumber;
59
+ }
60
+ get cardToken() {
61
+ return this._cardToken;
62
+ }
63
+ get referenceNumber() {
64
+ return this._referenceNumber;
65
+ }
66
+ get authorizationDeviceId() {
67
+ return this._authorizationDeviceId;
68
+ }
69
+ newTransactionLine() {
70
+ return new PaymentAccountLookupLine(this.lineNumber, this.lineType, this._cardHolder, this._lookupResult, this._lookupResultReason, this._accountNumber, this._cardToken, this._referenceNumber, this._authorizationDeviceId);
71
+ }
72
+ }
73
+ exports.PaymentAccountLookupLine = PaymentAccountLookupLine;
74
+ function isAccountLookupLine(transactionLine) {
75
+ return (transactionLine instanceof PaymentAccountLookupLine ||
76
+ transactionLine.lineType === exports.PAYMENT_ACCOUNT_LOOKUP_LINE_TYPE);
77
+ }
78
+ exports.isAccountLookupLine = isAccountLookupLine;
79
+ function convertResponseCodeToLookupResult(responseCode) {
80
+ switch (responseCode) {
81
+ case scp_types_commerce_devices_1.ResponseCodes.Approved:
82
+ return scp_types_commerce_transaction_1.PaymentAccountLookupResult.Success;
83
+ case scp_types_commerce_devices_1.ResponseCodes.Decline:
84
+ return scp_types_commerce_transaction_1.PaymentAccountLookupResult.Failure;
85
+ case scp_types_commerce_devices_1.ResponseCodes.Cancel:
86
+ return scp_types_commerce_transaction_1.PaymentAccountLookupResult.Cancelled;
87
+ default:
88
+ return scp_types_commerce_transaction_1.PaymentAccountLookupResult.Error;
89
+ }
90
+ }
91
+ function convertLookupResultToResponseCode(lookupResult) {
92
+ switch (lookupResult) {
93
+ case scp_types_commerce_transaction_1.PaymentAccountLookupResult.Success:
94
+ return scp_types_commerce_devices_1.ResponseCodes.Approved;
95
+ case scp_types_commerce_transaction_1.PaymentAccountLookupResult.Failure:
96
+ return scp_types_commerce_devices_1.ResponseCodes.Decline;
97
+ case scp_types_commerce_transaction_1.PaymentAccountLookupResult.Cancelled:
98
+ return scp_types_commerce_devices_1.ResponseCodes.Cancel;
99
+ default:
100
+ return scp_types_commerce_devices_1.ResponseCodes.Error;
101
+ }
102
+ }
103
+ exports.convertLookupResultToResponseCode = convertLookupResultToResponseCode;
104
+ //# sourceMappingURL=PaymentAccountLookupLine.js.map
@@ -0,0 +1,2 @@
1
+ export * from "./PaymentAccountLookupLine";
2
+ export * from "./IPaymentAccountLookupLine";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ function __export(m) {
3
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
+ }
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ __export(require("./PaymentAccountLookupLine"));
7
+ //# sourceMappingURL=index.js.map
@@ -7,18 +7,22 @@ exports.ITEM_MANUAL_DISCOUNT_LINE_TYPE = "ItemManualDiscount";
7
7
  exports.TRANSACTION_MANUAL_DISCOUNT_LINE_TYPE = "TransactionManualDiscount";
8
8
  exports.LOYALTY_DISCOUNT_LINE_TYPE = "LoyaltyDiscount";
9
9
  function isManualItemDiscountLine(transactionLine) {
10
- return (transactionLine instanceof ManualItemDiscountLine_1.ManualItemDiscountLine ||
11
- (transactionLine.lineType === exports.ITEM_MANUAL_DISCOUNT_LINE_TYPE &&
12
- transactionLine.itemLineReference !== undefined));
10
+ return (transactionLine &&
11
+ (transactionLine instanceof ManualItemDiscountLine_1.ManualItemDiscountLine ||
12
+ (transactionLine.lineType === exports.ITEM_MANUAL_DISCOUNT_LINE_TYPE &&
13
+ transactionLine.itemLineReference !== undefined)));
13
14
  }
14
15
  exports.isManualItemDiscountLine = isManualItemDiscountLine;
15
16
  function isManualTransactionDiscountLine(transactionLine) {
16
- return (transactionLine instanceof ManualTransactionDiscountLine_1.ManualTransactionDiscountLine ||
17
- transactionLine.lineType === exports.TRANSACTION_MANUAL_DISCOUNT_LINE_TYPE);
17
+ return (transactionLine &&
18
+ (transactionLine instanceof ManualTransactionDiscountLine_1.ManualTransactionDiscountLine ||
19
+ transactionLine.lineType === exports.TRANSACTION_MANUAL_DISCOUNT_LINE_TYPE));
18
20
  }
19
21
  exports.isManualTransactionDiscountLine = isManualTransactionDiscountLine;
20
22
  function isLoyaltyDiscountLine(transactionLine) {
21
- return (transactionLine instanceof LoyaltyDiscountLine_1.LoyaltyDiscountLine || transactionLine.lineType === exports.LOYALTY_DISCOUNT_LINE_TYPE);
23
+ return (transactionLine &&
24
+ (transactionLine instanceof LoyaltyDiscountLine_1.LoyaltyDiscountLine ||
25
+ transactionLine.lineType === exports.LOYALTY_DISCOUNT_LINE_TYPE));
22
26
  }
23
27
  exports.isLoyaltyDiscountLine = isLoyaltyDiscountLine;
24
28
  function isManualDiscountLine(transactionLine) {
@@ -1,3 +1,4 @@
1
+ export * from "./account";
1
2
  export * from "./cashDrawer";
2
3
  export * from "./configuration/";
3
4
  export * from "./customer/";
@@ -3,6 +3,7 @@ function __export(m) {
3
3
  for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
4
  }
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ __export(require("./account"));
6
7
  __export(require("./cashDrawer"));
7
8
  __export(require("./configuration/"));
8
9
  __export(require("./customer/"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-scp/scp-component-store-selling-features-domain-model",
3
- "version": "1.46.7",
3
+ "version": "1.47.1",
4
4
  "description": "This component library provides the common components to handle the coordination of processing the business events from the UI.",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -61,8 +61,8 @@
61
61
  "@aptos-scp/scp-component-user": "^1.4.0",
62
62
  "@aptos-scp/scp-types-client-registration": "^1.4.0",
63
63
  "@aptos-scp/scp-types-core-config": "^2.2.1",
64
- "@aptos-scp/scp-types-commerce-devices": "^3.9.0",
65
- "@aptos-scp/scp-types-commerce-transaction": "^1.70.0",
64
+ "@aptos-scp/scp-types-commerce-devices": "^3.14.0",
65
+ "@aptos-scp/scp-types-commerce-transaction": "^1.72.0",
66
66
  "@aptos-scp/scp-types-customer": "^3.7.0",
67
67
  "@aptos-scp/scp-types-einvoice": "^1.17.0",
68
68
  "@aptos-scp/scp-types-inventory": "^2.0.0",
@@ -83,8 +83,8 @@
83
83
  "@aptos-scp/scp-component-taxation": "^5.27.3",
84
84
  "@aptos-scp/scp-component-user": "^1.4.0",
85
85
  "@aptos-scp/scp-types-client-registration": "^1.4.0",
86
- "@aptos-scp/scp-types-commerce-devices": "^3.9.0",
87
- "@aptos-scp/scp-types-commerce-transaction": "^1.70.0",
86
+ "@aptos-scp/scp-types-commerce-devices": "^3.14.0",
87
+ "@aptos-scp/scp-types-commerce-transaction": "^1.72.0",
88
88
  "@aptos-scp/scp-types-core": "^1.0.5",
89
89
  "@aptos-scp/scp-types-core-config": "^2.2.1",
90
90
  "@aptos-scp/scp-types-currency-conversion": "^1.2.0",