@licklist/design 0.71.15 → 0.71.16-stage.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.
@@ -1 +1 @@
1
- {"version":3,"file":"SummaryTotal.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/SummaryTotal/SummaryTotal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAIjD,eAAO,MAAM,YAAY,sEAKtB,IAAI,CACL,mBAAmB,EACnB,YAAY,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,eAAe,CACxE,4CA4BA,CAAA"}
1
+ {"version":3,"file":"SummaryTotal.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/SummaryTotal/SummaryTotal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAIjD,eAAO,MAAM,YAAY,sEAKtB,IAAI,CACL,mBAAmB,EACnB,YAAY,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,eAAe,CACxE,4CAyCA,CAAA"}
@@ -15,7 +15,14 @@ var SummaryTotal = function(param) {
15
15
  }, [
16
16
  formValues
17
17
  ]);
18
- var cartSum = isFreePayment ? 0 : cartSumByOrderProducts(orderProducts) + transactionFee;
18
+ var cartSum = isFreePayment ? 0 : cartSumByOrderProducts({
19
+ orderProducts: orderProducts
20
+ }) + transactionFee;
21
+ var totalSum = isFreePayment ? 0 : cartSumByOrderProducts({
22
+ orderProducts: orderProducts,
23
+ isTotalSum: true
24
+ }) + transactionFee;
25
+ var hasRemaingToPay = totalSum > cartSum;
19
26
  if (!orderProducts.length) {
20
27
  return null;
21
28
  }
@@ -23,12 +30,16 @@ var SummaryTotal = function(param) {
23
30
  className: "d-flex flex-column justify-content-between",
24
31
  children: [
25
32
  /*#__PURE__*/ jsx(SummaryTotalBlock, {
26
- label: t('total'),
33
+ label: t(hasRemaingToPay ? "payNow" : "total"),
27
34
  amount: cartSum
28
35
  }),
29
36
  !!totalWithDiscount && !isFreePayment && /*#__PURE__*/ jsx(SummaryTotalBlock, {
30
37
  label: t('totalWithDiscount'),
31
38
  amount: totalWithDiscount + transactionFee
39
+ }),
40
+ hasRemaingToPay && /*#__PURE__*/ jsx(SummaryTotalBlock, {
41
+ label: t("remaining"),
42
+ amount: totalSum - cartSum
32
43
  })
33
44
  ]
34
45
  });
@@ -1,5 +1,8 @@
1
1
  import { QuantityCheckProductInfo } from '@licklist/plugins/dist/types/Api/verifyStock';
2
2
  import { OrderItem } from '@licklist/plugins/dist/types/context/Iframe/orderItems';
