@chevre/domain 21.2.0-alpha.65 → 21.2.0-alpha.66
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.
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
|
|
11
|
+
const result = await chevre.service.transaction.returnOrder.start({
|
|
12
|
+
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
13
|
+
expiresInSeconds: 60,
|
|
14
|
+
agent: { id: 'xxx', typeOf: chevre.factory.creativeWorkType.WebApplication },
|
|
15
|
+
object: {
|
|
16
|
+
order: [{
|
|
17
|
+
confirmationNumber: '99916',
|
|
18
|
+
orderNumber: 'TTT2-8507485-9273468'
|
|
19
|
+
}],
|
|
20
|
+
reason: chevre.factory.transaction.returnOrder.Reason.Customer
|
|
21
|
+
},
|
|
22
|
+
seller: {
|
|
23
|
+
id: 'xxx'
|
|
24
|
+
}
|
|
25
|
+
})({
|
|
26
|
+
event: new chevre.repository.Event(mongoose.connection),
|
|
27
|
+
merchantReturnPolicy: new chevre.repository.MerchantReturnPolicy(mongoose.connection),
|
|
28
|
+
offer: new chevre.repository.Offer(mongoose.connection),
|
|
29
|
+
offerItemCondition: new chevre.repository.OfferItemCondition(mongoose.connection),
|
|
30
|
+
order: new chevre.repository.Order(mongoose.connection),
|
|
31
|
+
reservation: new chevre.repository.Reservation(mongoose.connection),
|
|
32
|
+
seller: new chevre.repository.Seller(mongoose.connection),
|
|
33
|
+
transaction: new chevre.repository.Transaction(mongoose.connection)
|
|
34
|
+
});
|
|
35
|
+
console.log(result);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
main()
|
|
39
|
+
.then(console.log)
|
|
40
|
+
.catch(console.error);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
2
|
import * as moment from 'moment-timezone';
|
|
3
3
|
|
|
4
|
-
const startDate = moment('2023-05-
|
|
4
|
+
const startDate = moment('2023-05-27T00:00:00Z')
|
|
5
5
|
.toDate();
|
|
6
6
|
const gracePeriodBeforeStartInDaysMin = {
|
|
7
7
|
timezone: 'Asia/Tokyo',
|
|
8
|
-
time: '
|
|
9
|
-
period: { value:
|
|
8
|
+
time: '09:38:00',
|
|
9
|
+
period: { value: 3 }
|
|
10
10
|
};
|
|
11
11
|
const returningDate = new Date();
|
|
12
12
|
|
|
@@ -13,11 +13,13 @@ exports.exportTasksById = exports.confirm = exports.start = void 0;
|
|
|
13
13
|
/**
|
|
14
14
|
* 返品取引サービス
|
|
15
15
|
*/
|
|
16
|
+
const createDebug = require("debug");
|
|
16
17
|
const moment = require("moment-timezone");
|
|
17
18
|
const factory = require("../../factory");
|
|
18
19
|
const factory_1 = require("./returnOrder/exportTasks/factory");
|
|
19
20
|
const potentialActions_1 = require("./returnOrder/potentialActions");
|
|
20
21
|
const errorHandler_1 = require("../../errorHandler");
|
|
22
|
+
const debug = createDebug('chevre-domain:service');
|
|
21
23
|
/**
|
|
22
24
|
* 返品取引開始
|
|
23
25
|
*/
|
|
@@ -310,11 +312,12 @@ function findApplicableReturnPolicy(params) {
|
|
|
310
312
|
.startOf('days')
|
|
311
313
|
.subtract(gracePeriodBeforeStartInDaysMin.period.value, 'days')
|
|
312
314
|
.format('YYYY-MM-DD');
|
|
313
|
-
const returnMaxDate = moment(`${minDate}T${gracePeriodBeforeStartInDaysMin.time}
|
|
314
|
-
|
|
315
|
+
const returnMaxDate = moment.tz(`${minDate}T${gracePeriodBeforeStartInDaysMin.time}`, gracePeriodBeforeStartInDaysMin.timezone);
|
|
316
|
+
debug('returnMaxDate:', returnMaxDate, 'returningDate:', returningDate);
|
|
315
317
|
return returnMaxDate.isSameOrAfter(moment(returningDate));
|
|
316
318
|
});
|
|
317
319
|
}
|
|
320
|
+
debug('satisfyGracePeriodInDaysMin:', satisfyGracePeriodInDaysMin);
|
|
318
321
|
satisfyItemCondition = satisfyGracePeriodMaxValue && satisfyGracePeriodMinValue
|
|
319
322
|
&& satisfyGracePeriodInDaysMax && satisfyGracePeriodInDaysMin;
|
|
320
323
|
}
|
package/package.json
CHANGED