@chevre/domain 21.20.0-alpha.7 → 21.20.0-alpha.9
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/transaction/processPlaceOrder.ts +73 -40
- package/lib/chevre/service/assetTransaction/pay.d.ts +0 -10
- package/lib/chevre/service/assetTransaction/pay.js +1 -1
- package/lib/chevre/service/order/confirmPayTransaction.js +1 -1
- package/lib/chevre/service/payment/any.d.ts +0 -6
- package/lib/chevre/service/payment/any.js +5 -1
- package/lib/chevre/service/payment/creditCard.d.ts +3 -1
- package/lib/chevre/service/payment/creditCard.js +52 -70
- package/lib/chevre/service/payment/faceToFace.d.ts +0 -4
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +1 -0
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket.d.ts +0 -6
- package/lib/chevre/service/payment/paymentCard.d.ts +0 -2
- package/lib/chevre/service/payment/paymentCard.js +6 -6
- package/lib/chevre/service/payment.js +1 -1
- package/lib/chevre/service/task/voidPayTransaction.js +2 -2
- package/package.json +1 -1
|
@@ -71,61 +71,94 @@ async function main() {
|
|
|
71
71
|
paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
|
|
72
72
|
paymentServiceProvider: await chevre.repository.PaymentServiceProvider.createInstance(mongoose.connection),
|
|
73
73
|
person: await chevre.repository.Person.createInstance({ userPoolId: '' }),
|
|
74
|
-
project: await chevre.repository.Project.createInstance(mongoose.connection),
|
|
75
74
|
transactionNumber: await chevre.repository.TransactionNumber.createInstance(client),
|
|
76
75
|
transaction: await chevre.repository.Transaction.createInstance(mongoose.connection)
|
|
77
76
|
});
|
|
78
77
|
console.log(publishPaymentUrlResult);
|
|
79
78
|
|
|
80
79
|
// wait callback...
|
|
80
|
+
// tslint:disable-next-line:max-func-body-length
|
|
81
81
|
await new Promise<void>((resolve, reject) => {
|
|
82
82
|
const rl = readline.createInterface({
|
|
83
83
|
input: process.stdin,
|
|
84
84
|
output: process.stdout
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
+
// tslint:disable-next-line:max-func-body-length
|
|
87
88
|
rl.question('callback received?:\n', async () => {
|
|
88
89
|
try {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
90
|
+
await new Promise<void>(async (resolve2, reject2) => {
|
|
91
|
+
const rl2 = readline.createInterface({
|
|
92
|
+
input: process.stdin,
|
|
93
|
+
output: process.stdout
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
rl2.question('VOID or AUTH?:\n', async (jobCd) => {
|
|
97
|
+
if (jobCd === 'AUTH') {
|
|
98
|
+
const authorizeResult = await (await chevre.service.payment.any.createService()).authorize({
|
|
99
|
+
project: { id: project.id },
|
|
100
|
+
agent: { id: CLIENT_ID },
|
|
101
|
+
object: {
|
|
102
|
+
typeOf: chevre.factory.action.authorize.paymentMethod.any.ResultType.Payment,
|
|
103
|
+
amount: AMOUNT,
|
|
104
|
+
paymentMethodId: publishPaymentUrlResult.paymentMethodId,
|
|
105
|
+
paymentMethod: paymentMethodType,
|
|
106
|
+
issuedThrough: { id: paymentServiceId },
|
|
107
|
+
method: '1',
|
|
108
|
+
creditCard
|
|
109
|
+
},
|
|
110
|
+
purpose: { id: transaction.id, typeOf: transaction.typeOf },
|
|
111
|
+
paymentServiceType: chevre.factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
112
|
+
location: {
|
|
113
|
+
typeOf: chevre.factory.creativeWorkType.WebApplication,
|
|
114
|
+
id: CLIENT_ID
|
|
115
|
+
},
|
|
116
|
+
options: {
|
|
117
|
+
useCancelPayTransactionOnFailed: false,
|
|
118
|
+
useCheckMovieTicketBeforePay: false,
|
|
119
|
+
useCheckByIdentifierIfNotYet: false,
|
|
120
|
+
useSearchTrade4accountId: false
|
|
121
|
+
}
|
|
122
|
+
})({
|
|
123
|
+
accountingReport: await chevre.repository.AccountingReport.createInstance(mongoose.connection),
|
|
124
|
+
action: await chevre.repository.Action.createInstance(mongoose.connection),
|
|
125
|
+
assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection),
|
|
126
|
+
event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
127
|
+
paymentAccepted: await chevre.repository.SellerPaymentAccepted.createInstance(mongoose.connection),
|
|
128
|
+
paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
|
|
129
|
+
paymentServiceProvider: await chevre.repository.PaymentServiceProvider.createInstance(mongoose.connection),
|
|
130
|
+
person: await chevre.repository.Person.createInstance({ userPoolId: '' }),
|
|
131
|
+
product: await chevre.repository.Product.createInstance(mongoose.connection),
|
|
132
|
+
task: await chevre.repository.Task.createInstance(mongoose.connection),
|
|
133
|
+
transactionNumber: await chevre.repository.TransactionNumber.createInstance(client),
|
|
134
|
+
transaction: await chevre.repository.Transaction.createInstance(mongoose.connection)
|
|
135
|
+
});
|
|
136
|
+
console.log('payment authorized.', authorizeResult.result);
|
|
137
|
+
} else if (jobCd === 'VOID') {
|
|
138
|
+
await (await chevre.service.payment.any.createService()).invalidatePaymentUrl({
|
|
139
|
+
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
140
|
+
purpose: { id: transaction.id, typeOf: transaction.typeOf }
|
|
141
|
+
})({
|
|
142
|
+
accountingReport: await chevre.repository.AccountingReport.createInstance(mongoose.connection),
|
|
143
|
+
action: await chevre.repository.Action.createInstance(mongoose.connection),
|
|
144
|
+
assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection),
|
|
145
|
+
paymentAccepted: await chevre.repository.SellerPaymentAccepted.createInstance(mongoose.connection),
|
|
146
|
+
paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
|
|
147
|
+
paymentServiceProvider: await chevre.repository.PaymentServiceProvider.createInstance(mongoose.connection),
|
|
148
|
+
task: await chevre.repository.Task.createInstance(mongoose.connection),
|
|
149
|
+
transaction: await chevre.repository.Transaction.createInstance(mongoose.connection)
|
|
150
|
+
});
|
|
151
|
+
console.log('payment voided.');
|
|
152
|
+
} else {
|
|
153
|
+
reject2(`jobCd ${jobCd} not implemented`);
|
|
154
|
+
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// rl.close();
|
|
159
|
+
resolve2();
|
|
160
|
+
});
|
|
127
161
|
});
|
|
128
|
-
console.log('payment authorized.', authorizeResult.result);
|
|
129
162
|
|
|
130
163
|
resolve();
|
|
131
164
|
} catch (error) {
|
|
@@ -13,7 +13,6 @@ import type { MongoRepository as PaymentServiceRepo } from '../../repo/paymentSe
|
|
|
13
13
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
14
14
|
import type { CognitoRepository as PersonRepo } from '../../repo/person';
|
|
15
15
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
16
|
-
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
17
16
|
import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
|
|
18
17
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
19
18
|
import * as CreditCardPayment from '../payment/creditCard';
|
|
@@ -27,17 +26,12 @@ export interface IStartOperationRepos {
|
|
|
27
26
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
28
27
|
person: PersonRepo;
|
|
29
28
|
product: ProductRepo;
|
|
30
|
-
project: ProjectRepo;
|
|
31
29
|
assetTransaction: AssetTransactionRepo;
|
|
32
30
|
task: TaskRepo;
|
|
33
31
|
}
|
|
34
32
|
export type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
|
|
35
33
|
export interface ICancelRepos {
|
|
36
|
-
action: ActionRepo;
|
|
37
|
-
accountingReport: AccountingReportRepo;
|
|
38
34
|
assetTransaction: AssetTransactionRepo;
|
|
39
|
-
project: ProjectRepo;
|
|
40
|
-
task: TaskRepo;
|
|
41
35
|
}
|
|
42
36
|
export type ICancelOperation<T> = (repos: ICancelRepos) => Promise<T>;
|
|
43
37
|
export interface IConfirmRepos {
|
|
@@ -47,7 +41,6 @@ export interface IConfirmRepos {
|
|
|
47
41
|
assetTransaction: AssetTransactionRepo;
|
|
48
42
|
event: EventRepo;
|
|
49
43
|
order: OrderRepo;
|
|
50
|
-
project: ProjectRepo;
|
|
51
44
|
task: TaskRepo;
|
|
52
45
|
}
|
|
53
46
|
export type IConfirmOperation<T> = (repos: IConfirmRepos) => Promise<T>;
|
|
@@ -61,14 +54,12 @@ export type ICheckOperation<T> = (repos: {
|
|
|
61
54
|
paymentAccepted: PaymentAcceptedRepo;
|
|
62
55
|
paymentService: PaymentServiceRepo;
|
|
63
56
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
64
|
-
project: ProjectRepo;
|
|
65
57
|
}) => Promise<T>;
|
|
66
58
|
export type IPublishPaymentUrlOperation<T> = (repos: {
|
|
67
59
|
paymentAccepted: PaymentAcceptedRepo;
|
|
68
60
|
paymentService: PaymentServiceRepo;
|
|
69
61
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
70
62
|
person: PersonRepo;
|
|
71
|
-
project: ProjectRepo;
|
|
72
63
|
}) => Promise<T>;
|
|
73
64
|
export type IInvalidatePaymentUrlOperation<T> = (repos: {
|
|
74
65
|
accountingReport: AccountingReportRepo;
|
|
@@ -76,7 +67,6 @@ export type IInvalidatePaymentUrlOperation<T> = (repos: {
|
|
|
76
67
|
paymentAccepted: PaymentAcceptedRepo;
|
|
77
68
|
paymentService: PaymentServiceRepo;
|
|
78
69
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
79
|
-
project: ProjectRepo;
|
|
80
70
|
task: TaskRepo;
|
|
81
71
|
assetTransaction: AssetTransactionRepo;
|
|
82
72
|
}) => Promise<T>;
|
|
@@ -79,7 +79,7 @@ function invalidatePaymentUrl(params) {
|
|
|
79
79
|
const paymentServiceType = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
80
80
|
switch (paymentServiceType) {
|
|
81
81
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
82
|
-
yield CreditCardPayment.refundCreditCard(params, false)(repos);
|
|
82
|
+
yield CreditCardPayment.refundCreditCard(params, { requirePayAction: false })(repos);
|
|
83
83
|
break;
|
|
84
84
|
default:
|
|
85
85
|
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
@@ -10,7 +10,6 @@ import type { MongoRepository as PaymentServiceRepo } from '../../repo/paymentSe
|
|
|
10
10
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
11
11
|
import type { CognitoRepository as PersonRepo } from '../../repo/person';
|
|
12
12
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
13
|
-
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
14
13
|
import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
|
|
15
14
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
16
15
|
import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
@@ -30,7 +29,6 @@ declare function voidPayTransaction(params: factory.task.IData<factory.taskName.
|
|
|
30
29
|
paymentAccepted: PaymentAcceptedRepo;
|
|
31
30
|
paymentService: PaymentServiceRepo;
|
|
32
31
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
33
|
-
project: ProjectRepo;
|
|
34
32
|
task: TaskRepo;
|
|
35
33
|
transaction: TransactionRepo;
|
|
36
34
|
}) => Promise<void>;
|
|
@@ -41,7 +39,6 @@ declare function invalidatePaymentUrl(params: factory.task.IData<factory.taskNam
|
|
|
41
39
|
paymentAccepted: PaymentAcceptedRepo;
|
|
42
40
|
paymentService: PaymentServiceRepo;
|
|
43
41
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
44
|
-
project: ProjectRepo;
|
|
45
42
|
task: TaskRepo;
|
|
46
43
|
transaction: TransactionRepo;
|
|
47
44
|
}) => Promise<void>;
|
|
@@ -53,7 +50,6 @@ declare function processVoidPayTransaction(params: factory.task.IData<factory.ta
|
|
|
53
50
|
action: ActionRepo;
|
|
54
51
|
accountingReport: AccountingReportRepo;
|
|
55
52
|
assetTransaction: AssetTransactionRepo;
|
|
56
|
-
project: ProjectRepo;
|
|
57
53
|
task: TaskRepo;
|
|
58
54
|
transaction: TransactionRepo;
|
|
59
55
|
}) => Promise<void>;
|
|
@@ -67,7 +63,6 @@ interface IAuthorizeRepos {
|
|
|
67
63
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
68
64
|
person: PersonRepo;
|
|
69
65
|
product: ProductRepo;
|
|
70
|
-
project: ProjectRepo;
|
|
71
66
|
task: TaskRepo;
|
|
72
67
|
transaction: TransactionRepo;
|
|
73
68
|
transactionNumber: TransactionNumberRepo;
|
|
@@ -79,7 +74,6 @@ interface IPublishPaymentUrlRepos {
|
|
|
79
74
|
paymentService: PaymentServiceRepo;
|
|
80
75
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
81
76
|
person: PersonRepo;
|
|
82
|
-
project: ProjectRepo;
|
|
83
77
|
transaction: TransactionRepo;
|
|
84
78
|
transactionNumber: TransactionNumberRepo;
|
|
85
79
|
}
|
|
@@ -79,7 +79,11 @@ function invalidatePaymentUrl(params) {
|
|
|
79
79
|
: String((_c = transaction.seller.name) === null || _c === void 0 ? void 0 : _c.ja),
|
|
80
80
|
id: transaction.seller.id
|
|
81
81
|
},
|
|
82
|
-
recipient: {
|
|
82
|
+
recipient: {
|
|
83
|
+
typeOf: transaction.agent.typeOf,
|
|
84
|
+
id: transaction.agent.id,
|
|
85
|
+
name: transaction.agent.name
|
|
86
|
+
},
|
|
83
87
|
object: [{
|
|
84
88
|
typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
85
89
|
id: (_e = (_d = transaction.object.paymentMethods) === null || _d === void 0 ? void 0 : _d.issuedThrough) === null || _e === void 0 ? void 0 : _e.id,
|
|
@@ -57,7 +57,9 @@ declare function payCreditCard(params: factory.task.pay.IData): (repos: {
|
|
|
57
57
|
/**
|
|
58
58
|
* クレジットカード返金
|
|
59
59
|
*/
|
|
60
|
-
declare function refundCreditCard(params: factory.task.refund.IData,
|
|
60
|
+
declare function refundCreditCard(params: factory.task.refund.IData, options: {
|
|
61
|
+
requirePayAction: boolean;
|
|
62
|
+
}): (repos: {
|
|
61
63
|
action: ActionRepo;
|
|
62
64
|
accountingReport: AccountingReportRepo;
|
|
63
65
|
paymentAccepted: PaymentAcceptedRepo;
|
|
@@ -295,31 +295,28 @@ function voidTransaction(params) {
|
|
|
295
295
|
// オーソリ取消
|
|
296
296
|
// 現時点では、ここで失敗したらオーソリ取消をあきらめる
|
|
297
297
|
// GMO混雑エラーはここでも発生する(取消処理でも混雑エラーが発生することは確認済)
|
|
298
|
-
try {
|
|
299
|
-
|
|
298
|
+
// try {
|
|
299
|
+
// } catch (error) {
|
|
300
|
+
// // no op
|
|
301
|
+
// }
|
|
302
|
+
const searchTradeResult = yield creditCardService.searchTrade({
|
|
303
|
+
shopId: shopId,
|
|
304
|
+
shopPass: shopPass,
|
|
305
|
+
orderId: paymentMethodId,
|
|
306
|
+
siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
|
|
307
|
+
sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
|
|
308
|
+
});
|
|
309
|
+
// 仮売上であれば取消
|
|
310
|
+
if (searchTradeResult.status === GMO.utils.util.JobCd.Auth) {
|
|
311
|
+
yield creditCardService.alterTran({
|
|
300
312
|
shopId: shopId,
|
|
301
313
|
shopPass: shopPass,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
314
|
+
accessId: searchTradeResult.accessId,
|
|
315
|
+
accessPass: searchTradeResult.accessPass,
|
|
316
|
+
jobCd: GMO.utils.util.JobCd.Void,
|
|
317
|
+
siteId: (_e = availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId,
|
|
318
|
+
sitePass: (_f = availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass
|
|
305
319
|
});
|
|
306
|
-
debug('searchTradeResult:', searchTradeResult);
|
|
307
|
-
// 仮売上であれば取消
|
|
308
|
-
if (searchTradeResult.status === GMO.utils.util.JobCd.Auth) {
|
|
309
|
-
const alterTranResult = yield creditCardService.alterTran({
|
|
310
|
-
shopId: shopId,
|
|
311
|
-
shopPass: shopPass,
|
|
312
|
-
accessId: searchTradeResult.accessId,
|
|
313
|
-
accessPass: searchTradeResult.accessPass,
|
|
314
|
-
jobCd: GMO.utils.util.JobCd.Void,
|
|
315
|
-
siteId: (_e = availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId,
|
|
316
|
-
sitePass: (_f = availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass
|
|
317
|
-
});
|
|
318
|
-
debug('alterTran processed', alterTranResult);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
catch (error) {
|
|
322
|
-
// no op
|
|
323
320
|
}
|
|
324
321
|
});
|
|
325
322
|
}
|
|
@@ -448,7 +445,7 @@ function processAlterTran(params) {
|
|
|
448
445
|
/**
|
|
449
446
|
* クレジットカード返金
|
|
450
447
|
*/
|
|
451
|
-
function refundCreditCard(params,
|
|
448
|
+
function refundCreditCard(params, options) {
|
|
452
449
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
453
450
|
var _a, _b, _c, _d, _e;
|
|
454
451
|
const paymentMethodType = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.paymentMethod.typeOf;
|
|
@@ -456,7 +453,7 @@ function refundCreditCard(params, requirePayAction) {
|
|
|
456
453
|
const paymentServiceId = (_c = params.object[0]) === null || _c === void 0 ? void 0 : _c.id;
|
|
457
454
|
// 本アクションに対応するPayActionを取り出す(Cinerino側で決済していた時期に関してはpayActionが存在しないので注意)
|
|
458
455
|
let payAction;
|
|
459
|
-
if (requirePayAction) {
|
|
456
|
+
if (options.requirePayAction) {
|
|
460
457
|
payAction = yield repos.action.findPayAction({ project: { id: params.project.id }, paymentMethodId });
|
|
461
458
|
if (payAction === undefined) {
|
|
462
459
|
throw new factory.errors.NotFound('PayAction');
|
|
@@ -505,7 +502,6 @@ function processChangeTransaction(params) {
|
|
|
505
502
|
const alterTranResult = [];
|
|
506
503
|
const creditCardService = new GMO.service.Credit({ endpoint: String(params.availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
|
|
507
504
|
// 取引状態参照
|
|
508
|
-
debug('searching trade...', params.paymentMethodId);
|
|
509
505
|
const searchTradeResult = yield creditCardService.searchTrade({
|
|
510
506
|
shopId: params.shopId,
|
|
511
507
|
shopPass: params.shopPass,
|
|
@@ -521,7 +517,7 @@ function processChangeTransaction(params) {
|
|
|
521
517
|
let alreadyRefunded = false;
|
|
522
518
|
// 決済時のGMO取引を確認できれば、既に返金済かどうかを判定
|
|
523
519
|
if (typeof (creditCardSalesBefore === null || creditCardSalesBefore === void 0 ? void 0 : creditCardSalesBefore.tranId) === 'string') {
|
|
524
|
-
//
|
|
520
|
+
// GMO取引状態に変更がなければ金額変更
|
|
525
521
|
if (searchTradeResult.tranId !== creditCardSalesBefore.tranId) {
|
|
526
522
|
alreadyRefunded = true;
|
|
527
523
|
}
|
|
@@ -537,50 +533,36 @@ function processChangeTransaction(params) {
|
|
|
537
533
|
});
|
|
538
534
|
}
|
|
539
535
|
else {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
// } else {
|
|
571
|
-
// }
|
|
572
|
-
// 手数料決済については、取消→即時売上の流れ
|
|
573
|
-
debug('alterTran processing...');
|
|
574
|
-
alterTranResult.push(yield creditCardService.alterTran({
|
|
575
|
-
shopId: params.shopId,
|
|
576
|
-
shopPass: params.shopPass,
|
|
577
|
-
accessId: searchTradeResult.accessId,
|
|
578
|
-
accessPass: searchTradeResult.accessPass,
|
|
579
|
-
jobCd: GMO.utils.util.JobCd.Void,
|
|
580
|
-
siteId: (_g = params.availableChannel.credentials) === null || _g === void 0 ? void 0 : _g.siteId,
|
|
581
|
-
sitePass: (_h = params.availableChannel.credentials) === null || _h === void 0 ? void 0 : _h.sitePass
|
|
582
|
-
}));
|
|
583
|
-
debug('alterTran processed.');
|
|
536
|
+
try {
|
|
537
|
+
// 手数料決済については、取消→即時売上の流れ
|
|
538
|
+
debug('alterTran processing... searchTradeResult:', searchTradeResult);
|
|
539
|
+
alterTranResult.push(yield creditCardService.alterTran({
|
|
540
|
+
shopId: params.shopId,
|
|
541
|
+
shopPass: params.shopPass,
|
|
542
|
+
accessId: searchTradeResult.accessId,
|
|
543
|
+
accessPass: searchTradeResult.accessPass,
|
|
544
|
+
jobCd: GMO.utils.util.JobCd.Void,
|
|
545
|
+
siteId: (_g = params.availableChannel.credentials) === null || _g === void 0 ? void 0 : _g.siteId,
|
|
546
|
+
sitePass: (_h = params.availableChannel.credentials) === null || _h === void 0 ? void 0 : _h.sitePass
|
|
547
|
+
}));
|
|
548
|
+
debug('alterTran processed.');
|
|
549
|
+
}
|
|
550
|
+
catch (error) {
|
|
551
|
+
let throwsError = true;
|
|
552
|
+
// 未決済(3D 登録済)->取消をトライするとE01050004エラーとなるが、この場合何もする必要はない(2024-01-09~)
|
|
553
|
+
if (error.name === 'GMOServiceBadRequestError') {
|
|
554
|
+
// 会員が存在しない場合このエラーになる
|
|
555
|
+
if (Array.isArray(error.errors) && error.errors.length === 1 && error.errors[0].info === 'E01050004') {
|
|
556
|
+
if (searchTradeResult.status === GMO.utils.util.Status.Authenticated) {
|
|
557
|
+
debug('status:', searchTradeResult.status, 'nothing to do');
|
|
558
|
+
throwsError = false;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
if (throwsError) {
|
|
563
|
+
throw error;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
584
566
|
}
|
|
585
567
|
return alterTranResult;
|
|
586
568
|
});
|
|
@@ -5,24 +5,20 @@ import * as factory from '../../factory';
|
|
|
5
5
|
import type { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
6
6
|
import type { MongoRepository as ActionRepo } from '../../repo/action';
|
|
7
7
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
8
|
-
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
9
8
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
10
9
|
declare function voidTransaction(__: factory.task.voidPayment.IData): (___: {
|
|
11
10
|
product: ProductRepo;
|
|
12
|
-
project: ProjectRepo;
|
|
13
11
|
}) => Promise<void>;
|
|
14
12
|
declare function payFaceToFace(params: factory.task.pay.IData): (repos: {
|
|
15
13
|
action: ActionRepo;
|
|
16
14
|
accountingReport: AccountingReportRepo;
|
|
17
15
|
product: ProductRepo;
|
|
18
|
-
project: ProjectRepo;
|
|
19
16
|
task: TaskRepo;
|
|
20
17
|
}) => Promise<import("@chevre/factory/lib/action/trade/pay").IAction>;
|
|
21
18
|
declare function refundFaceToFace(params: factory.task.refund.IData): (repos: {
|
|
22
19
|
action: ActionRepo;
|
|
23
20
|
accountingReport: AccountingReportRepo;
|
|
24
21
|
product: ProductRepo;
|
|
25
|
-
project: ProjectRepo;
|
|
26
22
|
task: TaskRepo;
|
|
27
23
|
}) => Promise<import("@chevre/factory/lib/action/trade/refund").IAction>;
|
|
28
24
|
export { payFaceToFace, refundFaceToFace, voidTransaction };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { IMinimizedIndividualEvent } from '../../../repo/event';
|
|
2
2
|
import type { MongoRepository as PaymentServiceRepo } from '../../../repo/paymentService';
|
|
3
3
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
4
|
-
import type { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
5
4
|
import * as factory from '../../../factory';
|
|
6
5
|
interface ICheckResult {
|
|
7
6
|
purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
|
|
@@ -19,6 +18,5 @@ interface ICheckByIdentifierParams {
|
|
|
19
18
|
declare function checkByIdentifier(params: ICheckByIdentifierParams): (repos: {
|
|
20
19
|
paymentService: PaymentServiceRepo;
|
|
21
20
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
22
|
-
project: ProjectRepo;
|
|
23
21
|
}) => Promise<ICheckResult>;
|
|
24
22
|
export { ICheckByIdentifierParams, ICheckResult, checkByIdentifier };
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.checkByIdentifier = void 0;
|
|
13
13
|
const surfrock = require("@surfrock/sdk");
|
|
14
14
|
const moment = require("moment-timezone");
|
|
15
|
+
// import type { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
15
16
|
const credentials_1 = require("../../../credentials");
|
|
16
17
|
const factory = require("../../../factory");
|
|
17
18
|
const getCredentials_1 = require("./getCredentials");
|
|
@@ -3,7 +3,6 @@ import type { MongoRepository as ActionRepo } from '../../../repo/action';
|
|
|
3
3
|
import type { MongoRepository as EventRepo } from '../../../repo/event';
|
|
4
4
|
import type { MongoRepository as PaymentServiceRepo } from '../../../repo/paymentService';
|
|
5
5
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
6
|
-
import type { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
7
6
|
import type { MongoRepository as PaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
|
|
8
7
|
export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean, useCheckByIdentifierIfNotYet: boolean): (repos: {
|
|
9
8
|
action: ActionRepo;
|
|
@@ -11,7 +10,6 @@ export declare function validateMovieTicket(params: factory.assetTransaction.pay
|
|
|
11
10
|
paymentAccepted: PaymentAcceptedRepo;
|
|
12
11
|
paymentService: PaymentServiceRepo;
|
|
13
12
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
14
|
-
project: ProjectRepo;
|
|
15
13
|
}) => Promise<{
|
|
16
14
|
accountsReceivablesByServiceType: factory.assetTransaction.pay.IAccountsReceivableByServiceType[];
|
|
17
15
|
}>;
|
|
@@ -3,7 +3,6 @@ import type { MongoRepository as ActionRepo } from '../../repo/action';
|
|
|
3
3
|
import type { MongoRepository as EventRepo } from '../../repo/event';
|
|
4
4
|
import type { MongoRepository as PaymentServiceRepo } from '../../repo/paymentService';
|
|
5
5
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
6
|
-
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
7
6
|
import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
|
|
8
7
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
9
8
|
import * as factory from '../../factory';
|
|
@@ -14,7 +13,6 @@ interface ICheckOperationRepos {
|
|
|
14
13
|
paymentAccepted: PaymentAcceptedRepo;
|
|
15
14
|
paymentService: PaymentServiceRepo;
|
|
16
15
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
17
|
-
project: ProjectRepo;
|
|
18
16
|
}
|
|
19
17
|
type ICheckOperation<T> = (repos: ICheckOperationRepos) => Promise<T>;
|
|
20
18
|
interface IPayOperationRepos {
|
|
@@ -24,7 +22,6 @@ interface IPayOperationRepos {
|
|
|
24
22
|
paymentAccepted: PaymentAcceptedRepo;
|
|
25
23
|
paymentService: PaymentServiceRepo;
|
|
26
24
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
27
|
-
project: ProjectRepo;
|
|
28
25
|
task: TaskRepo;
|
|
29
26
|
}
|
|
30
27
|
type IPayOperation<T> = (repos: IPayOperationRepos) => Promise<T>;
|
|
@@ -32,7 +29,6 @@ interface IRefundOperationRepos {
|
|
|
32
29
|
action: ActionRepo;
|
|
33
30
|
accountingReport: AccountingReportRepo;
|
|
34
31
|
paymentService: PaymentServiceRepo;
|
|
35
|
-
project: ProjectRepo;
|
|
36
32
|
task: TaskRepo;
|
|
37
33
|
}
|
|
38
34
|
type IRefundOperation<T> = (repos: IRefundOperationRepos) => Promise<T>;
|
|
@@ -58,14 +54,12 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
|
|
|
58
54
|
paymentAccepted: PaymentAcceptedRepo;
|
|
59
55
|
paymentService: PaymentServiceRepo;
|
|
60
56
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
61
|
-
project: ProjectRepo;
|
|
62
57
|
task: TaskRepo;
|
|
63
58
|
}) => Promise<IAuthorizeResult>;
|
|
64
59
|
declare function voidTransaction(params: factory.task.voidPayment.IData): (repos: {
|
|
65
60
|
action: ActionRepo;
|
|
66
61
|
accountingReport: AccountingReportRepo;
|
|
67
62
|
paymentService: PaymentServiceRepo;
|
|
68
|
-
project: ProjectRepo;
|
|
69
63
|
task: TaskRepo;
|
|
70
64
|
}) => Promise<void>;
|
|
71
65
|
type IPayAction = factory.action.trade.pay.IAction;
|
|
@@ -3,13 +3,11 @@ import type { MongoRepository as AccountingReportRepo } from '../../repo/account
|
|
|
3
3
|
import type { MongoRepository as ActionRepo } from '../../repo/action';
|
|
4
4
|
import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
5
5
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
6
|
-
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
7
6
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
8
7
|
import type { RedisRepository as TransactionNumberRepo } from '../../repo/transactionNumber';
|
|
9
8
|
type IPendingTransaction = Pick<factory.account.transaction.withdraw.ITransaction, 'id' | 'transactionNumber' | 'typeOf'>;
|
|
10
9
|
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string): (repos: {
|
|
11
10
|
product: ProductRepo;
|
|
12
|
-
project: ProjectRepo;
|
|
13
11
|
}) => Promise<{
|
|
14
12
|
pendingTransaction: IPendingTransaction;
|
|
15
13
|
currency: string;
|
|
@@ -22,12 +22,12 @@ const onRefund_1 = require("./any/onRefund");
|
|
|
22
22
|
const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
|
|
23
23
|
function authorize(params, paymentServiceId) {
|
|
24
24
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
// const project = <Pick<factory.project.IProject, 'id' | 'typeOf'>>await repos.project.findById({
|
|
26
|
+
// id: params.project.id,
|
|
27
|
+
// inclusion: ['_id', 'typeOf'],
|
|
28
|
+
// exclusion: []
|
|
29
|
+
// });
|
|
25
30
|
var _a;
|
|
26
|
-
const project = yield repos.project.findById({
|
|
27
|
-
id: params.project.id,
|
|
28
|
-
inclusion: ['_id', 'typeOf'],
|
|
29
|
-
exclusion: []
|
|
30
|
-
});
|
|
31
31
|
const transactionNumber = params.transactionNumber;
|
|
32
32
|
if (typeof transactionNumber !== 'string') {
|
|
33
33
|
throw new factory.errors.ArgumentNull('transactionNumber');
|
|
@@ -46,7 +46,7 @@ function authorize(params, paymentServiceId) {
|
|
|
46
46
|
.toDate();
|
|
47
47
|
pendingTransaction = yield processAccountTransaction({
|
|
48
48
|
transactionNumber,
|
|
49
|
-
project: project,
|
|
49
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
50
50
|
paymentMethod: params.object.paymentMethod,
|
|
51
51
|
agent: params.agent,
|
|
52
52
|
recipient: params.recipient,
|
|
@@ -78,7 +78,7 @@ function refund(params) {
|
|
|
78
78
|
yield PaymentCardPaymentService.refundPaymentCard(params)(repos);
|
|
79
79
|
break;
|
|
80
80
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
81
|
-
yield CreditCardPaymentService.refundCreditCard(params, true)(repos);
|
|
81
|
+
yield CreditCardPaymentService.refundCreditCard(params, { requirePayAction: true })(repos);
|
|
82
82
|
break;
|
|
83
83
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
84
84
|
yield MovieTicketPaymentService.refundMovieTicket(params)(repos);
|
|
@@ -15,7 +15,7 @@ const action_1 = require("../../repo/action");
|
|
|
15
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
16
|
const paymentService_1 = require("../../repo/paymentService");
|
|
17
17
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
18
|
-
|
|
18
|
+
// import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
19
19
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
20
20
|
const task_1 = require("../../repo/task");
|
|
21
21
|
const transaction_1 = require("../../repo/transaction");
|
|
@@ -32,7 +32,7 @@ function call(data) {
|
|
|
32
32
|
paymentAccepted: new sellerPaymentAccepted_1.MongoRepository(settings.connection),
|
|
33
33
|
paymentService: new paymentService_1.MongoRepository(settings.connection),
|
|
34
34
|
paymentServiceProvider: new paymentServiceProvider_1.MongoRepository(settings.connection),
|
|
35
|
-
project: new
|
|
35
|
+
// project: new ProjectRepo(settings.connection),
|
|
36
36
|
task: new task_1.MongoRepository(settings.connection),
|
|
37
37
|
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
38
38
|
});
|
package/package.json
CHANGED