3
- export declare const cartSumByOrderProducts: (orderProducts?: OrderItem[]) => number;
3
+ export declare const cartSumByOrderProducts: ({ orderProducts, isTotalSum, }: {
4
+ orderProducts?: OrderItem[];
5
+ isTotalSum?: boolean;
6
+ }) => number;
4
7
  export declare const getProductError: (productsWithErrors: QuantityCheckProductInfo[], productId: OrderItem["id"]) => string | undefined;
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,wDAAwD,CAAA;AAElF,eAAO,MAAM,sBAAsB,mBAAoB,SAAS,EAAE,WASjE,CAAA;AAED,eAAO,MAAM,eAAe,uBACN,wBAAwB,EAAE,aACnC,SAAS,CAAC,IAAI,CAAC,KACzB,MAAM,GAAG,SAGA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,wDAAwD,CAAA;AAElF,eAAO,MAAM,sBAAsB,mCAGhC;IACD,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,WAWA,CAAC;AAEF,eAAO,MAAM,eAAe,uBACN,wBAAwB,EAAE,aACnC,SAAS,CAAC,IAAI,CAAC,KACzB,MAAM,GAAG,SAGA,CAAA"}
@@ -1,10 +1,11 @@
1
- var cartSumByOrderProducts = function(orderProducts) {
1
+ var cartSumByOrderProducts = function(param) {
2
+ var orderProducts = param.orderProducts, isTotalSum = param.isTotalSum;
2
3
  if (!orderProducts || !orderProducts.length) {
3
4
  return 0;
4
5
  }
5
6
  return orderProducts.reduce(function(prevSumValue, product) {
6
7
  if (!product) return 0;
7
- var price = (product === null || product === void 0 ? void 0 : product.hasDeposit) ? product === null || product === void 0 ? void 0 : product.deposit : product === null || product === void 0 ? void 0 : product.price;
8
+ var price = isTotalSum ? product === null || product === void 0 ? void 0 : product.price : (product === null || product === void 0 ? void 0 : product.deposit) || (product === null || product === void 0 ? void 0 : product.price);
8
9
  return prevSumValue + price * product.quantity;
9
10
  }, 0);
10
11
  };
@@ -10,7 +10,7 @@ interface PaymentProps extends RyftPaymentFormProps {
10
10
  onFailIframePayment?: () => void;
11
11
  data?: PaymentLinkResponse | null;
12
12
  isLoading: boolean;
13
- bookingSummaryProps: Omit<BookingSummaryProps, 'totallWithDiscount'>;
13
+ bookingSummaryProps: BookingSummaryProps;
14
14
  paymentMetadata?: PaymentMetadata;
15
15
  }
16
16
  export declare const PaymentPage: ({ onCloseIframePayment, onFailIframePayment, data, isLoading, bookingSummaryProps, paymentMetadata, ...ryftPaymentFormProps }: PaymentProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-page/PaymentPage.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAA;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAA;AAI9F,OAAO,EAEL,oBAAoB,EACrB,MAAM,4BAA4B,CAAA;AAOnC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,UAAU,YAAa,SAAQ,oBAAoB;IACjD,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAA;IACjC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAA;IAChC,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACjC,SAAS,EAAE,OAAO,CAAA;IAClB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAA;IACpE,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AAED,eAAO,MAAM,WAAW,kIAQrB,YAAY,4CAkKd,CAAA"}
1
+ {"version":3,"file":"PaymentPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-page/PaymentPage.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAA;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAA;AAI9F,OAAO,EAEL,oBAAoB,EACrB,MAAM,4BAA4B,CAAA;AAOnC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,UAAU,YAAa,SAAQ,oBAAoB;IACjD,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAA;IACjC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAA;IAChC,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACjC,SAAS,EAAE,OAAO,CAAA;IAClB,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AAED,eAAO,MAAM,WAAW,kIAQrB,YAAY,4CAwNd,CAAA"}
@@ -174,12 +174,21 @@ var PaymentPage = function(_param) {
174
174
  })
175
175
  });
176
176
  }
177
- var orderTotalAmountByFormValues = cartSumByOrderProducts((bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues) && Object.values(bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues));
177
+ var orderCartAmountByFormValues = cartSumByOrderProducts({
178
+ orderProducts: (bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues) && Object.values(bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues)
179
+ });
180
+ var orderTotalAmountByFormValues = cartSumByOrderProducts({
181
+ orderProducts: (bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues) && Object.values(bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues),
182
+ isTotalSum: true
183
+ });
184
+ var hasRemaingToPay = orderTotalAmountByFormValues > orderCartAmountByFormValues;
178
185
  // User can fill promo code only in iframe application.
179
186
  // It isn't possible via payment link. This check will
180
187
  // be applied when there is no metadata and in case when
181
188
  // orderValues sum is greater than amount in order.
