@chevre/domain 21.8.0-alpha.17 → 21.8.0-alpha.18
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/migrateOrderPaymentMethodIdentifier.ts +7 -2
- package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +75 -0
- package/example/src/chevre/processPay.ts +3 -4
- package/lib/chevre/repo/assetTransaction.d.ts +8 -0
- package/lib/chevre/repo/assetTransaction.js +51 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/factory.js +5 -3
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.js +37 -8
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +61 -0
- package/lib/chevre/service/order/onOrderStatusChanged.js +5 -0
- package/lib/chevre/service/payment/any/factory.js +16 -6
- package/lib/chevre/service/payment/creditCard.js +12 -12
- package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
- package/lib/chevre/service/payment/movieTicket.js +10 -11
- package/lib/chevre/service/payment/paymentCard.js +9 -12
- package/package.json +2 -2
|
@@ -19,8 +19,12 @@ async function main() {
|
|
|
19
19
|
orderDate: {
|
|
20
20
|
$gte: moment()
|
|
21
21
|
// tslint:disable-next-line:no-magic-numbers
|
|
22
|
-
.add(-
|
|
22
|
+
.add(-12, 'months')
|
|
23
23
|
.toDate()
|
|
24
|
+
// $lte: moment()
|
|
25
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
26
|
+
// .add(-6, 'months')
|
|
27
|
+
// .toDate()
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
{
|
|
@@ -43,7 +47,8 @@ async function main() {
|
|
|
43
47
|
|
|
44
48
|
const noPayment = order.paymentMethods.length === 0;
|
|
45
49
|
const alreadyMigrated = order.paymentMethods.every((invoice) => {
|
|
46
|
-
return typeof invoice.paymentMethod?.identifier === 'string'
|
|
50
|
+
return typeof invoice.paymentMethod?.identifier === 'string'
|
|
51
|
+
&& invoice.paymentMethod.identifier === invoice.typeOf;
|
|
47
52
|
});
|
|
48
53
|
|
|
49
54
|
if (noPayment) {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
// tslint:disable-next-line:max-func-body-length
|
|
10
|
+
async function main() {
|
|
11
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
|
+
|
|
13
|
+
const assetTransactionRepo = new chevre.repository.AssetTransaction(mongoose.connection);
|
|
14
|
+
|
|
15
|
+
const cursor = assetTransactionRepo.getCursor(
|
|
16
|
+
{
|
|
17
|
+
typeOf: { $eq: chevre.factory.assetTransactionType.Pay },
|
|
18
|
+
// 'object.paymentMethodId': { $exists: false },
|
|
19
|
+
// 'project.id': { $eq: project.id },
|
|
20
|
+
startDate: {
|
|
21
|
+
$gte: moment()
|
|
22
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
23
|
+
.add(-12, 'months')
|
|
24
|
+
.toDate()
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
typeOf: 1,
|
|
29
|
+
project: 1,
|
|
30
|
+
object: 1,
|
|
31
|
+
transactionNumber: 1,
|
|
32
|
+
startDate: 1
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
console.log('transactions found');
|
|
36
|
+
|
|
37
|
+
let i = 0;
|
|
38
|
+
let updateCount = 0;
|
|
39
|
+
await cursor.eachAsync(async (doc) => {
|
|
40
|
+
i += 1;
|
|
41
|
+
const payTransaction: Pick<
|
|
42
|
+
chevre.factory.assetTransaction.pay.ITransaction,
|
|
43
|
+
'project' | 'object' | 'transactionNumber' | 'startDate' | 'typeOf'
|
|
44
|
+
> = doc.toObject();
|
|
45
|
+
|
|
46
|
+
const alreadyMigrated = typeof payTransaction.object.paymentMethodId === 'string'
|
|
47
|
+
&& payTransaction.object.paymentMethodId === (<any>payTransaction.object.paymentMethod).paymentMethodId;
|
|
48
|
+
|
|
49
|
+
if (alreadyMigrated) {
|
|
50
|
+
console.log(
|
|
51
|
+
'already exist.',
|
|
52
|
+
payTransaction.project.id, payTransaction.typeOf, payTransaction.transactionNumber, payTransaction.startDate, i);
|
|
53
|
+
} else {
|
|
54
|
+
const paymentMethodIdentifier = (<any>payTransaction.object.paymentMethod).typeOf;
|
|
55
|
+
console.log(
|
|
56
|
+
'updating...',
|
|
57
|
+
payTransaction.project.id, payTransaction.typeOf, payTransaction.transactionNumber, payTransaction.startDate, i,
|
|
58
|
+
paymentMethodIdentifier);
|
|
59
|
+
updateCount += 1;
|
|
60
|
+
console.log(
|
|
61
|
+
'updated.',
|
|
62
|
+
payTransaction.project.id, payTransaction.typeOf, payTransaction.transactionNumber, payTransaction.startDate, i);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
console.log(i, 'transactions checked');
|
|
67
|
+
console.log(updateCount, 'transactions updated');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
main()
|
|
71
|
+
.then()
|
|
72
|
+
.catch(console.error);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
// tslint:disable-next-line:max-func-body-length
|
|
10
|
+
async function main() {
|
|
11
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
|
+
|
|
13
|
+
const assetTransactionRepo = new chevre.repository.AssetTransaction(mongoose.connection);
|
|
14
|
+
|
|
15
|
+
const cursor = assetTransactionRepo.getCursor(
|
|
16
|
+
{
|
|
17
|
+
typeOf: { $eq: chevre.factory.assetTransactionType.Pay },
|
|
18
|
+
// 'project.id': { $eq: project.id },
|
|
19
|
+
startDate: {
|
|
20
|
+
$gte: moment()
|
|
21
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
22
|
+
.add(-24, 'months')
|
|
23
|
+
.toDate()
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
typeOf: 1,
|
|
28
|
+
project: 1,
|
|
29
|
+
object: 1,
|
|
30
|
+
transactionNumber: 1,
|
|
31
|
+
startDate: 1
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
console.log('transactions found');
|
|
35
|
+
|
|
36
|
+
let i = 0;
|
|
37
|
+
let updateCount = 0;
|
|
38
|
+
await cursor.eachAsync(async (doc) => {
|
|
39
|
+
i += 1;
|
|
40
|
+
const payTransaction: Pick<
|
|
41
|
+
chevre.factory.assetTransaction.pay.ITransaction,
|
|
42
|
+
'project' | 'object' | 'transactionNumber' | 'startDate' | 'typeOf'
|
|
43
|
+
> = doc.toObject();
|
|
44
|
+
|
|
45
|
+
const alreadyMigrated = payTransaction.object.paymentMethod.identifier
|
|
46
|
+
=== (<any>payTransaction.object.paymentMethod).typeOf;
|
|
47
|
+
|
|
48
|
+
if (alreadyMigrated) {
|
|
49
|
+
console.log(
|
|
50
|
+
'already exist.',
|
|
51
|
+
payTransaction.project.id, payTransaction.typeOf, payTransaction.transactionNumber, payTransaction.startDate, i);
|
|
52
|
+
} else {
|
|
53
|
+
const paymentMethodIdentifier = (<any>payTransaction.object.paymentMethod).typeOf;
|
|
54
|
+
console.log(
|
|
55
|
+
'updating...',
|
|
56
|
+
payTransaction.project.id, payTransaction.typeOf, payTransaction.transactionNumber, payTransaction.startDate, i,
|
|
57
|
+
paymentMethodIdentifier);
|
|
58
|
+
await assetTransactionRepo.migratePaymentMethodIdentifier({
|
|
59
|
+
transactionNumber: payTransaction.transactionNumber,
|
|
60
|
+
object: { paymentMethod: { identifier: paymentMethodIdentifier } }
|
|
61
|
+
});
|
|
62
|
+
updateCount += 1;
|
|
63
|
+
console.log(
|
|
64
|
+
'updated.',
|
|
65
|
+
payTransaction.project.id, payTransaction.typeOf, payTransaction.transactionNumber, payTransaction.startDate, i);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
console.log(i, 'transactions checked');
|
|
70
|
+
console.log(updateCount, 'transactions updated');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
main()
|
|
74
|
+
.then()
|
|
75
|
+
.catch(console.error);
|
|
@@ -43,14 +43,13 @@ async function main() {
|
|
|
43
43
|
.toDate(),
|
|
44
44
|
object: {
|
|
45
45
|
typeOf: chevre.factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
46
|
-
id: '
|
|
46
|
+
id: 'xxx',
|
|
47
47
|
paymentMethod: {
|
|
48
48
|
amount: 1,
|
|
49
|
-
|
|
50
|
-
typeOf: 'CreditCard',
|
|
49
|
+
identifier: 'CreditCard',
|
|
51
50
|
method: '1',
|
|
52
51
|
creditCard: {
|
|
53
|
-
memberId: '
|
|
52
|
+
memberId: 'xxx',
|
|
54
53
|
cardSeq: 91
|
|
55
54
|
// cardPass?: string;
|
|
56
55
|
}
|
|
@@ -189,6 +189,14 @@ export declare class MongoRepository {
|
|
|
189
189
|
id: string;
|
|
190
190
|
update: any;
|
|
191
191
|
}): Promise<factory.assetTransaction.ITransaction<T>>;
|
|
192
|
+
migratePaymentMethodIdentifier(params: {
|
|
193
|
+
transactionNumber: string;
|
|
194
|
+
object: {
|
|
195
|
+
paymentMethod: {
|
|
196
|
+
identifier: string;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
}): Promise<any>;
|
|
192
200
|
findByIdAndDelete(params: {
|
|
193
201
|
id: string;
|
|
194
202
|
}): Promise<void>;
|
|
@@ -353,7 +353,7 @@ class MongoRepository {
|
|
|
353
353
|
}, Object.assign(Object.assign({ status: factory.transactionStatusType.Confirmed, endDate: new Date(), result: params.result, potentialActions: params.potentialActions }, (typeof ((_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.underName) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
354
354
|
? { 'object.underName': params.object.underName }
|
|
355
355
|
: undefined), (typeof ((_d = (_c = params.object) === null || _c === void 0 ? void 0 : _c.paymentMethod) === null || _d === void 0 ? void 0 : _d.identifier) === 'string')
|
|
356
|
-
? { 'object.paymentMethod.identifier
|
|
356
|
+
? { 'object.paymentMethod.identifier': params.object.paymentMethod.identifier }
|
|
357
357
|
: undefined), {
|
|
358
358
|
new: true,
|
|
359
359
|
projection: { _id: 1 }
|
|
@@ -706,6 +706,55 @@ class MongoRepository {
|
|
|
706
706
|
});
|
|
707
707
|
});
|
|
708
708
|
}
|
|
709
|
+
migratePaymentMethodIdentifier(params) {
|
|
710
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
711
|
+
return this.transactionModel.findOneAndUpdate({
|
|
712
|
+
typeOf: { $eq: factory.assetTransactionType.Pay },
|
|
713
|
+
transactionNumber: { $exists: true, $eq: params.transactionNumber }
|
|
714
|
+
}, { 'object.paymentMethod.identifier': params.object.paymentMethod.identifier }, {
|
|
715
|
+
new: true,
|
|
716
|
+
projection: { _id: 1 }
|
|
717
|
+
})
|
|
718
|
+
.exec()
|
|
719
|
+
.then((doc) => {
|
|
720
|
+
if (doc === null) {
|
|
721
|
+
throw new factory.errors.ArgumentNull(this.transactionModel.modelName);
|
|
722
|
+
}
|
|
723
|
+
return doc.toObject();
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
// public async migratePaymentMethodIdentifierMany() {
|
|
728
|
+
// // return this.transactionModel.updateMany(
|
|
729
|
+
// // {
|
|
730
|
+
// // typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
731
|
+
// // // 'object.paymentMethod.identifier': { $exists: false }
|
|
732
|
+
// // },
|
|
733
|
+
// // { $set: { 'object.paymentMethod.identifier': '$object.paymentMethod.typeOf' } }
|
|
734
|
+
// // )
|
|
735
|
+
// // .exec();
|
|
736
|
+
// return this.transactionModel.aggregate([
|
|
737
|
+
// {
|
|
738
|
+
// $match: {
|
|
739
|
+
// typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
740
|
+
// }
|
|
741
|
+
// },
|
|
742
|
+
// {
|
|
743
|
+
// $project: {
|
|
744
|
+
// paymentMethodIdentifier: '$object.paymentMethod.typeOf'
|
|
745
|
+
// }
|
|
746
|
+
// },
|
|
747
|
+
// {
|
|
748
|
+
// $unset: ['object.paymentMethod.identifier']
|
|
749
|
+
// }
|
|
750
|
+
// // {
|
|
751
|
+
// // $set: {
|
|
752
|
+
// // 'object.paymentMethod.identifier': '$paymentMethodIdentifier'
|
|
753
|
+
// // }
|
|
754
|
+
// // }
|
|
755
|
+
// ])
|
|
756
|
+
// .exec();
|
|
757
|
+
// }
|
|
709
758
|
findByIdAndDelete(params) {
|
|
710
759
|
return __awaiter(this, void 0, void 0, function* () {
|
|
711
760
|
yield this.transactionModel.findByIdAndDelete(params.id)
|
|
@@ -715,6 +764,7 @@ class MongoRepository {
|
|
|
715
764
|
getCursor(conditions, projection) {
|
|
716
765
|
return this.transactionModel.find(conditions, projection)
|
|
717
766
|
.sort({ startDate: factory.sortType.Ascending })
|
|
767
|
+
// .sort({ startDate: factory.sortType.Descending })
|
|
718
768
|
.cursor();
|
|
719
769
|
}
|
|
720
770
|
aggregateAssetTransaction(params) {
|
|
@@ -15,9 +15,9 @@ function validateAccount(params) {
|
|
|
15
15
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
var _a, _b, _c, _d;
|
|
17
17
|
// 引き出し口座の存在を確認する
|
|
18
|
-
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
18
|
+
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
19
19
|
if (typeof paymentMethodType !== 'string') {
|
|
20
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
20
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
21
21
|
}
|
|
22
22
|
const accountNumber = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.accountId;
|
|
23
23
|
if (typeof accountNumber !== 'string') {
|
|
@@ -15,9 +15,9 @@ function createStartParams(params) {
|
|
|
15
15
|
const paymentMethodType = (params.paymentService !== undefined)
|
|
16
16
|
// FaceToFace以外は、プロダクトから決済方法タイプを自動取得
|
|
17
17
|
? (_a = params.paymentService.serviceType) === null || _a === void 0 ? void 0 : _a.codeValue
|
|
18
|
-
: (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.
|
|
18
|
+
: (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
19
19
|
if (typeof paymentMethodType !== 'string') {
|
|
20
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
20
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
21
21
|
}
|
|
22
22
|
let totalPaymentDue;
|
|
23
23
|
switch (params.paymentServiceType) {
|
|
@@ -85,7 +85,9 @@ function createStartParams(params) {
|
|
|
85
85
|
? params.object.paymentMethod.name
|
|
86
86
|
: paymentMethodType,
|
|
87
87
|
// MonetaryAmount対応(2023-08-14~)
|
|
88
|
-
amount: (settings_1.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT) ? paymentMethodAmount : params.amount,
|
|
88
|
+
amount: (settings_1.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT) ? paymentMethodAmount : params.amount,
|
|
89
|
+
// paymentMethodId: params.transactionNumber, // object.paymentMethodIdへ完全移行(2023-08-30~)
|
|
90
|
+
identifier: paymentMethodType }, (typeof ((_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.description) === 'string')
|
|
89
91
|
? { description: (_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.description }
|
|
90
92
|
: undefined), (totalPaymentDue !== undefined)
|
|
91
93
|
? { totalPaymentDue: totalPaymentDue }
|
|
@@ -33,9 +33,9 @@ function createPayObject(params) {
|
|
|
33
33
|
var _a;
|
|
34
34
|
const transaction = params.transaction;
|
|
35
35
|
const paymentMethod = transaction.object.paymentMethod;
|
|
36
|
-
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.
|
|
36
|
+
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.identifier);
|
|
37
37
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
38
|
-
const paymentMethodId =
|
|
38
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
39
39
|
const paymentMethodName = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name : paymentMethodType;
|
|
40
40
|
// MonetaryAmount対応(2023-08-13~)
|
|
41
41
|
const paymentMethodAmountValue = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.amount) === 'number')
|
|
@@ -139,7 +139,7 @@ function createPayObjectServiceOutput(params) {
|
|
|
139
139
|
// }
|
|
140
140
|
break;
|
|
141
141
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
142
|
-
const paymentMethodType = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.
|
|
142
|
+
const paymentMethodType = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.identifier;
|
|
143
143
|
const movieTickets = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets;
|
|
144
144
|
if (Array.isArray(movieTickets)) {
|
|
145
145
|
paymentServiceOutput = movieTickets.map((movieTicket) => {
|
|
@@ -219,9 +219,9 @@ function validateSeller(params) {
|
|
|
219
219
|
if (seller === undefined) {
|
|
220
220
|
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
221
221
|
}
|
|
222
|
-
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.
|
|
222
|
+
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
223
223
|
if (typeof paymentMethodType !== 'string') {
|
|
224
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
224
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
225
225
|
}
|
|
226
226
|
// FaceToFaceの場合、決済方法区分未指定に対応(2023-08-29~)
|
|
227
227
|
if (params.object.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
@@ -229,7 +229,7 @@ function validateSeller(params) {
|
|
|
229
229
|
// 販売者の対応決済方法かどうか確認
|
|
230
230
|
const paymentAccepted = (_c = seller.paymentAccepted) === null || _c === void 0 ? void 0 : _c.some((a) => a.paymentMethodType === paymentMethodType);
|
|
231
231
|
if (paymentAccepted !== true) {
|
|
232
|
-
throw new factory.errors.Argument('object.paymentMethod.
|
|
232
|
+
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted`);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
}
|
|
@@ -237,7 +237,7 @@ function validateSeller(params) {
|
|
|
237
237
|
// 販売者の対応決済方法かどうか確認
|
|
238
238
|
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
239
239
|
if (paymentAccepted !== true) {
|
|
240
|
-
throw new factory.errors.Argument('object.paymentMethod.
|
|
240
|
+
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted`);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
});
|
|
@@ -337,7 +337,7 @@ function confirm(params) {
|
|
|
337
337
|
if (typeof specifiedPaymentMethodIdentifire === 'string' && specifiedPaymentMethodIdentifire.length > 0) {
|
|
338
338
|
overwritingPaymentMethodIdentifier = specifiedPaymentMethodIdentifire;
|
|
339
339
|
transaction.object.paymentMethod.identifier = overwritingPaymentMethodIdentifier;
|
|
340
|
-
transaction.object.paymentMethod.typeOf = overwritingPaymentMethodIdentifier;
|
|
340
|
+
// transaction.object.paymentMethod.typeOf = overwritingPaymentMethodIdentifier;
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
const order = yield fixOrderAsPurpose(params, transaction)(repos);
|
|
@@ -424,6 +424,9 @@ function exportTasksById(params) {
|
|
|
424
424
|
id: params.id
|
|
425
425
|
});
|
|
426
426
|
const potentialActions = transaction.potentialActions;
|
|
427
|
+
if (transaction.status === factory.transactionStatusType.InProgress) {
|
|
428
|
+
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
429
|
+
}
|
|
427
430
|
const taskAttributes = [];
|
|
428
431
|
// タスク実行日時バッファの指定があれば調整
|
|
429
432
|
let taskRunsAt = new Date();
|
|
@@ -450,6 +453,31 @@ function exportTasksById(params) {
|
|
|
450
453
|
executionResults: [],
|
|
451
454
|
data: { object: payTransactionAsObject }
|
|
452
455
|
};
|
|
456
|
+
// OnAssetTransactionStatusChangedを追加(2023-08-30~)
|
|
457
|
+
const onAssetTransactionStatusChangedTaskData = {
|
|
458
|
+
project: transaction.project,
|
|
459
|
+
object: {
|
|
460
|
+
typeOf: factory.assetTransactionType.Pay,
|
|
461
|
+
transactionNumber: transaction.transactionNumber,
|
|
462
|
+
status: transaction.status
|
|
463
|
+
},
|
|
464
|
+
purpose: {
|
|
465
|
+
confirmationNumber: '',
|
|
466
|
+
orderNumber: '',
|
|
467
|
+
typeOf: 'Order'
|
|
468
|
+
},
|
|
469
|
+
useOnOrderStatusChanged: true
|
|
470
|
+
};
|
|
471
|
+
const onAssetTransactionStatusChangedTask = {
|
|
472
|
+
project: transaction.project,
|
|
473
|
+
name: factory.taskName.OnAssetTransactionStatusChanged,
|
|
474
|
+
status: factory.taskStatus.Ready,
|
|
475
|
+
runsAt: taskRunsAt,
|
|
476
|
+
remainingNumberOfTries: 10,
|
|
477
|
+
numberOfTried: 0,
|
|
478
|
+
executionResults: [],
|
|
479
|
+
data: onAssetTransactionStatusChangedTaskData
|
|
480
|
+
};
|
|
453
481
|
switch (transaction.status) {
|
|
454
482
|
case factory.transactionStatusType.Confirmed:
|
|
455
483
|
const payActions = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.pay;
|
|
@@ -474,9 +502,10 @@ function exportTasksById(params) {
|
|
|
474
502
|
if (!settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
475
503
|
taskAttributes.push(voidPaymentTasks);
|
|
476
504
|
}
|
|
505
|
+
taskAttributes.push(onAssetTransactionStatusChangedTask);
|
|
477
506
|
break;
|
|
478
507
|
case factory.transactionStatusType.Expired:
|
|
479
|
-
taskAttributes.push(voidPaymentTasks);
|
|
508
|
+
taskAttributes.push(voidPaymentTasks, onAssetTransactionStatusChangedTask);
|
|
480
509
|
break;
|
|
481
510
|
default:
|
|
482
511
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
@@ -502,9 +531,9 @@ function searchGMOTrade(params) {
|
|
|
502
531
|
// throw new factory.errors.Argument('transactionNumber', 'must be confirmed');
|
|
503
532
|
// }
|
|
504
533
|
// CreditCard系統の決済方法タイプは動的
|
|
505
|
-
const paymentMethodType = (_a = assetTransaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
534
|
+
const paymentMethodType = (_a = assetTransaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
506
535
|
if (typeof paymentMethodType !== 'string') {
|
|
507
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
536
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
508
537
|
}
|
|
509
538
|
const paymentServiceId = String(assetTransaction.object.id);
|
|
510
539
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
@@ -52,6 +52,21 @@ function onAssetTransactionStatusChanged(params) {
|
|
|
52
52
|
// no op
|
|
53
53
|
}
|
|
54
54
|
break;
|
|
55
|
+
case factory.transactionStatusType.Canceled:
|
|
56
|
+
case factory.transactionStatusType.Expired:
|
|
57
|
+
switch (params.object.typeOf) {
|
|
58
|
+
case factory.assetTransactionType.Pay:
|
|
59
|
+
// 注文が存在すればキャンセル(2023-08-30~)
|
|
60
|
+
yield cancelOrderIfExist({
|
|
61
|
+
project: { id: params.project.id },
|
|
62
|
+
paymentMethodId: params.object.transactionNumber,
|
|
63
|
+
useOnOrderStatusChanged: params.useOnOrderStatusChanged
|
|
64
|
+
})(repos);
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
// no op
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
55
70
|
default:
|
|
56
71
|
// no op
|
|
57
72
|
}
|
|
@@ -163,3 +178,49 @@ function paymentDue2Processing(params) {
|
|
|
163
178
|
});
|
|
164
179
|
}
|
|
165
180
|
exports.paymentDue2Processing = paymentDue2Processing;
|
|
181
|
+
function cancelOrderIfExist(params) {
|
|
182
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
if (params.paymentMethodId.length === 0) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
// 注文のpaymentMethodIdを取得
|
|
187
|
+
const ordersByPaymentMethodId = yield repos.order.search({
|
|
188
|
+
limit: 1,
|
|
189
|
+
page: 1,
|
|
190
|
+
paymentMethods: {
|
|
191
|
+
paymentMethodIds: [params.paymentMethodId]
|
|
192
|
+
},
|
|
193
|
+
project: { id: { $eq: params.project.id } }
|
|
194
|
+
}, { confirmationNumber: 1, orderNumber: 1 });
|
|
195
|
+
const orderByPaymentMethodId = ordersByPaymentMethodId.shift();
|
|
196
|
+
if (orderByPaymentMethodId !== undefined) {
|
|
197
|
+
const placeOrderTransaction = yield (0, findPlaceOrderTransaction_1.findPlaceOrderTransaction)({
|
|
198
|
+
project: { id: params.project.id },
|
|
199
|
+
confirmationNumber: orderByPaymentMethodId.confirmationNumber,
|
|
200
|
+
orderNumber: orderByPaymentMethodId.orderNumber
|
|
201
|
+
})({ transaction: repos.transaction });
|
|
202
|
+
let order;
|
|
203
|
+
try {
|
|
204
|
+
order = yield repos.order.changeStatus({
|
|
205
|
+
project: { id: params.project.id },
|
|
206
|
+
orderNumber: orderByPaymentMethodId.orderNumber,
|
|
207
|
+
orderStatus: factory.orderStatus.OrderCancelled,
|
|
208
|
+
previousOrderStatus: factory.orderStatus.OrderPaymentDue
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
if (params.useOnOrderStatusChanged) {
|
|
215
|
+
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({
|
|
216
|
+
order: Object.assign(Object.assign({}, order), { orderStatus: factory.orderStatus.OrderCancelled // 強制的にOrderCancelledとして処理する
|
|
217
|
+
}),
|
|
218
|
+
placeOrderTransaction
|
|
219
|
+
})({
|
|
220
|
+
registerActionInProgress: repos.registerActionInProgress,
|
|
221
|
+
task: repos.task
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
@@ -116,6 +116,11 @@ function onOrderStatusChanged(params) {
|
|
|
116
116
|
...(0, factory_1.createOnOrderReturnedTasksByTransaction)({ potentialActions: potentialActionsByTransaction })
|
|
117
117
|
];
|
|
118
118
|
break;
|
|
119
|
+
// OrderCancelled追加(2023-08-30~)
|
|
120
|
+
case factory.orderStatus.OrderCancelled:
|
|
121
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
122
|
+
// TODO 注文取引中止時と同様の処理か
|
|
123
|
+
break;
|
|
119
124
|
default:
|
|
120
125
|
}
|
|
121
126
|
yield repos.task.saveMany(tasks, { emitImmediately: true });
|
|
@@ -5,9 +5,17 @@ const moment = require("moment");
|
|
|
5
5
|
const factory = require("../../../factory");
|
|
6
6
|
function creatPayTransactionStartParams(params) {
|
|
7
7
|
var _a, _b, _c, _d;
|
|
8
|
-
|
|
8
|
+
let expires = moment(params.transaction.expires)
|
|
9
9
|
.add(1, 'month')
|
|
10
10
|
.toDate(); // 余裕を持って
|
|
11
|
+
// 実験的にPaymentDueに対応(2023-08-30~)
|
|
12
|
+
if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
13
|
+
if (params.object.paymentMethod.length === 0) {
|
|
14
|
+
expires = moment(params.transaction.expires)
|
|
15
|
+
.add(1, 'hour')
|
|
16
|
+
.toDate();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
11
19
|
const confirmationNumber = params.transaction.object.confirmationNumber;
|
|
12
20
|
const issuedThroughId = (_a = params.object.issuedThrough) === null || _a === void 0 ? void 0 : _a.id;
|
|
13
21
|
const accountId = (typeof params.accountId === 'string')
|
|
@@ -39,7 +47,9 @@ function creatPayTransactionStartParams(params) {
|
|
|
39
47
|
typeOf: params.paymentServiceType,
|
|
40
48
|
// 決済サービスIDを連携(2022-04-12~)
|
|
41
49
|
id: issuedThroughId,
|
|
42
|
-
paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ identifier: params.object.paymentMethod,
|
|
50
|
+
paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ identifier: params.object.paymentMethod,
|
|
51
|
+
// typeOf: params.object.paymentMethod, // identifierへ移行(2023-08-30~)
|
|
52
|
+
amount: params.object.amount, additionalProperty: (Array.isArray(params.object.additionalProperty)) ? params.object.additionalProperty : [] }, (typeof params.object.method === 'string') ? { method: params.object.method } : undefined), (typeof params.object.name === 'string') ? { name: params.object.name } : undefined), (typeof accountId === 'string') ? { accountId } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined), (typeof params.object.fromLocation === 'string') ? { fromLocation: params.object.fromLocation } : undefined), (params.object.creditCard !== undefined) ? { creditCard: params.object.creditCard } : undefined), (Array.isArray(movieTickets)) ? { movieTickets } : undefined)
|
|
43
53
|
}, expires: expires }, (typeof confirmationNumber === 'string')
|
|
44
54
|
? {
|
|
45
55
|
purpose: {
|
|
@@ -80,7 +90,7 @@ function createMovieTicket(params) {
|
|
|
80
90
|
};
|
|
81
91
|
}
|
|
82
92
|
function createAuthorizeResult(params) {
|
|
83
|
-
var _a, _b, _c, _d, _e, _f
|
|
93
|
+
var _a, _b, _c, _d, _e, _f;
|
|
84
94
|
const payTransactionObject = params.payTransaction.object;
|
|
85
95
|
const totalPaymentDue = (_a = payTransactionObject.paymentMethod) === null || _a === void 0 ? void 0 : _a.totalPaymentDue;
|
|
86
96
|
if (typeof (totalPaymentDue === null || totalPaymentDue === void 0 ? void 0 : totalPaymentDue.typeOf) !== 'string') {
|
|
@@ -116,10 +126,10 @@ function createAuthorizeResult(params) {
|
|
|
116
126
|
// paymentMethod: params.object.paymentMethod,
|
|
117
127
|
paymentMethodAsObject,
|
|
118
128
|
paymentStatus,
|
|
119
|
-
paymentMethodId: (typeof
|
|
120
|
-
? payTransactionObject.
|
|
129
|
+
paymentMethodId: (typeof payTransactionObject.paymentMethodId === 'string')
|
|
130
|
+
? payTransactionObject.paymentMethodId
|
|
121
131
|
: '',
|
|
122
|
-
name: (typeof ((
|
|
132
|
+
name: (typeof ((_f = payTransactionObject.paymentMethod) === null || _f === void 0 ? void 0 : _f.name) === 'string')
|
|
123
133
|
? payTransactionObject.paymentMethod.name
|
|
124
134
|
: params.object.paymentMethod,
|
|
125
135
|
totalPaymentDue: totalPaymentDue,
|
|
@@ -34,9 +34,9 @@ function authorize(params, paymentServiceId, searchTrade4accountId) {
|
|
|
34
34
|
exclusion: []
|
|
35
35
|
});
|
|
36
36
|
// CreditCard系統の決済方法タイプは動的
|
|
37
|
-
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
37
|
+
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
38
38
|
if (typeof paymentMethodType !== 'string') {
|
|
39
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
39
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
40
40
|
}
|
|
41
41
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
42
42
|
project: params.project,
|
|
@@ -205,16 +205,16 @@ function handleAuthorizeError(error) {
|
|
|
205
205
|
*/
|
|
206
206
|
function voidTransaction(params) {
|
|
207
207
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
var _a, _b, _c, _d, _e, _f
|
|
208
|
+
var _a, _b, _c, _d, _e, _f;
|
|
209
209
|
const transaction = params.object;
|
|
210
210
|
// CreditCard系統の決済方法タイプは動的
|
|
211
|
-
const paymentMethodType = (_a = transaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
211
|
+
const paymentMethodType = (_a = transaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
212
212
|
if (typeof paymentMethodType !== 'string') {
|
|
213
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
213
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
214
214
|
}
|
|
215
|
-
const paymentMethodId =
|
|
215
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
216
216
|
if (typeof paymentMethodId !== 'string') {
|
|
217
|
-
throw new factory.errors.ArgumentNull('object.
|
|
217
|
+
throw new factory.errors.ArgumentNull('object.paymentMethodId');
|
|
218
218
|
}
|
|
219
219
|
const paymentServiceId = String(transaction.object.id);
|
|
220
220
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
@@ -222,7 +222,7 @@ function voidTransaction(params) {
|
|
|
222
222
|
typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
223
223
|
id: paymentServiceId
|
|
224
224
|
});
|
|
225
|
-
const sellerId = (
|
|
225
|
+
const sellerId = (_b = transaction.recipient) === null || _b === void 0 ? void 0 : _b.id;
|
|
226
226
|
if (typeof sellerId !== 'string') {
|
|
227
227
|
throw new factory.errors.ArgumentNull('object.recipient.id');
|
|
228
228
|
}
|
|
@@ -236,8 +236,8 @@ function voidTransaction(params) {
|
|
|
236
236
|
shopId: shopId,
|
|
237
237
|
shopPass: shopPass,
|
|
238
238
|
orderId: paymentMethodId,
|
|
239
|
-
siteId: (
|
|
240
|
-
sitePass: (
|
|
239
|
+
siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
|
|
240
|
+
sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
|
|
241
241
|
});
|
|
242
242
|
debug('searchTradeResult:', searchTradeResult);
|
|
243
243
|
// 仮売上であれば取消
|
|
@@ -248,8 +248,8 @@ function voidTransaction(params) {
|
|
|
248
248
|
accessId: searchTradeResult.accessId,
|
|
249
249
|
accessPass: searchTradeResult.accessPass,
|
|
250
250
|
jobCd: GMO.utils.util.JobCd.Void,
|
|
251
|
-
siteId: (
|
|
252
|
-
sitePass: (
|
|
251
|
+
siteId: (_e = availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId,
|
|
252
|
+
sitePass: (_f = availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass
|
|
253
253
|
});
|
|
254
254
|
debug('alterTran processed', alterTranResult);
|
|
255
255
|
}
|
|
@@ -39,9 +39,9 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
39
39
|
throw new factory.errors.Argument('movieTickets', 'Number of movie ticket accessCodes must be 1');
|
|
40
40
|
}
|
|
41
41
|
// ムビチケ系統の決済方法タイプは動的
|
|
42
|
-
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.
|
|
42
|
+
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
43
43
|
if (typeof paymentMethodType !== 'string') {
|
|
44
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
44
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
45
45
|
}
|
|
46
46
|
// イベント取得属性最適化(2023-01-23~)
|
|
47
47
|
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
@@ -122,11 +122,9 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
|
|
|
122
122
|
const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet)(repos);
|
|
123
123
|
accountsReceivablesByServiceType = validateMovieTicketResult.accountsReceivablesByServiceType;
|
|
124
124
|
const paymentMethod = transaction.object.paymentMethod;
|
|
125
|
-
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.
|
|
125
|
+
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.identifier);
|
|
126
126
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
127
|
-
const paymentMethodId =
|
|
128
|
-
? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.paymentMethodId
|
|
129
|
-
: transaction.id;
|
|
127
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
130
128
|
const paymentMethodName = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name : paymentMethodType;
|
|
131
129
|
accountId = (Array.isArray(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets)) ? (_a = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets[0]) === null || _a === void 0 ? void 0 : _a.identifier : undefined;
|
|
132
130
|
if (typeof accountId !== 'string' || accountId.length === 0) {
|
|
@@ -157,15 +155,16 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
|
|
|
157
155
|
exports.authorize = authorize;
|
|
158
156
|
function voidTransaction(params) {
|
|
159
157
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
var _a, _b, _c
|
|
158
|
+
var _a, _b, _c;
|
|
161
159
|
const transaction = params.object;
|
|
162
|
-
const paymentMethodType = (_a = transaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
160
|
+
const paymentMethodType = (_a = transaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
163
161
|
if (typeof paymentMethodType !== 'string') {
|
|
164
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
162
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
165
163
|
}
|
|
166
|
-
const paymentMethodId =
|
|
164
|
+
// const paymentMethodId = transaction.object.paymentMethod?.paymentMethodId;
|
|
165
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
167
166
|
if (typeof paymentMethodId !== 'string') {
|
|
168
|
-
throw new factory.errors.ArgumentNull('object.
|
|
167
|
+
throw new factory.errors.ArgumentNull('object.paymentMethodId');
|
|
169
168
|
}
|
|
170
169
|
// 決済開始時に着券していれば、取消
|
|
171
170
|
// 例えばtimeoutが原因でCompletedActionStatusでない場合、外部サービス側では着券済の可能性もあるので、そこを考慮する
|
|
@@ -192,14 +191,14 @@ function voidTransaction(params) {
|
|
|
192
191
|
paymentMethod: {
|
|
193
192
|
paymentMethodId: paymentMethodId,
|
|
194
193
|
typeOf: paymentMethodType,
|
|
195
|
-
name: (typeof ((
|
|
194
|
+
name: (typeof ((_b = transaction.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.name) === 'string')
|
|
196
195
|
? transaction.object.paymentMethod.name
|
|
197
196
|
: paymentMethodType,
|
|
198
197
|
additionalProperty: []
|
|
199
198
|
}
|
|
200
199
|
}], agent: {
|
|
201
200
|
id: seller.id,
|
|
202
|
-
name: (typeof seller.name === 'string') ? seller.name : String((
|
|
201
|
+
name: (typeof seller.name === 'string') ? seller.name : String((_c = seller.name) === null || _c === void 0 ? void 0 : _c.ja),
|
|
203
202
|
typeOf: seller.typeOf
|
|
204
203
|
}, recipient: transaction.recipient }, ((payAction === null || payAction === void 0 ? void 0 : payAction.purpose) !== undefined)
|
|
205
204
|
? { purpose: payAction.purpose }
|
|
@@ -68,7 +68,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
68
68
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
69
69
|
const serviceOutputIdentifier = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.accountId;
|
|
70
70
|
const amount = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.amount;
|
|
71
|
-
const paymentMethodType = (_c = params.object.paymentMethod) === null || _c === void 0 ? void 0 : _c.
|
|
71
|
+
const paymentMethodType = (_c = params.object.paymentMethod) === null || _c === void 0 ? void 0 : _c.identifier;
|
|
72
72
|
if (typeof serviceOutputIdentifier !== 'string') {
|
|
73
73
|
throw new factory.errors.ArgumentNull('object.paymentMethod.accountId');
|
|
74
74
|
}
|
|
@@ -76,7 +76,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
76
76
|
throw new factory.errors.ArgumentNull('object.paymentMethod.amount');
|
|
77
77
|
}
|
|
78
78
|
if (typeof paymentMethodType !== 'string') {
|
|
79
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
79
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
80
80
|
}
|
|
81
81
|
// プロダクトから通貨区分を取得
|
|
82
82
|
const paymentCatdProduct = yield repos.product.findById({ id: paymentServiceId }, ['serviceOutput'], []);
|
|
@@ -182,15 +182,12 @@ function processAccountTransaction(params) {
|
|
|
182
182
|
}
|
|
183
183
|
function voidTransaction(params) {
|
|
184
184
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
var _a, _b, _c
|
|
185
|
+
var _a, _b, _c;
|
|
186
186
|
const transaction = params.object;
|
|
187
|
-
// const
|
|
188
|
-
const paymentMethodId =
|
|
189
|
-
// if (typeof paymentMethodType !== 'string') {
|
|
190
|
-
// throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
191
|
-
// }
|
|
187
|
+
// const paymentMethodId = transaction.object.paymentMethod?.paymentMethodId;
|
|
188
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
192
189
|
if (typeof paymentMethodId !== 'string') {
|
|
193
|
-
throw new factory.errors.ArgumentNull('object.
|
|
190
|
+
throw new factory.errors.ArgumentNull('object.paymentMethodId');
|
|
194
191
|
}
|
|
195
192
|
const paymentServiceId = String(transaction.object.id);
|
|
196
193
|
// アクションステータスに関係なく取消処理実行
|
|
@@ -204,9 +201,9 @@ function voidTransaction(params) {
|
|
|
204
201
|
const accountTransactionService = new pecorinoapi.service.AccountTransaction({
|
|
205
202
|
endpoint: String(availableChannel.serviceUrl),
|
|
206
203
|
auth: new pecorinoapi.auth.ClientCredentials({
|
|
207
|
-
domain: String((
|
|
208
|
-
clientId: String((
|
|
209
|
-
clientSecret: String((
|
|
204
|
+
domain: String((_a = availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.authorizeServerDomain),
|
|
205
|
+
clientId: String((_b = availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.clientId),
|
|
206
|
+
clientSecret: String((_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.clientSecret),
|
|
210
207
|
scopes: [],
|
|
211
208
|
state: ''
|
|
212
209
|
})
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.327.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.327.0-alpha.8",
|
|
13
13
|
"@cinerino/sdk": "3.165.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.8.0-alpha.
|
|
120
|
+
"version": "21.8.0-alpha.18"
|
|
121
121
|
}
|