@chevre/domain 21.18.0-alpha.40 → 21.18.0-alpha.41
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/lib/chevre/repo/product.d.ts +2 -2
- package/lib/chevre/repo/product.js +30 -10
- package/lib/chevre/service/assetTransaction/pay.js +37 -28
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund/factory.js +0 -5
- package/lib/chevre/service/assetTransaction/refund.js +15 -3
- package/package.json +3 -3
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import type { Connection } from 'mongoose';
|
|
25
|
+
import type { Connection, FilterQuery } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
27
|
type IKeyOfProjection4product = keyof factory.product.IProduct | '_id';
|
|
28
28
|
/**
|
|
@@ -53,7 +53,7 @@ type IUnsetKey = keyof Pick<factory.product.IProduct, 'additionalProperty' | 'av
|
|
|
53
53
|
export declare class MongoRepository {
|
|
54
54
|
private readonly productModel;
|
|
55
55
|
constructor(connection: Connection);
|
|
56
|
-
static CREATE_MONGO_CONDITIONS(params: factory.product.ISearchConditions):
|
|
56
|
+
static CREATE_MONGO_CONDITIONS(params: factory.product.ISearchConditions): FilterQuery<factory.product.IProduct>[];
|
|
57
57
|
findById(conditions: {
|
|
58
58
|
id: string;
|
|
59
59
|
}, inclusion: string[], exclusion: string[]): Promise<factory.product.IProduct | factory.service.paymentService.IService>;
|
|
@@ -227,6 +227,15 @@ class MongoRepository {
|
|
|
227
227
|
var _a;
|
|
228
228
|
return __awaiter(this, void 0, void 0, function* () {
|
|
229
229
|
const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
|
|
230
|
+
// 強制的にtypeOfを絞る
|
|
231
|
+
andConditions.push({
|
|
232
|
+
typeOf: {
|
|
233
|
+
$in: [
|
|
234
|
+
factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
235
|
+
factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
});
|
|
230
239
|
let projection = {};
|
|
231
240
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
232
241
|
inclusion.forEach((field) => {
|
|
@@ -272,18 +281,29 @@ class MongoRepository {
|
|
|
272
281
|
*/
|
|
273
282
|
findAvailableChannel(params) {
|
|
274
283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
let paymentService;
|
|
285
|
+
if (params.typeOf === factory.service.paymentService.PaymentServiceType.PaymentCard) {
|
|
286
|
+
paymentService = (yield this.searchProducts({
|
|
287
|
+
limit: 1,
|
|
288
|
+
page: 1,
|
|
289
|
+
project: { id: { $eq: params.project.id } },
|
|
290
|
+
typeOf: { $eq: factory.product.ProductType.PaymentCard },
|
|
291
|
+
id: { $eq: params.id }
|
|
292
|
+
}, ['availableChannel'], [])).shift();
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
paymentService = (yield this.searchPaymentServices({
|
|
296
|
+
limit: 1,
|
|
297
|
+
page: 1,
|
|
298
|
+
project: { id: { $eq: params.project.id } },
|
|
299
|
+
typeOf: { $eq: params.typeOf },
|
|
300
|
+
id: { $eq: params.id }
|
|
301
|
+
}, ['availableChannel'], [])).shift();
|
|
302
|
+
}
|
|
303
|
+
if (paymentService === undefined) {
|
|
284
304
|
throw new factory.errors.NotFound('PaymentService');
|
|
285
305
|
}
|
|
286
|
-
const availableChannel =
|
|
306
|
+
const availableChannel = paymentService.availableChannel;
|
|
287
307
|
if (availableChannel === undefined) {
|
|
288
308
|
throw new factory.errors.NotFound('paymentService.availableChannel');
|
|
289
309
|
}
|
|
@@ -36,7 +36,7 @@ function publishPaymentUrl(params) {
|
|
|
36
36
|
}
|
|
37
37
|
yield validateSeller(params)(repos);
|
|
38
38
|
// 決済サービス確認
|
|
39
|
-
const paymentServiceId =
|
|
39
|
+
const paymentServiceId = getPaymentServiceId(params);
|
|
40
40
|
let result;
|
|
41
41
|
switch (paymentServiceType) {
|
|
42
42
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
@@ -150,29 +150,27 @@ function start(params, options) {
|
|
|
150
150
|
}
|
|
151
151
|
exports.start = start;
|
|
152
152
|
function getPaymentServiceId(params) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
172
|
-
}
|
|
153
|
+
var _a;
|
|
154
|
+
let paymentServiceId = '';
|
|
155
|
+
const paymentServiceType = (_a = params.object) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
156
|
+
if (typeof params.object.id === 'string' && params.object.id.length > 0) {
|
|
157
|
+
paymentServiceId = params.object.id;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
switch (paymentServiceType) {
|
|
161
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
162
|
+
// 対面決済は特に何もしない
|
|
163
|
+
break;
|
|
164
|
+
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
165
|
+
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
166
|
+
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
167
|
+
// リクエストでの指定を必須化(2022-04-12~)
|
|
168
|
+
throw new factory.errors.ArgumentNull('object.id');
|
|
169
|
+
default:
|
|
170
|
+
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
173
171
|
}
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
}
|
|
173
|
+
return paymentServiceId;
|
|
176
174
|
}
|
|
177
175
|
function fixPaymentService(params) {
|
|
178
176
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -184,16 +182,27 @@ function fixPaymentService(params) {
|
|
|
184
182
|
// no op
|
|
185
183
|
// FaceToFaceの場合プロダクトは存在しない
|
|
186
184
|
break;
|
|
185
|
+
// PaymentCardの場合、プロダクト検索
|
|
186
|
+
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
187
|
+
paymentService = (yield repos.product.searchProducts({
|
|
188
|
+
limit: 1,
|
|
189
|
+
page: 1,
|
|
190
|
+
project: { id: { $eq: params.project.id } },
|
|
191
|
+
typeOf: { $eq: factory.product.ProductType.PaymentCard },
|
|
192
|
+
id: { $eq: getPaymentServiceId(params) }
|
|
193
|
+
}, [], [])).shift();
|
|
194
|
+
if (paymentService === undefined) {
|
|
195
|
+
throw new factory.errors.NotFound('PaymentService');
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
187
198
|
default:
|
|
188
|
-
|
|
189
|
-
const paymentServices = yield repos.product.searchPaymentServices({
|
|
199
|
+
paymentService = (yield repos.product.searchPaymentServices({
|
|
190
200
|
limit: 1,
|
|
191
201
|
page: 1,
|
|
192
202
|
project: { id: { $eq: params.project.id } },
|
|
193
203
|
typeOf: { $eq: paymentServiceType },
|
|
194
|
-
id: { $eq:
|
|
195
|
-
}, [], []);
|
|
196
|
-
paymentService = paymentServices.shift();
|
|
204
|
+
id: { $eq: getPaymentServiceId(params) }
|
|
205
|
+
}, [], [])).shift();
|
|
197
206
|
if (paymentService === undefined) {
|
|
198
207
|
throw new factory.errors.NotFound('PaymentService');
|
|
199
208
|
}
|
|
@@ -6,5 +6,5 @@ export declare function createStartParams(params: factory.assetTransaction.refun
|
|
|
6
6
|
transactionNumber: string;
|
|
7
7
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
8
8
|
payAction: factory.action.trade.pay.IAction;
|
|
9
|
-
paymentService?: factory.service.paymentService.IService;
|
|
9
|
+
paymentService?: factory.product.IProduct | factory.service.paymentService.IService;
|
|
10
10
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Refund>;
|
|
@@ -54,11 +54,6 @@ exports.createStartParams = createStartParams;
|
|
|
54
54
|
function createInformPaymentParams(params) {
|
|
55
55
|
var _a, _b, _c;
|
|
56
56
|
const informPaymentParams = [];
|
|
57
|
-
// 廃止(2022-10-29~)
|
|
58
|
-
// const informPaymentParamsByGlobalSettings = settings.onPaymentStatusChanged?.informPayment;
|
|
59
|
-
// if (Array.isArray(informPaymentParamsByGlobalSettings)) {
|
|
60
|
-
// informPaymentParams.push(...informPaymentParamsByGlobalSettings);
|
|
61
|
-
// }
|
|
62
57
|
// プロダクト設定を適用
|
|
63
58
|
const informPaymentParamsByProduct = (_c = (_b = (_a = params.paymentService) === null || _a === void 0 ? void 0 : _a.availableChannel) === null || _b === void 0 ? void 0 : _b.onPaymentStatusChanged) === null || _c === void 0 ? void 0 : _c.informPayment;
|
|
64
59
|
if (Array.isArray(informPaymentParamsByProduct)) {
|
|
@@ -84,15 +84,27 @@ function fixPaymentService(params) {
|
|
|
84
84
|
// no op
|
|
85
85
|
// FaceToFaceの場合プロダクトは存在しない
|
|
86
86
|
break;
|
|
87
|
+
// PaymentCardの場合、プロダクト検索
|
|
88
|
+
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
89
|
+
paymentService = (yield repos.product.searchProducts({
|
|
90
|
+
limit: 1,
|
|
91
|
+
page: 1,
|
|
92
|
+
project: { id: { $eq: params.payAction.project.id } },
|
|
93
|
+
typeOf: { $eq: factory.product.ProductType.PaymentCard },
|
|
94
|
+
id: { $eq: paymentServiceId }
|
|
95
|
+
}, [], [])).shift();
|
|
96
|
+
if (paymentService === undefined) {
|
|
97
|
+
throw new factory.errors.NotFound('PaymentService');
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
87
100
|
default:
|
|
88
|
-
|
|
101
|
+
paymentService = (yield repos.product.searchPaymentServices({
|
|
89
102
|
limit: 1,
|
|
90
103
|
page: 1,
|
|
91
104
|
project: { id: { $eq: params.payAction.project.id } },
|
|
92
105
|
typeOf: { $eq: params.paymentServiceType },
|
|
93
106
|
id: { $eq: paymentServiceId }
|
|
94
|
-
}, [], []);
|
|
95
|
-
paymentService = paymentServices.shift();
|
|
107
|
+
}, [], [])).shift();
|
|
96
108
|
if (paymentService === undefined) {
|
|
97
109
|
throw new factory.errors.NotFound('PaymentService');
|
|
98
110
|
}
|
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.347.0-alpha.
|
|
14
|
-
"@cinerino/sdk": "5.4.0",
|
|
13
|
+
"@chevre/factory": "4.347.0-alpha.12",
|
|
14
|
+
"@cinerino/sdk": "5.4.0-alpha.7",
|
|
15
15
|
"@motionpicture/coa-service": "9.2.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.2.0",
|
|
17
17
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "21.18.0-alpha.
|
|
118
|
+
"version": "21.18.0-alpha.41"
|
|
119
119
|
}
|