@chevre/domain 21.2.0-alpha.67 → 21.2.0-alpha.68
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.
|
@@ -237,6 +237,7 @@ function findApplicableReturnPolicy(params) {
|
|
|
237
237
|
let applicalbleReturnPolicies = [];
|
|
238
238
|
if (params.reason === factory.transaction.returnOrder.Reason.Customer) {
|
|
239
239
|
// 適用可能なポリシーにフィルター
|
|
240
|
+
// tslint:disable-next-line:max-func-body-length
|
|
240
241
|
applicalbleReturnPolicies = returnPolicies.filter((returnPolicy) => {
|
|
241
242
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
242
243
|
let satisfyMerchantReturnDays = false;
|
|
@@ -285,7 +286,7 @@ function findApplicableReturnPolicy(params) {
|
|
|
285
286
|
if (typeof gracePeriodMinValue === 'number') {
|
|
286
287
|
satisfyGracePeriodMinValue = params.events.every((event) => {
|
|
287
288
|
return moment(event.startDate)
|
|
288
|
-
.
|
|
289
|
+
.isAfter(moment(params.returningDate)
|
|
289
290
|
.add(gracePeriodMinValue, 'seconds'));
|
|
290
291
|
});
|
|
291
292
|
}
|
|
@@ -293,16 +294,17 @@ function findApplicableReturnPolicy(params) {
|
|
|
293
294
|
if (typeof (gracePeriodBeforeStartInDaysMax === null || gracePeriodBeforeStartInDaysMax === void 0 ? void 0 : gracePeriodBeforeStartInDaysMax.period.value) === 'number'
|
|
294
295
|
&& typeof gracePeriodBeforeStartInDaysMax.time === 'string') {
|
|
295
296
|
satisfyGracePeriodInDaysMax = params.events.every((event) => {
|
|
296
|
-
const
|
|
297
|
+
const maxDate = moment(event.startDate)
|
|
297
298
|
.tz(gracePeriodBeforeStartInDaysMax.timezone)
|
|
298
299
|
.startOf('days')
|
|
299
300
|
.subtract(gracePeriodBeforeStartInDaysMax.period.value, 'days')
|
|
300
301
|
.format('YYYY-MM-DD');
|
|
301
|
-
const returnMinDate = moment(`${
|
|
302
|
-
|
|
302
|
+
const returnMinDate = moment.tz(`${maxDate}T${gracePeriodBeforeStartInDaysMax.time}`, gracePeriodBeforeStartInDaysMax.timezone);
|
|
303
|
+
debug('returnMinDate:', returnMinDate, 'returningDate:', returningDate);
|
|
303
304
|
return returnMinDate.isSameOrBefore(moment(returningDate));
|
|
304
305
|
});
|
|
305
306
|
}
|
|
307
|
+
debug('gracePeriodBeforeStartInDaysMax:', gracePeriodBeforeStartInDaysMax);
|
|
306
308
|
const gracePeriodBeforeStartInDaysMin = (_j = (_h = offerItemCondition.itemOffered.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservationFor.gracePeriodBeforeStartInDays) === null || _j === void 0 ? void 0 : _j.min;
|
|
307
309
|
if (typeof (gracePeriodBeforeStartInDaysMin === null || gracePeriodBeforeStartInDaysMin === void 0 ? void 0 : gracePeriodBeforeStartInDaysMin.period.value) === 'number'
|
|
308
310
|
&& typeof gracePeriodBeforeStartInDaysMin.time === 'string') {
|
|
@@ -314,7 +316,7 @@ function findApplicableReturnPolicy(params) {
|
|
|
314
316
|
.format('YYYY-MM-DD');
|
|
315
317
|
const returnMaxDate = moment.tz(`${minDate}T${gracePeriodBeforeStartInDaysMin.time}`, gracePeriodBeforeStartInDaysMin.timezone);
|
|
316
318
|
debug('returnMaxDate:', returnMaxDate, 'returningDate:', returningDate);
|
|
317
|
-
return returnMaxDate.
|
|
319
|
+
return returnMaxDate.isAfter(moment(returningDate));
|
|
318
320
|
});
|
|
319
321
|
}
|
|
320
322
|
debug('satisfyGracePeriodInDaysMin:', satisfyGracePeriodInDaysMin);
|
package/package.json
CHANGED