182
- var isCalculatedAmountGreaterThanOrderAmount = orderTotalAmountByFormValues > (data === null || data === void 0 ? void 0 : data.amount);
189
+ var isCalculatedAmountGreaterThanOrderAmount = !hasRemaingToPay && orderCartAmountByFormValues > (data === null || data === void 0 ? void 0 : data.amount);
190
+ var isPaymentLinkWithRemainingToPay = (data === null || data === void 0 ? void 0 : data.remaining_to_pay) && !!Number(data === null || data === void 0 ? void 0 : data.remaining_to_pay);
191
+ var totalPaidWithRemainingToPay = (data === null || data === void 0 ? void 0 : data.amount_to_pay) && !!Number(data === null || data === void 0 ? void 0 : data.amount_to_pay);
183
192
  return /*#__PURE__*/ jsx(Page, {
184
193
  className: "payment_link",
185
194
  children: /*#__PURE__*/ jsx(PageBody, {
@@ -219,10 +228,33 @@ var PaymentPage = function(_param) {
219
228
  }) : /*#__PURE__*/ jsxs(Fragment, {
220
229
  children: [
221
230
  isCalculatedAmountGreaterThanOrderAmount && /*#__PURE__*/ jsx(SummaryTotalBlock, {
222
- label: t('total'),
223
- amount: orderTotalAmountByFormValues + ((bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.transactionFee) || 0)
231
+ label: t(hasRemaingToPay ? 'payNow' : 'total'),
232
+ amount: orderCartAmountByFormValues + ((bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.transactionFee) || 0)
224
233
  }),
225
- /*#__PURE__*/ jsx(SummaryTotalBlock, {
234
+ hasRemaingToPay && /*#__PURE__*/ jsxs(Fragment, {
235
+ children: [
236
+ /*#__PURE__*/ jsx(SummaryTotalBlock, {
237
+ label: t('remaining'),
238
+ amount: orderTotalAmountByFormValues - orderCartAmountByFormValues
239
+ }),
240
+ /*#__PURE__*/ jsx(SummaryTotalBlock, {
241
+ label: t('total'),
242
+ amount: orderTotalAmountByFormValues
243
+ })
244
+ ]
245
+ }),
246
+ isPaymentLinkWithRemainingToPay && /*#__PURE__*/ jsx(SummaryTotalBlock, {
247
+ label: t('remaningToPay'),
248
+ amount: Number(data === null || data === void 0 ? void 0 : data.remaining_to_pay)
249
+ }),
250
+ totalPaidWithRemainingToPay && /*#__PURE__*/ jsx(SummaryTotalBlock, {
251
+ label: t('totalAmount'),
252
+ amount: Number(data === null || data === void 0 ? void 0 : data.amount_to_pay)
253
+ }),
254
+ isPaymentLinkWithRemainingToPay && totalPaidWithRemainingToPay ? /*#__PURE__*/ jsx(SummaryTotalBlock, {
255
+ label: t('payNow'),
256
+ amount: data === null || data === void 0 ? void 0 : data.amount
257
+ }) : /*#__PURE__*/ jsx(SummaryTotalBlock, {
226
258
  label: t(isCalculatedAmountGreaterThanOrderAmount ? 'totalWithDiscount' : 'total'),
227
259
  amount: (data === null || data === void 0 ? void 0 : data.amount) + ((bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.transactionFee) || 0)
228
260
  })
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentStatusPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-status-page/PaymentStatusPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAG7D,eAAO,MAAM,mBAAmB,WAAW,CAAA;AAC3C,eAAO,MAAM,oBAAoB,YAAY,CAAA;AAC7C,eAAO,MAAM,oBAAoB,YAAY,CAAA;AAE7C,MAAM,MAAM,WAAW,GACnB,OAAO,oBAAoB,GAC3B,OAAO,mBAAmB,GAC1B,OAAO,oBAAoB,CAAA;AAE/B,UAAU,2BAA2B;IACnC,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,EAAE,WAAW,CAAA;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;IACzC,kBAAkB,CAAC,EAAE,SAAS,CAAA;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AASD,eAAO,MAAM,iBAAiB,iLAa3B,2BAA2B,4CA4G7B,CAAA"}
1
+ {"version":3,"file":"PaymentStatusPage.d.ts","sourceRoot":"","sources":["../../../../src/iframe/payment/payment-status-page/PaymentStatusPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAG7D,eAAO,MAAM,mBAAmB,WAAW,CAAA;AAC3C,eAAO,MAAM,oBAAoB,YAAY,CAAA;AAC7C,eAAO,MAAM,oBAAoB,YAAY,CAAA;AAE7C,MAAM,MAAM,WAAW,GACnB,OAAO,oBAAoB,GAC3B,OAAO,mBAAmB,GAC1B,OAAO,oBAAoB,CAAA;AAE/B,UAAU,2BAA2B;IACnC,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,EAAE,WAAW,CAAA;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;IACzC,kBAAkB,CAAC,EAAE,SAAS,CAAA;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AASD,eAAO,MAAM,iBAAiB,iLAa3B,2BAA2B,4CAkI7B,CAAA"}
@@ -65,15 +65,21 @@ var PaymentStatusPage = function(param) {
65
65
  if (isLoading) return /*#__PURE__*/ jsx(LoaderIndicator, {
66
66
  isLoaded: false
67
67
  });
68
- var _bookingSummaryProps_formValues;
69
- var orderTotalAmounByFormValues = cartSumByOrderProducts(Object.values((_bookingSummaryProps_formValues = bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues) !== null && _bookingSummaryProps_formValues !== void 0 ? _bookingSummaryProps_formValues : {}));
68
+ var orderCartAmountByFormValues = cartSumByOrderProducts({
69
+ orderProducts: (bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues) && Object.values(bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues)
70
+ });
71
+ var orderTotalAmountByFormValues = cartSumByOrderProducts({
72
+ orderProducts: (bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues) && Object.values(bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.formValues),
73
+ isTotalSum: true
74
+ });
75
+ var hasRemaingToPay = orderTotalAmountByFormValues > orderCartAmountByFormValues;
70
76
  // User can fill promocode only in iframe appcliation.
71
77
  // It didn't possible via payment link. This check will
72
78
  // be applied when there are no metadata and in case when
73
79
  // orderValues sum is greater than amount in order.
74
80
  // For payment status page booking summary props can be empty
75
81
  // so we should also check for them
76
- var isCalculatedAmountGreaterThanOrderAmount = bookingSummaryProps && orderTotalAmounByFormValues > totalAmount;
82
+ var isCalculatedAmountGreaterThanOrderAmount = !hasRemaingToPay && bookingSummaryProps && orderCartAmountByFormValues > totalAmount;
77
83
  return /*#__PURE__*/ jsx(Page, {
78
84
  className: "payment-status-page",
79
85
  isAppUsingInIframe: isAppUsingInIframe,
@@ -121,12 +127,16 @@ var PaymentStatusPage = function(param) {
121
127
  }) : /*#__PURE__*/ jsxs(Fragment, {
122
128
  children: [
123
129
  isCalculatedAmountGreaterThanOrderAmount && /*#__PURE__*/ jsx(SummaryTotalBlock, {
124
- label: t('total'),
125
- amount: orderTotalAmounByFormValues + ((bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.transactionFee) || 0)
130
+ label: t(hasRemaingToPay ? "payNow" : "total"),
131
+ amount: orderCartAmountByFormValues + ((bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.transactionFee) || 0)
126
132
  }),
127
133
  /*#__PURE__*/ jsx(SummaryTotalBlock, {
128
134
  label: t(isCalculatedAmountGreaterThanOrderAmount ? 'totalWithDiscount' : 'total'),
129
135
  amount: totalAmount + ((bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.transactionFee) || 0)
136
+ }),
137
+ hasRemaingToPay && /*#__PURE__*/ jsx(SummaryTotalBlock, {
138
+ label: t("remaining"),
139
+ amount: orderTotalAmountByFormValues - orderCartAmountByFormValues
130
140
  })
131
141
  ]
132
142
  })
@@ -33,8 +33,10 @@
33
33
 
34
34
  &.disabled {
35
35
  border: 2px solid $snippet-calendar-disabled-button-border-color;
36
- background-color: $snippet-calendar-disabled-button-background-color;
36
+ background-color:transparent;
37
+ border: none;
37
38
  color: $snippet-calendar-disabled-button-font-color;
39
+ cursor: not-allowed;
38
40
 
39
41
  .weekday-info {
40
42
  div:last-child {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.71.15",
3
+ "version": "0.71.16-stage.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -42,9 +42,9 @@
42
42
  ]
43
43
  },
44
44
  "peerDependencies": {
45
- "@licklist/core": "0.32.5",
45
+ "@licklist/core": "0.32.7",
46
46
  "@licklist/eslint-config": "0.5.6",
47
- "@licklist/plugins": "0.35.1",
47
+ "@licklist/plugins": "0.35.6",
48
48
  "lodash": "4.17.21",
49
49
  "luxon": "3.5.0",
50
50
  "react": "17.0.2",
@@ -61,9 +61,9 @@
61
61
  "@dnd-kit/utilities": "2.0.0",
62
62
  "@fortawesome/fontawesome-svg-core": "1.2.34",
63
63
  "@fortawesome/free-solid-svg-icons": "5.15.2",
64
- "@licklist/core": "0.32.5",
64
+ "@licklist/core": "0.32.7",
65
65
  "@licklist/eslint-config": "0.5.6",
66
- "@licklist/plugins": "0.35.1",
66
+ "@licklist/plugins": "0.35.6",
67
67
  "@mantine/core": "6.0.22",
68
68
  "@mantine/hooks": "6.0.22",
69
69
  "@mdx-js/react": "1.6.22",
@@ -206,4 +206,4 @@
206
206
  "node": "20.9.0",
207
207
  "yarn": "4.4.0"
208
208
  }
209
- }
209
+ }
@@ -22,22 +22,35 @@ export const SummaryTotal = ({
22
22
 
23
23
  const cartSum = isFreePayment
24
24
  ? 0
25
- : cartSumByOrderProducts(orderProducts) + transactionFee
25
+ : cartSumByOrderProducts({orderProducts}) + transactionFee
26
+
27
+
28
+ const totalSum = isFreePayment
29
+ ? 0
30
+ : cartSumByOrderProducts({orderProducts, isTotalSum: true}) +
31
+ transactionFee;
32
+
33
+ const hasRemaingToPay = totalSum > cartSum;
26
34
 
27
35
  if (!orderProducts.length) {
28
36
  return null
29
37
  }
30
38
 
31
39
  return (
32
- <div className='d-flex flex-column justify-content-between'>
33
- <SummaryTotalBlock label={t('total')} amount={cartSum} />
34
-
40
+ <div className="d-flex flex-column justify-content-between">
41
+ <SummaryTotalBlock
42
+ label={t(hasRemaingToPay ? "payNow" : "total")}
43
+ amount={cartSum}
44
+ />
35
45
  {!!totalWithDiscount && !isFreePayment && (
36
46
  <SummaryTotalBlock
37
47
  label={t('totalWithDiscount')}
38
48
  amount={totalWithDiscount + transactionFee}
39
49
  />
40
50
  )}
51
+ {hasRemaingToPay && (
52
+ <SummaryTotalBlock label={t("remaining")} amount={totalSum - cartSum} />
53
+ )}
41
54
  </div>
42
55
  )
43
56
  }
@@ -1,16 +1,24 @@
1
1
  import { QuantityCheckProductInfo } from '@licklist/plugins/dist/types/Api/verifyStock'
2
2
  import { OrderItem } from '@licklist/plugins/dist/types/context/Iframe/orderItems'
3
3
 
4
- export const cartSumByOrderProducts = (orderProducts?: OrderItem[]) => {
4
+ export const cartSumByOrderProducts = ({
5
+ orderProducts,
6
+ isTotalSum,
7
+ }: {
8
+ orderProducts?: OrderItem[];
9
+ isTotalSum?: boolean;
10
+ }) => {
5
11
  if (!orderProducts || !orderProducts.length) {
6
12
  return 0
7
13
  }
8
14
  return orderProducts.reduce((prevSumValue: number, product) => {
9
- if (!product) return 0
10
- const price = product?.hasDeposit ? product?.deposit : product?.price
11
- return prevSumValue + price * product.quantity
12
- }, 0)
13
- }
15
+ if (!product) return 0;
16
+ const price = isTotalSum
17
+ ? product?.price
18
+ : product?.deposit || product?.price;
19
+ return prevSumValue + price * product.quantity;
20
+ }, 0);
21
+ };
14
22
 
15
23
  export const getProductError = (
16
24
  productsWithErrors: QuantityCheckProductInfo[],
@@ -28,7 +28,7 @@ interface PaymentProps extends RyftPaymentFormProps {
28
28
  onFailIframePayment?: () => void
29
29
  data?: PaymentLinkResponse | null
30
30
  isLoading: boolean
31
- bookingSummaryProps: Omit<BookingSummaryProps, 'totallWithDiscount'>
31
+ bookingSummaryProps: BookingSummaryProps
32
32
  paymentMetadata?: PaymentMetadata
33
33
  }
34
34
 
@@ -103,17 +103,33 @@ export const PaymentPage = ({
103
103
  )
104
104
  }
105
105
 
106
- const orderTotalAmountByFormValues = cartSumByOrderProducts(
107
- bookingSummaryProps?.formValues &&
106
+ const orderCartAmountByFormValues = cartSumByOrderProducts({
107
+ orderProducts:
108
+ bookingSummaryProps?.formValues &&
108
109
  Object.values(bookingSummaryProps?.formValues),
109
- )
110
+ })
111
+
112
+ const orderTotalAmountByFormValues = cartSumByOrderProducts({
113
+ orderProducts:
114
+ bookingSummaryProps?.formValues &&
115
+ Object.values(bookingSummaryProps?.formValues),
116
+ isTotalSum: true,
117
+ })
118
+
119
+ const hasRemaingToPay =
120
+ orderTotalAmountByFormValues > orderCartAmountByFormValues
110
121
 
111
122
  // User can fill promo code only in iframe application.
112
123
  // It isn't possible via payment link. This check will
113
124
  // be applied when there is no metadata and in case when
114
125
  // orderValues sum is greater than amount in order.
115
126
  const isCalculatedAmountGreaterThanOrderAmount =
116
- orderTotalAmountByFormValues > data?.amount
127
+ !hasRemaingToPay && orderCartAmountByFormValues > data?.amount
128
+
129
+ const isPaymentLinkWithRemainingToPay =
130
+ data?.remaining_to_pay && !!Number(data?.remaining_to_pay)
131
+ const totalPaidWithRemainingToPay =
132
+ data?.amount_to_pay && !!Number(data?.amount_to_pay)
117
133
 
118
134
  return (
119
135
  <Page className='payment_link'>
@@ -173,25 +189,63 @@ export const PaymentPage = ({
173
189
  <>
174
190
  {isCalculatedAmountGreaterThanOrderAmount && (
175
191
  <SummaryTotalBlock
176
- label={t('total')}
192
+ label={t(hasRemaingToPay ? 'payNow' : 'total')}
177
193
  amount={
178
- orderTotalAmountByFormValues +
194
+ orderCartAmountByFormValues +
179
195
  (bookingSummaryProps?.transactionFee || 0)
180
196
  }
181
197
  />
182
198
  )}
183
199
 
184
- <SummaryTotalBlock
185
- label={t(
186
- isCalculatedAmountGreaterThanOrderAmount
187
- ? 'totalWithDiscount'
188
- : 'total',
189
- )}
190
- amount={
191
- data?.amount +
192
- (bookingSummaryProps?.transactionFee || 0)
193
- }
194
- />
200
+ {hasRemaingToPay && (
201
+ <>
202
+ <SummaryTotalBlock
203
+ label={t('remaining')}
204
+ amount={
205
+ orderTotalAmountByFormValues -
206
+ orderCartAmountByFormValues
207
+ }
208
+ />
209
+
210
+ <SummaryTotalBlock
211
+ label={t('total')}
212
+ amount={orderTotalAmountByFormValues}
213
+ />
214
+ </>
215
+ )}
216
+
217
+ {isPaymentLinkWithRemainingToPay && (
218
+ <SummaryTotalBlock
219
+ label={t('remaningToPay')}
220
+ amount={Number(data?.remaining_to_pay)}
221
+ />
222
+ )}
223
+
224
+ {totalPaidWithRemainingToPay && (
225
+ <SummaryTotalBlock
226
+ label={t('totalAmount')}
227
+ amount={Number(data?.amount_to_pay)}
228
+ />
229
+ )}
230
+ {isPaymentLinkWithRemainingToPay &&
231
+ totalPaidWithRemainingToPay ? (
232
+ <SummaryTotalBlock
233
+ label={t('payNow')}
234
+ amount={data?.amount}
235
+ />
236
+ ) : (
237
+ <SummaryTotalBlock
238
+ label={t(
239
+ isCalculatedAmountGreaterThanOrderAmount
240
+ ? 'totalWithDiscount'
241
+ : 'total',
242
+ )}
243
+ amount={
244
+ data?.amount +
245
+ (bookingSummaryProps?.transactionFee || 0)
246
+ }
247
+ />
248
+ )}
195
249
  </>
196
250
  )}
197
251
  </div>
@@ -59,9 +59,20 @@ export const PaymentStatusPage = ({
59
59
 
60
60
  if (isLoading) return <LoaderIndicator isLoaded={false} />
61
61
 
62
- const orderTotalAmounByFormValues = cartSumByOrderProducts(
63
- Object.values(bookingSummaryProps?.formValues ?? {}),
64
- )
62
+
63
+ const orderCartAmountByFormValues = cartSumByOrderProducts({
64
+ orderProducts:
65
+ bookingSummaryProps?.formValues &&
66
+ Object.values(bookingSummaryProps?.formValues),
67
+ });
68
+ const orderTotalAmountByFormValues = cartSumByOrderProducts({
69
+ orderProducts:
70
+ bookingSummaryProps?.formValues &&
71
+ Object.values(bookingSummaryProps?.formValues),
72
+ isTotalSum: true,
73
+ });
74
+ const hasRemaingToPay =
75
+ orderTotalAmountByFormValues > orderCartAmountByFormValues;
65
76
 
66
77
  // User can fill promocode only in iframe appcliation.
67
78
  // It didn't possible via payment link. This check will
@@ -70,7 +81,9 @@ export const PaymentStatusPage = ({
70
81
  // For payment status page booking summary props can be empty
71
82
  // so we should also check for them
72
83
  const isCalculatedAmountGreaterThanOrderAmount =
73
- bookingSummaryProps && orderTotalAmounByFormValues > totalAmount
84
+ !hasRemaingToPay &&
85
+ bookingSummaryProps &&
86
+ orderCartAmountByFormValues > totalAmount;
74
87
 
75
88
  return (
76
89
  <Page
@@ -127,9 +140,9 @@ export const PaymentStatusPage = ({
127
140
  <>
128
141
  {isCalculatedAmountGreaterThanOrderAmount && (
129
142
  <SummaryTotalBlock
130
- label={t('total')}
143
+ label={t(hasRemaingToPay ? "payNow" : "total")}
131
144
  amount={
132
- orderTotalAmounByFormValues +
145
+ orderCartAmountByFormValues +
133
146
  (bookingSummaryProps?.transactionFee || 0)
134
147
  }
135
148
  />
@@ -146,6 +159,15 @@ export const PaymentStatusPage = ({
146
159
  (bookingSummaryProps?.transactionFee || 0)
147
160
  }
148
161
  />
162
+ {hasRemaingToPay && (
163
+ <SummaryTotalBlock
164
+ label={t("remaining")}
165
+ amount={
166
+ orderTotalAmountByFormValues -
167
+ orderCartAmountByFormValues
168
+ }
169
+ />
170
+ )}
149
171
  </>
150
172
  )}
151
173
  </div>
@@ -33,8 +33,10 @@
33
33
 
34
34
  &.disabled {
35
35
  border: 2px solid $snippet-calendar-disabled-button-border-color;
36
- background-color: $snippet-calendar-disabled-button-background-color;
36
+ background-color:transparent;
37
+ border: none;
37
38
  color: $snippet-calendar-disabled-button-font-color;
39
+ cursor: not-allowed;
38
40
 
39
41
  .weekday-info {
40
42
  div:last-child {