@aptos-scp/scp-component-store-selling-features-domain-model 2.37.0 → 2.38.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.
@@ -1,7 +1,7 @@
1
1
  import { Money } from "@aptos-scp/scp-component-business-core";
2
2
  import { DeviceIdentity, ITransaction, ITransactionLine, ITransactionLineFactory, IUser } from "@aptos-scp/scp-component-store-selling-core";
3
3
  import { IBaseTransactionTaxCalculationResults } from "@aptos-scp/scp-component-taxation";
4
- import { IFiscalSignature, ITaxByTaxAuthority, ITaxByTaxRule, ITaxOverride, MerchandiseTransactionReservationStatus, MerchandiseTransactionTradeType, TaxCalculationSystem } from "@aptos-scp/scp-types-commerce-transaction";
4
+ import { IFiscalSignature, IServiceResult, ITaxByTaxAuthority, ITaxByTaxRule, ITaxOverride, MerchandiseTransactionReservationStatus, MerchandiseTransactionTradeType, TaxCalculationSystem } from "@aptos-scp/scp-types-commerce-transaction";
5
5
  import { FiscalResponseCode } from "@aptos-scp/scp-types-commerce-devices";
6
6
  import { PotentialPromotion } from "@aptos-scp/scp-types-pricing";
7
7
  import { GiftReceiptMode } from "./Constants";
@@ -125,6 +125,7 @@ export declare class MerchandiseTransaction extends RetailTransaction implements
125
125
  private _hasPromisedToPayWithPLCC;
126
126
  private _shouldUpdateTaxation;
127
127
  private _fulfillmentAuthorizationStatus?;
128
+ private _fulfillmentAuthorizationServiceResult?;
128
129
  private _referenceNumber;
129
130
  private _giftReceipt;
130
131
  private _giftReceiptMode;
@@ -326,6 +327,7 @@ export declare class MerchandiseTransaction extends RetailTransaction implements
326
327
  get hasPromisedToPayWithPLCC(): boolean;
327
328
  get shouldUpdateTaxation(): boolean;
328
329
  get fulfillmentAuthorizationStatus(): string | undefined;
330
+ get fulfillmentAuthorizationServiceResult(): IServiceResult | undefined;
329
331
  get giftReceiptMode(): GiftReceiptMode;
330
332
  get giftReceipt(): boolean;
331
333
  get transactionTotal(): Money;
@@ -70,6 +70,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
70
70
  this._hasPromisedToPayWithPLCC = false;
71
71
  this._shouldUpdateTaxation = false;
72
72
  this._fulfillmentAuthorizationStatus = undefined;
73
+ this._fulfillmentAuthorizationServiceResult = undefined;
73
74
  this._transactionReferenceFormatter = transactionReferenceFormatter;
74
75
  this._giftReceiptMode = giftReceiptMode;
75
76
  this._giftReceipt = giftReceipt;
@@ -188,6 +189,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
188
189
  transaction._hasPromisedToPayWithPLCC = this._hasPromisedToPayWithPLCC;
189
190
  transaction._shouldUpdateTaxation = this._shouldUpdateTaxation;
190
191
  transaction._fulfillmentAuthorizationStatus = this._fulfillmentAuthorizationStatus;
192
+ transaction._fulfillmentAuthorizationServiceResult = this._fulfillmentAuthorizationServiceResult;
191
193
  transaction._transactionReferenceFormatter = this._transactionReferenceFormatter;
192
194
  transaction._referenceNumber = this._referenceNumber;
193
195
  transaction._giftReceiptMode = this._giftReceiptMode;
@@ -807,6 +809,9 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
807
809
  get fulfillmentAuthorizationStatus() {
808
810
  return this._fulfillmentAuthorizationStatus;
809
811
  }
812
+ get fulfillmentAuthorizationServiceResult() {
813
+ return this._fulfillmentAuthorizationServiceResult;
814
+ }
810
815
  get giftReceiptMode() {
811
816
  return this._giftReceiptMode;
812
817
  }
@@ -897,6 +902,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
897
902
  ["transaction.totalFee", this.transactionTotalFee],
898
903
  ["transaction.hasPromisedToPayWithPLCC", this._hasPromisedToPayWithPLCC],
899
904
  ["transaction.fulfillmentAuthorizationStatus", this._fulfillmentAuthorizationStatus],
