@chevre/domain 21.27.0-alpha.11 → 21.27.0-alpha.12
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.
|
@@ -50,7 +50,6 @@ async function main() {
|
|
|
50
50
|
project: { id: project.id },
|
|
51
51
|
agent: { id: CLIENT_ID },
|
|
52
52
|
object: {
|
|
53
|
-
typeOf: chevre.factory.action.authorize.paymentMethod.any.ResultType.Payment,
|
|
54
53
|
amount: AMOUNT,
|
|
55
54
|
paymentMethod: paymentMethodType,
|
|
56
55
|
issuedThrough: { id: paymentServiceId },
|
|
@@ -99,7 +98,6 @@ async function main() {
|
|
|
99
98
|
project: { id: project.id },
|
|
100
99
|
agent: { id: CLIENT_ID },
|
|
101
100
|
object: {
|
|
102
|
-
typeOf: chevre.factory.action.authorize.paymentMethod.any.ResultType.Payment,
|
|
103
101
|
amount: AMOUNT,
|
|
104
102
|
paymentMethodId: publishPaymentUrlResult.paymentMethodId,
|
|
105
103
|
paymentMethod: paymentMethodType,
|
|
@@ -84,11 +84,12 @@ declare function publishPaymentUrl(params: {
|
|
|
84
84
|
agent: {
|
|
85
85
|
id: string;
|
|
86
86
|
};
|
|
87
|
-
object:
|
|
87
|
+
object: Pick<IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod'>;
|
|
88
88
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
89
89
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
90
90
|
location: factory.action.trade.pay.ILocation;
|
|
91
91
|
}): IPublishPaymentUrlOperation<Pick<PayTransactionService.IPublishPaymentUrlResult, 'paymentMethodId' | 'paymentUrl'>>;
|
|
92
|
+
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail;
|
|
92
93
|
/**
|
|
93
94
|
* 決済承認
|
|
94
95
|
*/
|
|
@@ -99,7 +100,7 @@ declare function authorize(params: {
|
|
|
99
100
|
agent: {
|
|
100
101
|
id: string;
|
|
101
102
|
};
|
|
102
|
-
object:
|
|
103
|
+
object: IObjectWithoutDetail;
|
|
103
104
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
104
105
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
105
106
|
location?: factory.action.trade.pay.ILocation;
|
|
@@ -230,8 +230,9 @@ function publishPaymentUrl(params) {
|
|
|
230
230
|
});
|
|
231
231
|
let result;
|
|
232
232
|
// URL発行
|
|
233
|
+
const authorizeObject = Object.assign(Object.assign({}, params.object), { accountId: '', paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment });
|
|
233
234
|
const startParams = (0, factory_1.creatPayTransactionStartParams)({
|
|
234
|
-
object:
|
|
235
|
+
object: authorizeObject,
|
|
235
236
|
paymentServiceType,
|
|
236
237
|
transaction: transaction,
|
|
237
238
|
transactionNumber: transactionNumber,
|
|
@@ -318,7 +319,11 @@ function authorize(params) {
|
|
|
318
319
|
const publishTransactionNumberResult = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
319
320
|
transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
320
321
|
}
|
|
321
|
-
const
|
|
322
|
+
const { accountId } = yield fixAccountIdIfPossible({
|
|
323
|
+
object: params.object,
|
|
324
|
+
project: { id: transaction.project.id }
|
|
325
|
+
})({ action: repos.action });
|
|
326
|
+
const authorizeObject = Object.assign(Object.assign(Object.assign({}, params.object), { accountId, paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment }), (creditCard !== undefined) ? { creditCard } : undefined);
|
|
322
327
|
// 承認アクションを開始する
|
|
323
328
|
const actionAttributes = {
|
|
324
329
|
project: transaction.project,
|
|
@@ -346,10 +351,6 @@ function authorize(params) {
|
|
|
346
351
|
const action = yield repos.action.start(actionAttributes);
|
|
347
352
|
let payTransaction;
|
|
348
353
|
try {
|
|
349
|
-
const { accountId } = yield validateFromLocation({
|
|
350
|
-
object: authorizeObject,
|
|
351
|
-
project: { id: transaction.project.id }
|
|
352
|
-
})({ action: repos.action });
|
|
353
354
|
const startParams = (0, factory_1.creatPayTransactionStartParams)({
|
|
354
355
|
accountId,
|
|
355
356
|
object: authorizeObject,
|
|
@@ -393,6 +394,9 @@ function authorize(params) {
|
|
|
393
394
|
});
|
|
394
395
|
}
|
|
395
396
|
exports.authorize = authorize;
|
|
397
|
+
/**
|
|
398
|
+
* 注文取引に保管された決済情報を承認しようとしている決済の整合性をを検証する
|
|
399
|
+
*/
|
|
396
400
|
function validatePaymentMethodByTransaction(params) {
|
|
397
401
|
var _a, _b;
|
|
398
402
|
const paymentServiceIdByObject = params.object.issuedThrough.id;
|
|
@@ -414,11 +418,16 @@ function validatePaymentMethodByTransaction(params) {
|
|
|
414
418
|
throw new factory.errors.Argument('object.paymentMethod', 'paymentMethod must match the target of the paymentUrl');
|
|
415
419
|
}
|
|
416
420
|
}
|
|
417
|
-
|
|
421
|
+
/**
|
|
422
|
+
* 承認しようとしているobjectからaccountIdを決定する
|
|
423
|
+
*/
|
|
424
|
+
function fixAccountIdIfPossible(params) {
|
|
418
425
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
419
426
|
var _a, _b;
|
|
420
|
-
let accountId =
|
|
421
|
-
|
|
427
|
+
// let accountId = params.object?.accountId;
|
|
428
|
+
let accountId = '';
|
|
429
|
+
const fromLocation = (_a = params.object) === null || _a === void 0 ? void 0 : _a.fromLocation;
|
|
430
|
+
const movieTickets = (_b = params.object) === null || _b === void 0 ? void 0 : _b.movieTickets;
|
|
422
431
|
// トークン化されたペイメントカード情報でリクエストされた場合、実ペイメントカード情報へ変換する
|
|
423
432
|
if (typeof fromLocation === 'string') {
|
|
424
433
|
const paymentCardOwnershipInfo = yield (0, code_1.verifyToken)({
|
|
@@ -434,6 +443,10 @@ function validateFromLocation(params) {
|
|
|
434
443
|
}
|
|
435
444
|
accountId = paymentCardOwnershipInfo.typeOfGood.identifier;
|
|
436
445
|
}
|
|
446
|
+
// 購入番号管理番号をaccountIdにセット(2024-03-24~)
|
|
447
|
+
if (Array.isArray(movieTickets) && movieTickets.length > 0) {
|
|
448
|
+
accountId = movieTickets[0].identifier; // 決済カードidentifierは1つのみ許可の前提
|
|
449
|
+
}
|
|
437
450
|
return { accountId };
|
|
438
451
|
});
|
|
439
452
|
}
|
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.364.0-alpha.
|
|
14
|
-
"@cinerino/sdk": "5.
|
|
13
|
+
"@chevre/factory": "4.364.0-alpha.1",
|
|
14
|
+
"@cinerino/sdk": "5.15.0-alpha.0",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
17
17
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.27.0-alpha.
|
|
113
|
+
"version": "21.27.0-alpha.12"
|
|
114
114
|
}
|