@chevre/domain 20.1.0-alpha.0 → 20.1.0-alpha.10
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.
- package/example/src/chevre/deleteEvents.ts +9 -1
- package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +127 -0
- package/lib/chevre/repo/action.js +42 -31
- package/lib/chevre/repo/assetTransaction.js +1 -1
- package/lib/chevre/repo/mongoose/model/action.js +12 -2
- package/lib/chevre/repo/mongoose/model/assetTransaction.js +3 -1
- package/lib/chevre/repo/mongoose/model/place.js +18 -0
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -0
- package/lib/chevre/service/assetTransaction/pay/factory.js +5 -11
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +11 -17
- package/lib/chevre/service/delivery/factory.js +2 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +46 -10
- package/lib/chevre/service/offer.js +6 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +6 -4
- package/lib/chevre/service/order/onOrderStatusChanged.js +5 -4
- package/lib/chevre/service/order/placeOrder.js +21 -11
- package/lib/chevre/service/order/returnOrder.js +3 -2
- package/lib/chevre/service/order/sendOrder.js +6 -4
- package/lib/chevre/service/payment/any/factory.d.ts +1 -0
- package/lib/chevre/service/payment/any/factory.js +4 -7
- package/lib/chevre/service/payment/any.d.ts +2 -0
- package/lib/chevre/service/payment/any.js +4 -2
- package/lib/chevre/service/transaction/orderProgramMembership.js +0 -3
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +5 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +9 -6
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -2
- package/lib/chevre/service/transaction.js +1 -14
- package/package.json +3 -3
- package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.d.ts +0 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.js +0 -187
|
@@ -23,7 +23,7 @@ function authorize(params) {
|
|
|
23
23
|
// tslint:disable-next-line:max-func-body-length
|
|
24
24
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
const now = new Date();
|
|
26
|
-
const { transaction, event, bookingServiceIdentifire } = yield validateCreateRequest(Object.assign(Object.assign({}, params), { now }))({ event: repos.event, transaction: repos.transaction });
|
|
26
|
+
const { transaction, event, bookingServiceIdentifire } = yield validateCreateRequest(Object.assign(Object.assign({}, params), { now, store: params.store }))({ event: repos.event, transaction: repos.transaction });
|
|
27
27
|
const acceptedOffers = yield validateAcceptedOffers({
|
|
28
28
|
object: params.object,
|
|
29
29
|
event,
|
|
@@ -121,12 +121,11 @@ function validateCreateRequest(params) {
|
|
|
121
121
|
}
|
|
122
122
|
const bookingServiceIdentifire = offeredThrough.identifier;
|
|
123
123
|
if (bookingServiceIdentifire === factory.service.webAPI.Identifier.Chevre) {
|
|
124
|
+
if (params.validateEventOfferPeriod === true) {
|
|
125
|
+
validateEventOfferPeriod({ event, now, availableAt: { id: params.store.id } });
|
|
126
|
+
}
|
|
124
127
|
if (params.validateEvent === true) {
|
|
125
|
-
validateEvent({
|
|
126
|
-
event,
|
|
127
|
-
now,
|
|
128
|
-
object: params.object
|
|
129
|
-
});
|
|
128
|
+
validateEvent({ event, object: params.object });
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
return { transaction, event, bookingServiceIdentifire };
|
|
@@ -204,12 +203,23 @@ function validateObjectWithoutDetail(params) {
|
|
|
204
203
|
return objectWithoutDetail;
|
|
205
204
|
});
|
|
206
205
|
}
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
/**
|
|
207
|
+
* イベントのオファー有効期間を検証する
|
|
208
|
+
*/
|
|
209
|
+
function validateEventOfferPeriod(params) {
|
|
209
210
|
const acceptedDate = moment(params.now);
|
|
210
211
|
const eventOffers = params.event.offers;
|
|
211
|
-
|
|
212
|
-
const
|
|
212
|
+
// アプリケーションごとの設定を参照する(2022-11-19~)
|
|
213
|
+
const makesOfferOnApplication = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.seller.makesOffer.find((offer) => {
|
|
214
|
+
return Array.isArray(offer.availableAtOrFrom) && offer.availableAtOrFrom[0].id === params.availableAt.id;
|
|
215
|
+
});
|
|
216
|
+
if (makesOfferOnApplication === undefined) {
|
|
217
|
+
throw new factory.errors.Argument('reservationFor.id', `seller makes no available offer at ${params.availableAt.id}`);
|
|
218
|
+
}
|
|
219
|
+
const validFrom = makesOfferOnApplication.validFrom;
|
|
220
|
+
const validThrough = makesOfferOnApplication.validThrough;
|
|
221
|
+
// const validFrom = eventOffers?.validFrom;
|
|
222
|
+
// const validThrough = eventOffers?.validThrough;
|
|
213
223
|
if (validFrom !== undefined && validFrom !== null) {
|
|
214
224
|
if (acceptedDate.isBefore(moment(validFrom))) {
|
|
215
225
|
throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid from ${validFrom}`);
|
|
@@ -220,6 +230,32 @@ function validateEvent(params) {
|
|
|
220
230
|
throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid through ${validThrough}`);
|
|
221
231
|
}
|
|
222
232
|
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* イベントの上限座席数を検証する
|
|
236
|
+
*/
|
|
237
|
+
function validateEvent(params) {
|
|
238
|
+
var _a, _b;
|
|
239
|
+
// const acceptedDate = moment(params.now);
|
|
240
|
+
const eventOffers = params.event.offers;
|
|
241
|
+
// const validFrom = eventOffers?.validFrom;
|
|
242
|
+
// const validThrough = eventOffers?.validThrough;
|
|
243
|
+
// if (validFrom !== undefined && validFrom !== null) {
|
|
244
|
+
// if (acceptedDate.isBefore(moment(validFrom))) {
|
|
245
|
+
// throw new factory.errors.Argument(
|
|
246
|
+
// 'reservationFor.id',
|
|
247
|
+
// `Offer of ${params.event.id} is valid from ${validFrom}`
|
|
248
|
+
// );
|
|
249
|
+
// }
|
|
250
|
+
// }
|
|
251
|
+
// if (validThrough !== undefined && validThrough !== null) {
|
|
252
|
+
// if (acceptedDate.isAfter(moment(validThrough))) {
|
|
253
|
+
// throw new factory.errors.Argument(
|
|
254
|
+
// 'reservationFor.id',
|
|
255
|
+
// `Offer of ${params.event.id} is valid through ${validThrough}`
|
|
256
|
+
// );
|
|
257
|
+
// }
|
|
258
|
+
// }
|
|
223
259
|
// イベントのmaxValueを検証
|
|
224
260
|
const maxValue = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.eligibleQuantity) === null || _a === void 0 ? void 0 : _a.maxValue;
|
|
225
261
|
if (typeof maxValue === 'number') {
|
|
@@ -40,12 +40,11 @@ function addOffers2Seat(params) {
|
|
|
40
40
|
&& categoryCode.inCodeSet.identifier === factory.categoryCode.CategorySetIdentifier.SeatingType;
|
|
41
41
|
});
|
|
42
42
|
}));
|
|
43
|
+
// 最適化(2022-11-15~)
|
|
43
44
|
const priceSpecification = {
|
|
44
|
-
// 不要な属性を除外(2022-11-02~)
|
|
45
|
-
// project: params.project,
|
|
46
45
|
typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
|
|
47
|
-
priceCurrency: factory.priceCurrency.JPY,
|
|
48
|
-
valueAddedTaxIncluded: true,
|
|
46
|
+
// priceCurrency: factory.priceCurrency.JPY,
|
|
47
|
+
// valueAddedTaxIncluded: true,
|
|
49
48
|
priceComponent: priceComponent
|
|
50
49
|
};
|
|
51
50
|
let availability = (unavailableOffer !== undefined)
|
|
@@ -55,9 +54,10 @@ function addOffers2Seat(params) {
|
|
|
55
54
|
availability = params.availability;
|
|
56
55
|
}
|
|
57
56
|
return Object.assign(Object.assign({}, params.seat), { offers: [{
|
|
58
|
-
|
|
57
|
+
// 最適化(2022-11-15~)
|
|
58
|
+
// project: params.project,
|
|
59
59
|
typeOf: factory.offerType.Offer,
|
|
60
|
-
priceCurrency: factory.priceCurrency.JPY,
|
|
60
|
+
// priceCurrency: factory.priceCurrency.JPY,
|
|
61
61
|
availability: availability,
|
|
62
62
|
priceSpecification: priceSpecification
|
|
63
63
|
}] });
|
|
@@ -33,7 +33,7 @@ function getOrderWithToken(params) {
|
|
|
33
33
|
? {
|
|
34
34
|
id: params.order.customer.id,
|
|
35
35
|
name: '****',
|
|
36
|
-
project: params.order.customer.project,
|
|
36
|
+
// project: params.order.customer.project,
|
|
37
37
|
typeOf: params.order.customer.typeOf
|
|
38
38
|
}
|
|
39
39
|
: {
|
|
@@ -42,15 +42,17 @@ function getOrderWithToken(params) {
|
|
|
42
42
|
};
|
|
43
43
|
const seller4orderToken = {
|
|
44
44
|
id: params.order.seller.id,
|
|
45
|
-
|
|
45
|
+
// 最適化(2022-11-15~)
|
|
46
|
+
// project: params.order.seller.project,
|
|
46
47
|
typeOf: params.order.seller.typeOf
|
|
47
48
|
};
|
|
48
49
|
const order4token = {
|
|
49
|
-
project: params.order.project,
|
|
50
|
+
// project: params.order.project,
|
|
50
51
|
typeOf: params.order.typeOf,
|
|
51
52
|
seller: seller4orderToken,
|
|
52
53
|
customer: customer4orderToken,
|
|
53
|
-
|
|
54
|
+
// IOrderへ移行(2022-11-17~)
|
|
55
|
+
// confirmationNumber: params.order.confirmationNumber,
|
|
54
56
|
orderNumber: params.order.orderNumber,
|
|
55
57
|
price: params.order.price,
|
|
56
58
|
priceCurrency: params.order.priceCurrency,
|
|
@@ -24,12 +24,13 @@ const TOKEN_EXPIRES_IN = 604800;
|
|
|
24
24
|
function onOrderStatusChanged(params) {
|
|
25
25
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
let tasks = [];
|
|
27
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order);
|
|
27
28
|
const simpleOrder = {
|
|
28
|
-
project: params.order.project,
|
|
29
29
|
typeOf: params.order.typeOf,
|
|
30
30
|
seller: params.order.seller,
|
|
31
|
-
customer:
|
|
32
|
-
|
|
31
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
32
|
+
// IOrderへ移行(2022-11-17~)
|
|
33
|
+
// confirmationNumber: params.order.confirmationNumber,
|
|
33
34
|
orderNumber: params.order.orderNumber,
|
|
34
35
|
price: params.order.price,
|
|
35
36
|
priceCurrency: params.order.priceCurrency,
|
|
@@ -118,7 +119,7 @@ function createConfirmPayTransactionTasks(order, simpleOrder) {
|
|
|
118
119
|
typeOf: factory.actionType.ConfirmAction,
|
|
119
120
|
object: [{ typeOf: factory.assetTransactionType.Pay, transactionNumber: paymentMethod.paymentMethodId }],
|
|
120
121
|
agent: order.project,
|
|
121
|
-
purpose: simpleOrder,
|
|
122
|
+
purpose: Object.assign(Object.assign({}, simpleOrder), { confirmationNumber: order.confirmationNumber }),
|
|
122
123
|
instrument: {
|
|
123
124
|
typeOf: 'WebAPI',
|
|
124
125
|
identifier: factory.action.authorize.paymentMethod.any.ServiceIdentifier.Chevre
|
|
@@ -89,19 +89,21 @@ function placeOrderWithoutTransaction(params) {
|
|
|
89
89
|
// orderNumber: params.object.orderNumber
|
|
90
90
|
// })({ transaction: repos.transaction });
|
|
91
91
|
// アクションを作成する(2022-04-11~)
|
|
92
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
|
|
92
93
|
const simpleOrder = {
|
|
93
|
-
project: order.project,
|
|
94
|
+
// project: order.project,
|
|
94
95
|
typeOf: order.typeOf,
|
|
95
96
|
seller: order.seller,
|
|
96
|
-
customer:
|
|
97
|
-
|
|
97
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
98
|
+
// IOrderへ移行(2022-11-17~)
|
|
99
|
+
// confirmationNumber: order.confirmationNumber,
|
|
98
100
|
orderNumber: order.orderNumber,
|
|
99
101
|
price: order.price,
|
|
100
102
|
priceCurrency: order.priceCurrency,
|
|
101
103
|
orderDate: order.orderDate
|
|
102
104
|
};
|
|
103
105
|
const orderActionAttributes = {
|
|
104
|
-
agent: (typeof ((_a = params.agent) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? params.agent :
|
|
106
|
+
agent: (typeof ((_a = params.agent) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? params.agent : order.project,
|
|
105
107
|
object: simpleOrder,
|
|
106
108
|
potentialActions: {},
|
|
107
109
|
project: order.project,
|
|
@@ -131,7 +133,10 @@ function placeOrderWithoutTransaction(params) {
|
|
|
131
133
|
task: repos.task
|
|
132
134
|
});
|
|
133
135
|
// 潜在アクション
|
|
134
|
-
yield onPlaceOrder(
|
|
136
|
+
yield onPlaceOrder({
|
|
137
|
+
object: order,
|
|
138
|
+
potentialActions: params.potentialActions
|
|
139
|
+
})(repos);
|
|
135
140
|
});
|
|
136
141
|
}
|
|
137
142
|
exports.placeOrderWithoutTransaction = placeOrderWithoutTransaction;
|
|
@@ -148,19 +153,21 @@ function placeOrder(params) {
|
|
|
148
153
|
orderNumber: params.object.orderNumber
|
|
149
154
|
})({ transaction: repos.transaction });
|
|
150
155
|
// アクションを作成する(2022-04-11~)
|
|
156
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
|
|
151
157
|
const simpleOrder = {
|
|
152
|
-
project: order.project,
|
|
158
|
+
// project: order.project,
|
|
153
159
|
typeOf: order.typeOf,
|
|
154
160
|
seller: order.seller,
|
|
155
|
-
customer:
|
|
156
|
-
|
|
161
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
162
|
+
// IOrderへ移行(2022-11-17~)
|
|
163
|
+
// confirmationNumber: order.confirmationNumber,
|
|
157
164
|
orderNumber: order.orderNumber,
|
|
158
165
|
price: order.price,
|
|
159
166
|
priceCurrency: order.priceCurrency,
|
|
160
167
|
orderDate: order.orderDate
|
|
161
168
|
};
|
|
162
169
|
const orderActionAttributes = {
|
|
163
|
-
agent: (typeof ((_a = params.agent) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? params.agent :
|
|
170
|
+
agent: (typeof ((_a = params.agent) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? params.agent : order.project,
|
|
164
171
|
object: simpleOrder,
|
|
165
172
|
potentialActions: {},
|
|
166
173
|
project: order.project,
|
|
@@ -190,7 +197,10 @@ function placeOrder(params) {
|
|
|
190
197
|
task: repos.task
|
|
191
198
|
});
|
|
192
199
|
// 潜在アクション
|
|
193
|
-
yield onPlaceOrder(
|
|
200
|
+
yield onPlaceOrder({
|
|
201
|
+
object: order,
|
|
202
|
+
potentialActions: params.potentialActions
|
|
203
|
+
})(repos);
|
|
194
204
|
});
|
|
195
205
|
}
|
|
196
206
|
exports.placeOrder = placeOrder;
|
|
@@ -218,7 +228,7 @@ function onPlaceOrder(params) {
|
|
|
218
228
|
numberOfTried: 0,
|
|
219
229
|
executionResults: [],
|
|
220
230
|
// data: potentialActions.sendOrder
|
|
221
|
-
data: Object.assign({ project: potentialActions.sendOrder.project, object: potentialActions.sendOrder.object }, (potentialActions.sendOrder.potentialActions !== undefined)
|
|
231
|
+
data: Object.assign({ project: potentialActions.sendOrder.project, object: Object.assign(Object.assign({}, potentialActions.sendOrder.object), { confirmationNumber: params.object.confirmationNumber }) }, (potentialActions.sendOrder.potentialActions !== undefined)
|
|
222
232
|
? { potentialActions: potentialActions.sendOrder.potentialActions }
|
|
223
233
|
: undefined)
|
|
224
234
|
};
|
|
@@ -40,11 +40,12 @@ function returnOrder(params) {
|
|
|
40
40
|
throw new factory.errors.NotFound(factory.transactionType.ReturnOrder);
|
|
41
41
|
}
|
|
42
42
|
const simpleOrder = {
|
|
43
|
-
project: order.project,
|
|
43
|
+
// project: order.project,
|
|
44
44
|
typeOf: order.typeOf,
|
|
45
45
|
seller: order.seller,
|
|
46
46
|
customer: (0, order_1.createMaskedCustomer)(order),
|
|
47
|
-
|
|
47
|
+
// IOrderへ移行(2022-11-17~)
|
|
48
|
+
// confirmationNumber: order.confirmationNumber,
|
|
48
49
|
orderNumber: order.orderNumber,
|
|
49
50
|
price: order.price,
|
|
50
51
|
priceCurrency: order.priceCurrency,
|
|
@@ -42,19 +42,21 @@ function sendOrder(params) {
|
|
|
42
42
|
}
|
|
43
43
|
// SendOrderアクションを作成する
|
|
44
44
|
// minimizeする(2022-04-18~)
|
|
45
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
|
|
45
46
|
const simpleOrder = {
|
|
46
|
-
project: order.project,
|
|
47
|
+
// project: order.project,
|
|
47
48
|
typeOf: order.typeOf,
|
|
48
49
|
seller: order.seller,
|
|
49
|
-
customer:
|
|
50
|
-
|
|
50
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
51
|
+
// IOrderへ移行(2022-11-17~)
|
|
52
|
+
// confirmationNumber: order.confirmationNumber,
|
|
51
53
|
orderNumber: order.orderNumber,
|
|
52
54
|
price: order.price,
|
|
53
55
|
priceCurrency: order.priceCurrency,
|
|
54
56
|
orderDate: order.orderDate
|
|
55
57
|
};
|
|
56
58
|
const sendOrderActionAttributes = {
|
|
57
|
-
agent: (typeof ((_a = params.agent) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? params.agent :
|
|
59
|
+
agent: (typeof ((_a = params.agent) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? params.agent : order.project,
|
|
58
60
|
object: simpleOrder,
|
|
59
61
|
potentialActions: {
|
|
60
62
|
// sendEmailMessage: undefined
|
|
@@ -16,6 +16,7 @@ export declare function creatPayTransactionStartParams(params: {
|
|
|
16
16
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
17
17
|
transaction: factory.transaction.ITransaction<factory.transactionType>;
|
|
18
18
|
transactionNumber: string;
|
|
19
|
+
location?: factory.action.trade.pay.ILocation;
|
|
19
20
|
}): factory.assetTransaction.pay.IStartParamsWithoutDetail;
|
|
20
21
|
export declare function createAuthorizeResult(params: {
|
|
21
22
|
object: factory.action.authorize.paymentMethod.any.IObject;
|
|
@@ -4,7 +4,7 @@ exports.optimizeAction4inform = exports.createAuthorizeResult = exports.creatPay
|
|
|
4
4
|
const moment = require("moment");
|
|
5
5
|
const factory = require("../../../factory");
|
|
6
6
|
function creatPayTransactionStartParams(params) {
|
|
7
|
-
var _a, _b, _c;
|
|
7
|
+
var _a, _b, _c, _d;
|
|
8
8
|
const expires = moment(params.transaction.expires)
|
|
9
9
|
.add(1, 'month')
|
|
10
10
|
.toDate(); // 余裕を持って
|
|
@@ -13,18 +13,13 @@ function creatPayTransactionStartParams(params) {
|
|
|
13
13
|
const accountId = (typeof params.accountId === 'string')
|
|
14
14
|
? params.accountId
|
|
15
15
|
: (typeof params.object.accountId === 'string') ? params.object.accountId : undefined;
|
|
16
|
-
return Object.assign({ project: { id: params.transaction.project.id, typeOf: factory.organizationType.Project }, typeOf: factory.assetTransactionType.Pay, transactionNumber: params.transactionNumber, agent: {
|
|
16
|
+
return Object.assign(Object.assign({ project: { id: params.transaction.project.id, typeOf: factory.organizationType.Project }, typeOf: factory.assetTransactionType.Pay, transactionNumber: params.transactionNumber, agent: {
|
|
17
17
|
// Sellerに変更(2022-05-30~)
|
|
18
18
|
typeOf: params.transaction.seller.typeOf,
|
|
19
19
|
id: String(params.transaction.seller.id),
|
|
20
20
|
name: (typeof params.transaction.seller.name === 'string')
|
|
21
21
|
? params.transaction.seller.name
|
|
22
22
|
: String((_b = params.transaction.seller.name) === null || _b === void 0 ? void 0 : _b.ja),
|
|
23
|
-
// typeOf: params.transaction.agent.typeOf,
|
|
24
|
-
// id: params.transaction.agent.id,
|
|
25
|
-
// name: (typeof params.transaction.agent.name === 'string' && params.transaction.agent.name.length > 0)
|
|
26
|
-
// ? params.transaction.agent.name
|
|
27
|
-
// : params.transaction.agent.id
|
|
28
23
|
identifier: [
|
|
29
24
|
{ name: 'transaction', value: params.transaction.id },
|
|
30
25
|
{
|
|
@@ -51,6 +46,8 @@ function creatPayTransactionStartParams(params) {
|
|
|
51
46
|
confirmationNumber: confirmationNumber
|
|
52
47
|
}
|
|
53
48
|
}
|
|
49
|
+
: undefined), (typeof ((_d = params.location) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
50
|
+
? { location: params.location }
|
|
54
51
|
: undefined);
|
|
55
52
|
}
|
|
56
53
|
exports.creatPayTransactionStartParams = creatPayTransactionStartParams;
|
|
@@ -87,6 +87,7 @@ declare function publishPaymentUrl(params: {
|
|
|
87
87
|
object: factory.action.authorize.paymentMethod.any.IObject;
|
|
88
88
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
89
89
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
90
|
+
location: factory.action.trade.pay.ILocation;
|
|
90
91
|
}): IPublishPaymentUrlOperation<PayTransactionService.IPublishPaymentUrlResult>;
|
|
91
92
|
/**
|
|
92
93
|
* 決済承認
|
|
@@ -101,5 +102,6 @@ declare function authorize(params: {
|
|
|
101
102
|
object: factory.action.authorize.paymentMethod.any.IObject;
|
|
102
103
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
103
104
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
105
|
+
location?: factory.action.trade.pay.ILocation;
|
|
104
106
|
}): IAuthorizeOperation<IAuthorizePaymentAction>;
|
|
105
107
|
export { onPaymentStatusChanged, authorize, invalidatePaymentUrl, voidPayTransaction, person2username, processVoidPayTransaction, publishPaymentUrl };
|
|
@@ -175,7 +175,8 @@ function publishPaymentUrl(params) {
|
|
|
175
175
|
object: params.object,
|
|
176
176
|
paymentServiceType,
|
|
177
177
|
transaction: transaction,
|
|
178
|
-
transactionNumber: transactionNumber
|
|
178
|
+
transactionNumber: transactionNumber,
|
|
179
|
+
location: params.location
|
|
179
180
|
});
|
|
180
181
|
// result = await repos.payTransaction.publishPaymentUrl({ ...startParams, iss: params.iss });
|
|
181
182
|
result = yield PayTransactionService.publishPaymentUrl(startParams)(repos);
|
|
@@ -253,7 +254,8 @@ function authorize(params) {
|
|
|
253
254
|
object: params.object,
|
|
254
255
|
paymentServiceType,
|
|
255
256
|
transaction: transaction,
|
|
256
|
-
transactionNumber: transactionNumber
|
|
257
|
+
transactionNumber: transactionNumber,
|
|
258
|
+
location: params.location
|
|
257
259
|
});
|
|
258
260
|
// payTransaction = await repos.payTransaction.start({ ...startParams, iss: params.iss });
|
|
259
261
|
payTransaction = yield PayTransactionService.start(startParams)(repos);
|
|
@@ -120,9 +120,6 @@ function createStartPlaceOrderInProgressParams(params) {
|
|
|
120
120
|
id: customer.id,
|
|
121
121
|
identifier: customer.identifier,
|
|
122
122
|
memberOf: customer.memberOf
|
|
123
|
-
// ↓不要なので廃止(2022-05-26~)
|
|
124
|
-
// paramsにadditionalPropertyの指定があれば反映する
|
|
125
|
-
// ...(Array.isArray(params.agent.additionalProperty)) ? { additionalProperty: params.agent.additionalProperty } : []
|
|
126
123
|
};
|
|
127
124
|
return {
|
|
128
125
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
@@ -9,6 +9,7 @@ const settings_1 = require("../../../../settings");
|
|
|
9
9
|
*/
|
|
10
10
|
// tslint:disable-next-line:max-func-body-length
|
|
11
11
|
function createTasks(params) {
|
|
12
|
+
var _a;
|
|
12
13
|
const taskAttributes = [];
|
|
13
14
|
const transaction = params.transaction;
|
|
14
15
|
const taskRunsAt = params.runsAt;
|
|
@@ -24,7 +25,6 @@ function createTasks(params) {
|
|
|
24
25
|
executionResults: [],
|
|
25
26
|
data: {
|
|
26
27
|
agent: transaction.project,
|
|
27
|
-
// agent: transaction.seller,
|
|
28
28
|
object: transaction,
|
|
29
29
|
project: transaction.project,
|
|
30
30
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
@@ -72,6 +72,10 @@ function createTasks(params) {
|
|
|
72
72
|
if (potentialActions === undefined) {
|
|
73
73
|
throw new factory.errors.NotFound('Transaction PotentialActions');
|
|
74
74
|
}
|
|
75
|
+
const orderFromTransaction = (_a = transaction.result) === null || _a === void 0 ? void 0 : _a.order;
|
|
76
|
+
if (orderFromTransaction === undefined) {
|
|
77
|
+
throw new factory.errors.NotFound('Transaction Result');
|
|
78
|
+
}
|
|
75
79
|
const orderActionAttributes = potentialActions.order;
|
|
76
80
|
const placeOrderTaskAttributes = {
|
|
77
81
|
project: transaction.project,
|
|
@@ -81,9 +85,8 @@ function createTasks(params) {
|
|
|
81
85
|
remainingNumberOfTries: 10,
|
|
82
86
|
numberOfTried: 0,
|
|
83
87
|
executionResults: [],
|
|
84
|
-
// data: orderActionAttributes
|
|
85
88
|
data: Object.assign({ project: orderActionAttributes.project, object: {
|
|
86
|
-
confirmationNumber:
|
|
89
|
+
confirmationNumber: orderFromTransaction.confirmationNumber,
|
|
87
90
|
orderNumber: orderActionAttributes.object.orderNumber
|
|
88
91
|
} }, (orderActionAttributes.potentialActions !== undefined)
|
|
89
92
|
? { potentialActions: orderActionAttributes.potentialActions }
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js
CHANGED
|
@@ -43,12 +43,13 @@ function createGivePointAwardActions(params) {
|
|
|
43
43
|
issuedThrough: { id: String((_h = (_g = (_f = givePointAwardParam.object) === null || _f === void 0 ? void 0 : _f.toLocation) === null || _g === void 0 ? void 0 : _g.issuedThrough) === null || _h === void 0 ? void 0 : _h.id) }
|
|
44
44
|
}, description: (typeof description === 'string') ? description : '' }, (typeof pointAwardIdentifier === 'string') ? { identifier: pointAwardIdentifier } : undefined),
|
|
45
45
|
purpose: {
|
|
46
|
-
project: params.order.project,
|
|
46
|
+
// project: params.order.project,
|
|
47
47
|
typeOf: params.order.typeOf,
|
|
48
48
|
seller: params.order.seller,
|
|
49
49
|
// mask
|
|
50
50
|
customer: (0, order_1.createMaskedCustomer)(params.order),
|
|
51
|
-
|
|
51
|
+
// IOrderへ移行(2022-11-17~)
|
|
52
|
+
// confirmationNumber: params.order.confirmationNumber,
|
|
52
53
|
orderNumber: params.order.orderNumber,
|
|
53
54
|
price: params.order.price,
|
|
54
55
|
priceCurrency: params.order.priceCurrency,
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js
CHANGED
|
@@ -61,12 +61,13 @@ function createMoneyTransferActions(params) {
|
|
|
61
61
|
// identifier: pendingTransaction.object.toLocation.identifier
|
|
62
62
|
// },
|
|
63
63
|
purpose: {
|
|
64
|
-
project: params.order.project,
|
|
64
|
+
// project: params.order.project,
|
|
65
65
|
typeOf: params.order.typeOf,
|
|
66
66
|
seller: params.order.seller,
|
|
67
67
|
// mask
|
|
68
68
|
customer: (0, order_1.createMaskedCustomer)(params.order),
|
|
69
|
-
|
|
69
|
+
// IOrderへ移行(2022-11-17~)
|
|
70
|
+
// confirmationNumber: params.order.confirmationNumber,
|
|
70
71
|
orderNumber: params.order.orderNumber,
|
|
71
72
|
price: params.order.price,
|
|
72
73
|
priceCurrency: params.order.priceCurrency,
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js
CHANGED
|
@@ -46,12 +46,13 @@ function createRegisterServiceActions(params) {
|
|
|
46
46
|
agent: params.transaction.project,
|
|
47
47
|
// agent: params.transaction.agent,
|
|
48
48
|
purpose: {
|
|
49
|
-
project: params.order.project,
|
|
49
|
+
// project: params.order.project,
|
|
50
50
|
typeOf: params.order.typeOf,
|
|
51
51
|
seller: params.order.seller,
|
|
52
52
|
// mask
|
|
53
53
|
customer: (0, order_1.createMaskedCustomer)(params.order),
|
|
54
|
-
|
|
54
|
+
// IOrderへ移行(2022-11-17~)
|
|
55
|
+
// confirmationNumber: params.order.confirmationNumber,
|
|
55
56
|
orderNumber: params.order.orderNumber,
|
|
56
57
|
price: params.order.price,
|
|
57
58
|
priceCurrency: params.order.priceCurrency,
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js
CHANGED
|
@@ -19,13 +19,14 @@ function createSendEmailMessageActions(params) {
|
|
|
19
19
|
// 注文配送メール送信設定
|
|
20
20
|
const sendEmailMessageActions = [];
|
|
21
21
|
const project = params.transaction.project;
|
|
22
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order);
|
|
22
23
|
const sendActionPurpose = {
|
|
23
|
-
project: params.order.project,
|
|
24
24
|
typeOf: params.order.typeOf,
|
|
25
25
|
seller: params.order.seller,
|
|
26
26
|
// mask
|
|
27
|
-
customer:
|
|
28
|
-
|
|
27
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
28
|
+
// IOrderへ移行(2022-11-17~)
|
|
29
|
+
// confirmationNumber: params.order.confirmationNumber,
|
|
29
30
|
orderNumber: params.order.orderNumber,
|
|
30
31
|
price: params.order.price,
|
|
31
32
|
priceCurrency: params.order.priceCurrency,
|
|
@@ -34,13 +34,15 @@ function createPotentialActions(params) {
|
|
|
34
34
|
const givePointAwardActions = yield (0, givePointAward_1.createGivePointAwardActions)(params);
|
|
35
35
|
// 注文配送メール送信設定
|
|
36
36
|
const sendEmailMessageActions = yield (0, sendEmailMessage_1.createSendEmailMessageActions)(params);
|
|
37
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order);
|
|
37
38
|
const simpleOrder = {
|
|
38
|
-
project: params.order.project,
|
|
39
|
+
// project: params.order.project,
|
|
39
40
|
typeOf: params.order.typeOf,
|
|
40
41
|
seller: params.order.seller,
|
|
41
42
|
// mask
|
|
42
|
-
customer:
|
|
43
|
-
|
|
43
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
44
|
+
// IOrderへ移行(2022-11-17~)
|
|
45
|
+
// confirmationNumber: params.order.confirmationNumber,
|
|
44
46
|
orderNumber: params.order.orderNumber,
|
|
45
47
|
price: params.order.price,
|
|
46
48
|
priceCurrency: params.order.priceCurrency,
|
|
@@ -34,13 +34,11 @@ function createSeller(params) {
|
|
|
34
34
|
var _a;
|
|
35
35
|
const seller = params.transaction.seller;
|
|
36
36
|
return {
|
|
37
|
-
|
|
37
|
+
// 最適化(2022-11-15~)
|
|
38
|
+
// project: { typeOf: params.transaction.project.typeOf, id: params.transaction.project.id },
|
|
38
39
|
id: seller.id,
|
|
39
40
|
name: (typeof seller.name === 'string') ? seller.name : String((_a = seller.name) === null || _a === void 0 ? void 0 : _a.ja),
|
|
40
41
|
typeOf: seller.typeOf
|
|
41
|
-
// ↓最適化(2022-05-20~)
|
|
42
|
-
// ...(typeof seller.telephone === 'string') ? { telephone: seller.telephone } : undefined,
|
|
43
|
-
// ...(typeof seller.url === 'string') ? { url: seller.url } : undefined
|
|
44
42
|
};
|
|
45
43
|
}
|
|
46
44
|
function createCustomer(params) {
|
|
@@ -17,13 +17,14 @@ function createReturnMoneyTransferActions(params) {
|
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
const order = params.order;
|
|
19
19
|
const returnMoneyTransferActions = [];
|
|
20
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
|
|
20
21
|
const purpose = {
|
|
21
|
-
project: order.project,
|
|
22
22
|
typeOf: order.typeOf,
|
|
23
23
|
seller: order.seller,
|
|
24
24
|
// mask
|
|
25
|
-
customer:
|
|
26
|
-
|
|
25
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
26
|
+
// IOrderへ移行(2022-11-17~)
|
|
27
|
+
// confirmationNumber: order.confirmationNumber,
|
|
27
28
|
orderNumber: order.orderNumber,
|
|
28
29
|
price: order.price,
|
|
29
30
|
priceCurrency: order.priceCurrency,
|
|
@@ -62,11 +63,9 @@ function createReturnMoneyTransferActions(params) {
|
|
|
62
63
|
},
|
|
63
64
|
agent: order.project,
|
|
64
65
|
recipient: {
|
|
65
|
-
// project: { typeOf: transaction.project.typeOf, id: transaction.project.id },
|
|
66
66
|
typeOf: order.seller.typeOf,
|
|
67
67
|
id: order.seller.id,
|
|
68
68
|
name: order.seller.name
|
|
69
|
-
// url: order.seller.url
|
|
70
69
|
},
|
|
71
70
|
potentialActions: {},
|
|
72
71
|
purpose,
|
|
@@ -40,12 +40,13 @@ function createReturnPaymentMethodPotentialActions(params) {
|
|
|
40
40
|
email: emailCustomization
|
|
41
41
|
});
|
|
42
42
|
const sendActionPurpose = {
|
|
43
|
-
project: order.project,
|
|
43
|
+
// project: order.project,
|
|
44
44
|
typeOf: order.typeOf,
|
|
45
45
|
seller: order.seller,
|
|
46
46
|
// mask
|
|
47
47
|
customer: (0, order_1.createMaskedCustomer)(order),
|
|
48
|
-
|
|
48
|
+
// IOrderへ移行(2022-11-17~)
|
|
49
|
+
// confirmationNumber: order.confirmationNumber,
|
|
49
50
|
orderNumber: order.orderNumber,
|
|
50
51
|
price: order.price,
|
|
51
52
|
priceCurrency: order.priceCurrency,
|
|
@@ -104,12 +105,13 @@ function createReturnPaymentMethodActions(params) {
|
|
|
104
105
|
name: String(order.customer.name)
|
|
105
106
|
},
|
|
106
107
|
purpose: {
|
|
107
|
-
project: order.project,
|
|
108
|
+
// project: order.project,
|
|
108
109
|
typeOf: order.typeOf,
|
|
109
110
|
seller: order.seller,
|
|
110
111
|
// mask
|
|
111
112
|
customer: (0, order_1.createMaskedCustomer)(order),
|
|
112
|
-
|
|
113
|
+
// IOrderへ移行(2022-11-17~)
|
|
114
|
+
// confirmationNumber: order.confirmationNumber,
|
|
113
115
|
orderNumber: order.orderNumber,
|
|
114
116
|
price: order.price,
|
|
115
117
|
priceCurrency: order.priceCurrency,
|
|
@@ -174,12 +176,13 @@ function createReturnPaymentMethodIssuedThroughMovieTicketActions(params) {
|
|
|
174
176
|
name: String(order.customer.name)
|
|
175
177
|
},
|
|
176
178
|
purpose: {
|
|
177
|
-
project: order.project,
|
|
179
|
+
// project: order.project,
|
|
178
180
|
typeOf: order.typeOf,
|
|
179
181
|
seller: order.seller,
|
|
180
182
|
// mask
|
|
181
183
|
customer: (0, order_1.createMaskedCustomer)(order),
|
|
182
|
-
|
|
184
|
+
// IOrderへ移行(2022-11-17~)
|
|
185
|
+
// confirmationNumber: order.confirmationNumber,
|
|
183
186
|
orderNumber: order.orderNumber,
|
|
184
187
|
price: order.price,
|
|
185
188
|
priceCurrency: order.priceCurrency,
|