905
+ ["transaction.fulfillmentAuthorizationServiceResult", this._fulfillmentAuthorizationServiceResult],
900
906
  ["transaction.transactionTotalFeeAfterTaxAdjustment", this._transactionTotalFeeAfterTaxAdjustment],
901
907
  ["transaction.returnSubTotal", this._returnSubTotal],
902
908
  ["transaction.returnSubTotalExcludingTax", this._returnSubTotalExcludingTax],
@@ -1040,6 +1046,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
1040
1046
  _hasPromisedToPayWithPLCC: this.hasPromisedToPayWithPLCC,
1041
1047
  _shouldUpdateTaxation: this.shouldUpdateTaxation,
1042
1048
  _fulfillmentAuthorizationStatus: this.fulfillmentAuthorizationStatus,
1049
+ _fulfillmentAuthorizationServiceResult: this.fulfillmentAuthorizationServiceResult,
1043
1050
  _referenceNumber: this.referenceNumber,
1044
1051
  _giftReceiptMode: this.giftReceiptMode,
1045
1052
  _giftReceipt: this.giftReceipt,
@@ -1190,6 +1197,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
1190
1197
  this._hasPromisedToPayWithPLCC = transactionJsonObj._hasPromisedToPayWithPLCC;
1191
1198
  this._shouldUpdateTaxation = transactionJsonObj._shouldUpdateTaxation;
1192
1199
  this._fulfillmentAuthorizationStatus = transactionJsonObj._fulfillmentAuthorizationStatus;
1200
+ this._fulfillmentAuthorizationServiceResult = transactionJsonObj._fulfillmentAuthorizationServiceResult;
1193
1201
  this._referenceNumber = transactionJsonObj._referenceNumber;
1194
1202
  this._giftReceiptMode = transactionJsonObj._giftReceiptMode;
1195
1203
  this._giftReceipt = transactionJsonObj._giftReceipt;
@@ -95,6 +95,7 @@ export declare class TenderType {
95
95
  private _eligibleForTaxLottery?;
96
96
  private _cashoutThreshold?;
97
97
  static getActiveConfiguredTenders(container: Container, accountingCurrency: string): TenderType[];
98
+ static getAllConfiguredTenders(container: Container, accountingCurrency: string): TenderType[];
98
99
  static getActiveRefundConfiguredTenders(container: Container, accountingCurrency: string, withTransaction: boolean, withOfflineTransaction: boolean): TenderType[];
99
100
  static getActiveSuggestedRefundTenders(container: Container, accountingCurrency: string, withMappedTender?: boolean): TenderType[];
100
101
  static getActiveConfiguredTenderGroups(container: Container, accountingCurrency: string, activeTenders: TenderType[]): ITenderGroup[];
@@ -152,6 +153,7 @@ export declare class TenderType {
152
153
  get subscriptionEntryMethods(): EntryMethod[];
153
154
  get cashoutThreshold(): Money;
154
155
  private static getActiveTenders;
156
+ private static mapTenderDefinitionToTenderType;
155
157
  private static filterActiveTenderIds;
156
158
  private static tenderAuthCategoryIsActive;
157
159
  private static tenderTypeIsActive;
@@ -72,6 +72,13 @@ class TenderType {
72
72
  static getActiveConfiguredTenders(container, accountingCurrency) {
73
73
  return TenderType.getActiveTenders(container, accountingCurrency, false, false, false, false);
74
74
  }
75
+ static getAllConfiguredTenders(container, accountingCurrency) {
76
+ const configurationManager = container.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
77
+ const configuredTenders = configurationManager.getTendersValues().tenderDefinitions;
78
+ return configuredTenders
79
+ .filter((configuredTender) => configuredTender != null)
80
+ .map((configuredTender) => TenderType.mapTenderDefinitionToTenderType(configuredTender, accountingCurrency));
81
+ }
75
82
  static getActiveRefundConfiguredTenders(container, accountingCurrency, withTransaction, withOfflineTransaction) {
76
83
  return TenderType.getActiveTenders(container, accountingCurrency, true, withTransaction, false, false, withOfflineTransaction);
77
84
  }
@@ -519,12 +526,15 @@ class TenderType {
519
526
  const configuredTenders = configurationManager.getTendersValues().tenderDefinitions;
520
527
  const activeTenders = configuredTenders
521
528
  .filter((configuredTender) => tenderIsActive(configuredTender, isRefund, withTransaction, withReference, withMappedTender, withOfflineTransaction, accountingCurrency))
522
- .map((configuredTender) => new TenderType(configuredTender.tenderId, configuredTender.tenderName, configuredTender.tenderType, Constants_1.TenderAuthCategory[configuredTender.tenderAuthCategory], configuredTender.additionalTenderAuthCategories, scp_types_commerce_devices_1.CardType[configuredTender.cardType], TenderSignatureCapturePolicy[configuredTender.signatureCapturePolicy], configuredTender.hasOwnProperty("signatureCaptureFloorLimit")
529
+ .map((configuredTender) => TenderType.mapTenderDefinitionToTenderType(configuredTender, accountingCurrency));
530
+ return activeTenders;
531
+ }
532
+ static mapTenderDefinitionToTenderType(configuredTender, accountingCurrency) {
533
+ return new TenderType(configuredTender.tenderId, configuredTender.tenderName, configuredTender.tenderType, Constants_1.TenderAuthCategory[configuredTender.tenderAuthCategory], configuredTender.additionalTenderAuthCategories, scp_types_commerce_devices_1.CardType[configuredTender.cardType], TenderSignatureCapturePolicy[configuredTender.signatureCapturePolicy], configuredTender.hasOwnProperty("signatureCaptureFloorLimit")
523
534
  ? new scp_component_business_core_1.Money(configuredTender.signatureCaptureFloorLimit, accountingCurrency)
524
535
  : undefined, configuredTender.printDeclineTenderDetails, configuredTender.printDeclineTenderReceipt, configuredTender.printStoreTenderReceipt, configuredTender.allowPostVoid, configuredTender.allowCallForAuthorization !== false, configuredTender.allowRefund, configuredTender.pluralTenderName, configuredTender.fiscalCode, configuredTender.fiscalType, configuredTender.tenderLabel, configuredTender.actions, configuredTender.overTenderRule && Constants_1.OverTenderRule[configuredTender.overTenderRule], configuredTender.subType, configuredTender.customCardType, configuredTender.promptOnPartialApproval, configuredTender.pinRules, configuredTender.subscriptionEntryMethods, configuredTender.changeBehavior, configuredTender.isForeignTender, configuredTender.currencyCode, configuredTender.eligibleForTaxLottery, configuredTender.printVoidTenderDetails, configuredTender.printVoidTenderReceipt, configuredTender.hasOwnProperty("cashoutThreshold")
525
536
  ? new scp_component_business_core_1.Money(configuredTender.cashoutThreshold, accountingCurrency)
526
- : undefined, TenderSignatureCapturePolicy[configuredTender.signatureCapturePolicyForCallForAuth]));
527
- return activeTenders;
537
+ : undefined, TenderSignatureCapturePolicy[configuredTender.signatureCapturePolicyForCallForAuth]);
528
538
  }
529
539
  static filterActiveTenderIds(tenderIds, configuredTenders, isRefund, withTransaction, withOfflineTransaction, accountingCurrency) {
530
540
  return (tenderIds &&
@@ -1,17 +1,19 @@
1
1
  import { Money } from "@aptos-scp/scp-component-business-core";
2
2
  import { ITransactionLine, UiBusinessEvent } from "@aptos-scp/scp-component-store-selling-core";
3
- import { FulfillmentAuthorizationStatus } from "@aptos-scp/scp-types-commerce-transaction";
3
+ import { FulfillmentAuthorizationStatus, IServiceResult } from "@aptos-scp/scp-types-commerce-transaction";
4
4
  import { BaseTransactionLine } from "../BaseTransactionLine";
5
5
  export declare const FULFILLMENT_AUTHORIZATION_STATUS_LINE_TYPE: string;
6
6
  export declare class FulfillmentAuthorizationStatusLine extends BaseTransactionLine {
7
7
  private _status;
8
8
  private _amountDue;
9
+ private _serviceResult?;
9
10
  static create(lineNumber: number, lineType: string, uiBusinessEvent: UiBusinessEvent, collectedData: Readonly<Map<string, any>>): FulfillmentAuthorizationStatusLine;
10
11
  static createFromJsonObject(transactionLineJsonObj: any): FulfillmentAuthorizationStatusLine;
11
12
  get status(): FulfillmentAuthorizationStatus;
12
13
  get amountDue(): Money;
14
+ get serviceResult(): IServiceResult;
13
15
  get couldAffectPricing(): boolean;
14
- protected constructor(lineNumber: number, lineType: string, status: FulfillmentAuthorizationStatus, amountDue?: Money);
16
+ protected constructor(lineNumber: number, lineType: string, status: FulfillmentAuthorizationStatus, amountDue?: Money, serviceResult?: IServiceResult);
15
17
  protected newTransactionLine(): FulfillmentAuthorizationStatusLine;
16
18
  }
17
19
  export declare const isFulfillmentAuthorizationStatusLine: (transactionLine: ITransactionLine) => transactionLine is FulfillmentAuthorizationStatusLine;
@@ -5,15 +5,17 @@ const BaseTransactionLine_1 = require("../BaseTransactionLine");
5
5
  const Constants_1 = require("../Constants");
6
6
  exports.FULFILLMENT_AUTHORIZATION_STATUS_LINE_TYPE = "FulfillmentAuthorizationStatus";
7
7
  class FulfillmentAuthorizationStatusLine extends BaseTransactionLine_1.BaseTransactionLine {
8
- constructor(lineNumber, lineType, status, amountDue) {
8
+ constructor(lineNumber, lineType, status, amountDue, serviceResult) {
9
9
  super(lineNumber, lineType);
10
10
  this._status = status;
11
11
  this._amountDue = amountDue;
12
+ this._serviceResult = serviceResult;
12
13
  }
13
14
  static create(lineNumber, lineType, uiBusinessEvent, collectedData) {
14
15
  const status = collectedData.get(Constants_1.CollectedDataKey.FulfillmentAuthorizationStatus);
15
16
  const amountDue = collectedData.get(Constants_1.CollectedDataKey.AmountDue);
16
- return new FulfillmentAuthorizationStatusLine(lineNumber, lineType, status, amountDue);
17
+ const serviceResult = collectedData.get(Constants_1.CollectedDataKey.ServiceResult);
18
+ return new FulfillmentAuthorizationStatusLine(lineNumber, lineType, status, amountDue, serviceResult);
17
19
  }
18
20
  static createFromJsonObject(transactionLineJsonObj) {
19
21
  const lineNumber = BaseTransactionLine_1.BaseTransactionLine.lineNumberFromJsonObject(transactionLineJsonObj);
@@ -23,7 +25,11 @@ class FulfillmentAuthorizationStatusLine extends BaseTransactionLine_1.BaseTrans
23
25
  if (transactionLineJsonObj._amountDue) {
24
26
  amountDue = new scp_component_business_core_1.Money(transactionLineJsonObj._amountDue);
25
27
  }
26
- const fulfillmentAuthorizationStatusLine = new FulfillmentAuthorizationStatusLine(lineNumber, lineType, status, amountDue);
28
+ let serviceResult;
29
+ if (transactionLineJsonObj._serviceResult) {
30
+ serviceResult = transactionLineJsonObj._serviceResult;
31
+ }
32
+ const fulfillmentAuthorizationStatusLine = new FulfillmentAuthorizationStatusLine(lineNumber, lineType, status, amountDue, serviceResult);
27
33
  fulfillmentAuthorizationStatusLine.loadFromJsonObject(transactionLineJsonObj);
28
34
  return fulfillmentAuthorizationStatusLine;
29
35
  }
@@ -33,11 +39,14 @@ class FulfillmentAuthorizationStatusLine extends BaseTransactionLine_1.BaseTrans
33
39
  get amountDue() {
34
40
  return this._amountDue;
35
41
  }
42
+ get serviceResult() {
43
+ return this._serviceResult;
44
+ }
36
45
  get couldAffectPricing() {
37
46
  return false;
38
47
  }
39
48
  newTransactionLine() {
40
- return new FulfillmentAuthorizationStatusLine(this.lineNumber, this.lineType, this.status, this.amountDue);
49
+ return new FulfillmentAuthorizationStatusLine(this.lineNumber, this.lineType, this.status, this.amountDue, this.serviceResult);
41
50
  }
42
51
  }
43
52
  exports.FulfillmentAuthorizationStatusLine = FulfillmentAuthorizationStatusLine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-scp/scp-component-store-selling-features-domain-model",
3
- "version": "2.37.0",
3
+ "version": "2.38.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",