@chevre/domain 22.6.0-alpha.30 → 22.6.0-alpha.32
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/credentials.js +9 -5
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/assetTransaction/pay.d.ts +3 -0
- package/lib/chevre/service/payment/any/onRefund.js +30 -17
- package/lib/chevre/service/payment/any.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +9 -12
- package/lib/chevre/service/payment/movieTicket/factory.js +12 -16
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +2 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +2 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -1
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/payment.d.ts +13 -4
- package/lib/chevre/service/payment.js +15 -11
- package/lib/chevre/service/task/authorizePayment.js +9 -0
- package/lib/chevre/service/task/checkMovieTicket.js +12 -3
- package/lib/chevre/service/task/pay.js +27 -2
- package/lib/chevre/service/task/refund.js +10 -0
- package/lib/chevre/service/task/voidPayment.js +14 -1
- package/lib/chevre/settings.d.ts +21 -28
- package/package.json +3 -3
|
@@ -20,15 +20,19 @@ class CredentialsRepo {
|
|
|
20
20
|
}
|
|
21
21
|
save(credentials) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
|
|
23
|
+
if (typeof this.options.expireInSeconds !== 'number' || this.options.expireInSeconds <= 0) {
|
|
24
|
+
// expireInSeconds:0に設定すれば保管しない
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// const { access_token, expired_at } = credentials;
|
|
24
28
|
if (typeof credentials.access_token !== 'string') {
|
|
25
29
|
throw new Error('access_token must be string');
|
|
26
30
|
}
|
|
27
|
-
if (typeof credentials.expired_at !== 'string') {
|
|
28
|
-
|
|
29
|
-
}
|
|
31
|
+
// if (typeof credentials.expired_at !== 'string') {
|
|
32
|
+
// throw new Error('expired_at must be string');
|
|
33
|
+
// }
|
|
30
34
|
const key = this.createKey();
|
|
31
|
-
const value = JSON.stringify(
|
|
35
|
+
const value = JSON.stringify(credentials);
|
|
32
36
|
const multi = this.redisClient.multi();
|
|
33
37
|
yield multi.set(key, value)
|
|
34
38
|
// .expireAt(key, Number(expired_at))
|
|
@@ -16,6 +16,7 @@ import type { AuthorizationRepo } from './repo/authorization';
|
|
|
16
16
|
import type { CategoryCodeRepo } from './repo/categoryCode';
|
|
17
17
|
import type { CommentRepo } from './repo/comment';
|
|
18
18
|
import type { CreativeWorkRepo } from './repo/creativeWork';
|
|
19
|
+
import type { CredentialsRepo } from './repo/credentials';
|
|
19
20
|
import type { CustomerRepo } from './repo/customer';
|
|
20
21
|
import type { CustomerTypeRepo } from './repo/customerType';
|
|
21
22
|
import type { EmailMessageRepo } from './repo/emailMessage';
|
|
@@ -134,6 +135,10 @@ export type CreativeWork = CreativeWorkRepo;
|
|
|
134
135
|
export declare namespace CreativeWork {
|
|
135
136
|
function createInstance(...params: ConstructorParameters<typeof CreativeWorkRepo>): Promise<CreativeWorkRepo>;
|
|
136
137
|
}
|
|
138
|
+
export type Credentials = CredentialsRepo;
|
|
139
|
+
export declare namespace Credentials {
|
|
140
|
+
function createInstance(...params: ConstructorParameters<typeof CredentialsRepo>): Promise<CredentialsRepo>;
|
|
141
|
+
}
|
|
137
142
|
export type Customer = CustomerRepo;
|
|
138
143
|
export declare namespace Customer {
|
|
139
144
|
function createInstance(...params: ConstructorParameters<typeof CustomerRepo>): Promise<CustomerRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerPaymentAccepted = exports.Seller = exports.Schedule = void 0;
|
|
12
|
+
exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.Member = exports.Interface = exports.EventSeries = exports.EventSellerMakesOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
|
|
13
|
+
exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerPaymentAccepted = exports.Seller = exports.Schedule = exports.Role = void 0;
|
|
14
14
|
var AcceptedOffer;
|
|
15
15
|
(function (AcceptedOffer) {
|
|
16
16
|
let repo;
|
|
@@ -219,6 +219,19 @@ var CreativeWork;
|
|
|
219
219
|
}
|
|
220
220
|
CreativeWork.createInstance = createInstance;
|
|
221
221
|
})(CreativeWork = exports.CreativeWork || (exports.CreativeWork = {}));
|
|
222
|
+
var Credentials;
|
|
223
|
+
(function (Credentials) {
|
|
224
|
+
let repo;
|
|
225
|
+
function createInstance(...params) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
if (repo === undefined) {
|
|
228
|
+
repo = (yield Promise.resolve().then(() => require('./repo/credentials'))).CredentialsRepo;
|
|
229
|
+
}
|
|
230
|
+
return new repo(...params);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
Credentials.createInstance = createInstance;
|
|
234
|
+
})(Credentials = exports.Credentials || (exports.Credentials = {}));
|
|
222
235
|
var Customer;
|
|
223
236
|
(function (Customer) {
|
|
224
237
|
let repo;
|
|
@@ -8,6 +8,7 @@ import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
|
8
8
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
9
9
|
import type { ActionRepo } from '../../repo/action';
|
|
10
10
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
11
|
+
import type { CredentialsRepo } from '../../repo/credentials';
|
|
11
12
|
import type { EventRepo } from '../../repo/event';
|
|
12
13
|
import type { OrderRepo } from '../../repo/order';
|
|
13
14
|
import type { PaymentServiceRepo } from '../../repo/paymentService';
|
|
@@ -20,6 +21,7 @@ import * as MovieTicketPayment from '../payment/movieTicket';
|
|
|
20
21
|
export interface IStartOperationRepos {
|
|
21
22
|
accountingReport: AccountingReportRepo;
|
|
22
23
|
action: ActionRepo;
|
|
24
|
+
credentials: CredentialsRepo;
|
|
23
25
|
event: EventRepo;
|
|
24
26
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
25
27
|
paymentService: PaymentServiceRepo;
|
|
@@ -49,6 +51,7 @@ export type IExportTasksOperation<T> = (repos: {
|
|
|
49
51
|
}) => Promise<T>;
|
|
50
52
|
export type ICheckOperation<T> = (repos: {
|
|
51
53
|
action: ActionRepo;
|
|
54
|
+
credentials: CredentialsRepo;
|
|
52
55
|
event: EventRepo;
|
|
53
56
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
54
57
|
paymentService: PaymentServiceRepo;
|
|
@@ -22,7 +22,6 @@ const onPaymentStatusChanged_1 = require("./onPaymentStatusChanged");
|
|
|
22
22
|
function onRefund(refundAction) {
|
|
23
23
|
// tslint:disable-next-line:max-func-body-length
|
|
24
24
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
var _a, _b;
|
|
26
25
|
const aciton4inform = (0, factory_1.optimizeAction4inform)(refundAction);
|
|
27
26
|
const potentialActions = refundAction.potentialActions;
|
|
28
27
|
const now = new Date();
|
|
@@ -37,38 +36,52 @@ function onRefund(refundAction) {
|
|
|
37
36
|
const informPayment = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.informPayment;
|
|
38
37
|
// 手数料決済があれば処理
|
|
39
38
|
// CreditCardIFのみ(2023-06-29~)
|
|
40
|
-
const
|
|
39
|
+
const firstObject = refundAction.object[0];
|
|
40
|
+
const paymentServiceType = firstObject === null || firstObject === void 0 ? void 0 : firstObject.typeOf;
|
|
41
41
|
if (paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
42
|
-
const refundFee =
|
|
42
|
+
const refundFee = firstObject === null || firstObject === void 0 ? void 0 : firstObject.refundFee;
|
|
43
43
|
if (typeof refundFee === 'number' && refundFee > 0) {
|
|
44
44
|
// purpose.typeOf:PlaceOrderは外部決済URL無効化における返金アクションのみなので、手数料決済から除外してよい(2024-03-19~)
|
|
45
45
|
// purpose.typeOf:Orderは決済カード承認時着券の取消なので、手数料決済から除外してよい
|
|
46
46
|
// 手数料決済は注文返品による返金アクションからしか発生しないはず(2024-06-13~)
|
|
47
47
|
if (refundAction.purpose.typeOf === factory.actionType.ReturnAction) {
|
|
48
|
-
const payReturnFeeObject =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
id: o.id,
|
|
48
|
+
const payReturnFeeObject = [{
|
|
49
|
+
typeOf: firstObject.typeOf,
|
|
50
|
+
id: firstObject.id,
|
|
52
51
|
paymentMethod: {
|
|
53
|
-
accountId:
|
|
54
|
-
additionalProperty:
|
|
55
|
-
name:
|
|
56
|
-
paymentMethodId:
|
|
52
|
+
accountId: firstObject.paymentMethod.accountId,
|
|
53
|
+
additionalProperty: firstObject.paymentMethod.additionalProperty,
|
|
54
|
+
name: firstObject.paymentMethod.name,
|
|
55
|
+
paymentMethodId: firstObject.paymentMethod.paymentMethodId,
|
|
57
56
|
totalPaymentDue: {
|
|
58
57
|
typeOf: 'MonetaryAmount',
|
|
59
58
|
currency: factory.priceCurrency.JPY,
|
|
60
59
|
value: refundFee
|
|
61
60
|
},
|
|
62
|
-
typeOf:
|
|
61
|
+
typeOf: firstObject.paymentMethod.typeOf
|
|
63
62
|
}
|
|
64
|
-
};
|
|
65
|
-
|
|
63
|
+
}];
|
|
64
|
+
// const payReturnFeeObject: factory.action.trade.pay.IObject = refundAction.object.map((o) => {
|
|
65
|
+
// return {
|
|
66
|
+
// typeOf: o.typeOf,
|
|
67
|
+
// id: o.id,
|
|
68
|
+
// paymentMethod: {
|
|
69
|
+
// accountId: o.paymentMethod.accountId,
|
|
70
|
+
// additionalProperty: o.paymentMethod.additionalProperty,
|
|
71
|
+
// name: o.paymentMethod.name,
|
|
72
|
+
// paymentMethodId: o.paymentMethod.paymentMethodId,
|
|
73
|
+
// totalPaymentDue: {
|
|
74
|
+
// typeOf: 'MonetaryAmount',
|
|
75
|
+
// currency: factory.priceCurrency.JPY,
|
|
76
|
+
// value: refundFee
|
|
77
|
+
// },
|
|
78
|
+
// typeOf: o.paymentMethod.typeOf
|
|
79
|
+
// }
|
|
80
|
+
// };
|
|
81
|
+
// });
|
|
66
82
|
const payReturnFeeAction = {
|
|
67
|
-
// project: refundAction.project,
|
|
68
83
|
typeOf: factory.actionType.PayAction,
|
|
69
84
|
object: payReturnFeeObject,
|
|
70
|
-
// agent: refundAction.project,
|
|
71
|
-
// recipient: refundAction.agent, // 返金者は販売者のはず
|
|
72
85
|
purpose: refundAction.purpose,
|
|
73
86
|
potentialActions: {
|
|
74
87
|
add2report: true,
|
|
@@ -9,6 +9,7 @@ import type { ActionRepo, IMinimizedPurchaseNumberAuthResult } from '../../repo/
|
|
|
9
9
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
10
10
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
11
11
|
import type { ConfirmationNumberRepo } from '../../repo/confirmationNumber';
|
|
12
|
+
import type { CredentialsRepo } from '../../repo/credentials';
|
|
12
13
|
import type { EventRepo } from '../../repo/event';
|
|
13
14
|
import type { PaymentServiceRepo } from '../../repo/paymentService';
|
|
14
15
|
import type { PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
@@ -78,6 +79,7 @@ interface IAuthorizeRepos {
|
|
|
78
79
|
assetTransaction: AssetTransactionRepo;
|
|
79
80
|
authorization: AuthorizationRepo;
|
|
80
81
|
confirmationNumber: ConfirmationNumberRepo;
|
|
82
|
+
credentials: CredentialsRepo;
|
|
81
83
|
event: EventRepo;
|
|
82
84
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
83
85
|
paymentService: PaymentServiceRepo;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
2
|
import type { ActionRepo } from '../../../repo/action';
|
|
3
|
+
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
3
4
|
import type { EventRepo } from '../../../repo/event';
|
|
4
5
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
5
6
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
@@ -35,6 +36,7 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
|
|
|
35
36
|
}): (repos: {
|
|
36
37
|
action: ActionRepo;
|
|
37
38
|
accountingReport: AccountingReportRepo;
|
|
39
|
+
credentials: CredentialsRepo;
|
|
38
40
|
event: EventRepo;
|
|
39
41
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
40
42
|
paymentService: PaymentServiceRepo;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ActionRepo } from '../../../repo/action';
|
|
2
|
+
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
2
3
|
import type { EventRepo } from '../../../repo/event';
|
|
3
4
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
4
5
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
@@ -8,6 +9,7 @@ import { Settings } from '../../../settings';
|
|
|
8
9
|
import { ICheckResult } from './processPurchaseNumberAuth';
|
|
9
10
|
interface ICheckOperationRepos {
|
|
10
11
|
action: ActionRepo;
|
|
12
|
+
credentials: CredentialsRepo;
|
|
11
13
|
event: EventRepo;
|
|
12
14
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
13
15
|
paymentService: PaymentServiceRepo;
|
|
@@ -31,12 +31,15 @@ function checkMovieTicket(params) {
|
|
|
31
31
|
serviceOutput: { reservationFor: serviceOutput.reservationFor } // 最適化(2024-03-15~)
|
|
32
32
|
};
|
|
33
33
|
});
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const firstObject = params.object.shift(); // object.length:1なのでこれでok
|
|
35
|
+
if (firstObject === undefined) {
|
|
36
|
+
throw new factory.errors.ArgumentNull('object');
|
|
37
|
+
}
|
|
38
|
+
const { id, typeOf, paymentMethod, seller } = firstObject;
|
|
39
|
+
const optimizedCheckObject = [{
|
|
36
40
|
id, typeOf, seller, movieTickets,
|
|
37
41
|
paymentMethod: { typeOf: paymentMethod.typeOf } // 最適化(2024-03-15~)
|
|
38
|
-
};
|
|
39
|
-
});
|
|
42
|
+
}];
|
|
40
43
|
const paymentMethodType = (_b = optimizedCheckObject[0]) === null || _b === void 0 ? void 0 : _b.paymentMethod.typeOf; // 決済方法区分
|
|
41
44
|
const paymentServiceId = (_c = optimizedCheckObject[0]) === null || _c === void 0 ? void 0 : _c.id;
|
|
42
45
|
const actionAttributes = Object.assign(Object.assign({ project: params.project, typeOf: factory.actionType.CheckAction, agent: params.agent, object: optimizedCheckObject }, (typeof ((_d = params.purpose) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string') ? { purpose: params.purpose } : undefined), (typeof ((_e = params.sameAs) === null || _e === void 0 ? void 0 : _e.id) === 'string')
|
|
@@ -53,10 +56,7 @@ function checkMovieTicket(params) {
|
|
|
53
56
|
if (eventIds.length !== 1) {
|
|
54
57
|
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
55
58
|
}
|
|
56
|
-
const screeningEvent = yield repos.event.projectEventFieldsById({ id: eventIds[0] }, [
|
|
57
|
-
'typeOf', 'project', 'coaInfo', 'startDate', 'offers.offeredThrough', 'superEvent.workPerformed.identifier'
|
|
58
|
-
] // optimize projection(2024-07-19~)
|
|
59
|
-
);
|
|
59
|
+
const screeningEvent = yield repos.event.projectEventFieldsById({ id: eventIds[0] }, ['typeOf', 'project', 'coaInfo', 'startDate', 'offers.offeredThrough', 'superEvent.workPerformed.identifier']);
|
|
60
60
|
const sellerId = (_f = optimizedCheckObject[0]) === null || _f === void 0 ? void 0 : _f.seller.id;
|
|
61
61
|
const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
|
|
62
62
|
seller: { id: sellerId },
|
|
@@ -86,10 +86,7 @@ function checkMovieTicket(params) {
|
|
|
86
86
|
}
|
|
87
87
|
throw errors[0];
|
|
88
88
|
}
|
|
89
|
-
const result = {
|
|
90
|
-
// purchaseNumberAuthIn: processPurchaseNumberAuthResult.purchaseNumberAuthIn, // discontinue(2024-06-10~)
|
|
91
|
-
// purchaseNumberAuthResult: processPurchaseNumberAuthResult.purchaseNumberAuthResult // discontinue(2024-06-10~)
|
|
92
|
-
};
|
|
89
|
+
const result = {};
|
|
93
90
|
yield repos.action.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result, recipe });
|
|
94
91
|
return { result: processPurchaseNumberAuthResult };
|
|
95
92
|
});
|
|
@@ -74,22 +74,18 @@ function createSeatInfoSyncIn(params) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
exports.createSeatInfoSyncIn = createSeatInfoSyncIn;
|
|
77
|
-
function createStartingPayAction(params
|
|
78
|
-
|
|
79
|
-
) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
90
|
-
: [];
|
|
91
|
-
return Object.assign(Object.assign({}, o), { movieTickets: movieTicketsWithMaskedAccessCode });
|
|
92
|
-
}) });
|
|
77
|
+
function createStartingPayAction(params) {
|
|
78
|
+
const firstObject = params.object.shift();
|
|
79
|
+
if (firstObject === undefined) {
|
|
80
|
+
throw new factory.errors.ArgumentNull('object');
|
|
81
|
+
}
|
|
82
|
+
const movieTicketsWithMaskedAccessCode = (Array.isArray(firstObject.movieTickets))
|
|
83
|
+
? firstObject.movieTickets.map((movieTicket) => {
|
|
84
|
+
return Object.assign(Object.assign({}, movieTicket), { accessCode: '****' // accessCodeを隠蔽(2023-02-08~)
|
|
85
|
+
});
|
|
86
|
+
})
|
|
87
|
+
: [];
|
|
88
|
+
return Object.assign(Object.assign({}, params), { object: [Object.assign(Object.assign({}, firstObject), { movieTickets: movieTicketsWithMaskedAccessCode })] });
|
|
93
89
|
}
|
|
94
90
|
exports.createStartingPayAction = createStartingPayAction;
|
|
95
91
|
function processPurchaseNumberAuthResult2checkRecipe(params) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
2
|
import type { ActionRepo } from '../../../repo/action';
|
|
3
|
+
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
3
4
|
import type { EventRepo } from '../../../repo/event';
|
|
4
5
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
5
6
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
@@ -10,6 +11,7 @@ import { Settings } from '../../../settings';
|
|
|
10
11
|
interface IPayOperationRepos {
|
|
11
12
|
action: ActionRepo;
|
|
12
13
|
accountingReport: AccountingReportRepo;
|
|
14
|
+
credentials: CredentialsRepo;
|
|
13
15
|
event: EventRepo;
|
|
14
16
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
15
17
|
paymentService: PaymentServiceRepo;
|
|
@@ -61,7 +61,8 @@ function payMovieTicket(params) {
|
|
|
61
61
|
clientId: String((_g = availableChannel.credentials) === null || _g === void 0 ? void 0 : _g.clientId),
|
|
62
62
|
clientSecret: String((_h = availableChannel.credentials) === null || _h === void 0 ? void 0 : _h.clientSecret),
|
|
63
63
|
scopes: [],
|
|
64
|
-
state: ''
|
|
64
|
+
state: '',
|
|
65
|
+
credentialsRepo: repos.credentials // set credentialsRepo(2024-11-20~)
|
|
65
66
|
});
|
|
66
67
|
const seatService = new surfrock.service.seat.SeatService({ endpoint: String(availableChannel.serviceUrl), auth: mvtkReserveAuthClient }, { timeout: settings.movieticketReserve.timeout });
|
|
67
68
|
processSeatInfoSyncResult = yield processSeatInfoSync({ seatInfoSyncIn })({ seatService });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
1
2
|
import type { IMinimizedIndividualEvent } from '../../../repo/event';
|
|
2
3
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
3
4
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
@@ -26,6 +27,7 @@ interface ICheckByIdentifierParams {
|
|
|
26
27
|
paymentServiceId: string;
|
|
27
28
|
}
|
|
28
29
|
declare function processPurchaseNumberAuth(params: ICheckByIdentifierParams): (repos: {
|
|
30
|
+
credentials: CredentialsRepo;
|
|
29
31
|
paymentService: PaymentServiceRepo;
|
|
30
32
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
31
33
|
}, settings: Settings) => Promise<ICheckResult>;
|
|
@@ -77,7 +77,8 @@ function processPurchaseNumberAuth(params) {
|
|
|
77
77
|
clientId: String((_b = availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.clientId),
|
|
78
78
|
clientSecret: String((_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.clientSecret),
|
|
79
79
|
scopes: [],
|
|
80
|
-
state: ''
|
|
80
|
+
state: '',
|
|
81
|
+
credentialsRepo: repos.credentials // set credentialsRepo(2024-11-20~)
|
|
81
82
|
});
|
|
82
83
|
const authService = new surfrock.service.auth.AuthService({
|
|
83
84
|
endpoint: String(availableChannel.serviceUrl),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
2
|
import type { ActionRepo } from '../../../repo/action';
|
|
3
|
+
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
3
4
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
4
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
5
6
|
import * as factory from '../../../factory';
|
|
@@ -7,6 +8,7 @@ import { Settings } from '../../../settings';
|
|
|
7
8
|
interface IRefundOperationRepos {
|
|
8
9
|
action: ActionRepo;
|
|
9
10
|
accountingReport: AccountingReportRepo;
|
|
11
|
+
credentials: CredentialsRepo;
|
|
10
12
|
paymentService: PaymentServiceRepo;
|
|
11
13
|
task: TaskRepo;
|
|
12
14
|
}
|
|
@@ -78,7 +78,8 @@ function refundMovieTicket(params) {
|
|
|
78
78
|
clientId: String((_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.clientId),
|
|
79
79
|
clientSecret: String((_e = availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.clientSecret),
|
|
80
80
|
scopes: [],
|
|
81
|
-
state: ''
|
|
81
|
+
state: '',
|
|
82
|
+
credentialsRepo: repos.credentials // set credentialsRepo(2024-11-20~)
|
|
82
83
|
});
|
|
83
84
|
const seatService = new surfrock.service.seat.SeatService({ endpoint: String(availableChannel.serviceUrl), auth: mvtkReserveAuthClient }, { timeout: settings.movieticketReserve.timeout });
|
|
84
85
|
let seatInfoSyncCancelIn;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ActionRepo } from '../../../repo/action';
|
|
2
|
+
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
2
3
|
import type { EventRepo } from '../../../repo/event';
|
|
3
4
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
4
5
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
@@ -13,6 +14,7 @@ export declare function validateMovieTicket(params: factory.assetTransaction.pay
|
|
|
13
14
|
id?: string;
|
|
14
15
|
}): (repos: {
|
|
15
16
|
action: ActionRepo;
|
|
17
|
+
credentials: CredentialsRepo;
|
|
16
18
|
event: EventRepo;
|
|
17
19
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
18
20
|
paymentService: PaymentServiceRepo;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
2
|
import type { ActionRepo } from '../../../repo/action';
|
|
3
|
+
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
3
4
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
4
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
5
6
|
import * as factory from '../../../factory';
|
|
@@ -7,6 +8,7 @@ import { Settings } from '../../../settings';
|
|
|
7
8
|
declare function voidTransaction(params: factory.task.voidPayment.IData): (repos: {
|
|
8
9
|
action: ActionRepo;
|
|
9
10
|
accountingReport: AccountingReportRepo;
|
|
11
|
+
credentials: CredentialsRepo;
|
|
10
12
|
paymentService: PaymentServiceRepo;
|
|
11
13
|
task: TaskRepo;
|
|
12
14
|
}, settings: Settings) => Promise<void>;
|
|
@@ -5,6 +5,7 @@ import type { AcceptedOfferRepo } from '../repo/acceptedOffer';
|
|
|
5
5
|
import type { AccountingReportRepo } from '../repo/accountingReport';
|
|
6
6
|
import type { ActionRepo } from '../repo/action';
|
|
7
7
|
import type { AssetTransactionRepo } from '../repo/assetTransaction';
|
|
8
|
+
import type { CredentialsRepo } from '../repo/credentials';
|
|
8
9
|
import type { EventRepo } from '../repo/event';
|
|
9
10
|
import type { OrderRepo } from '../repo/order';
|
|
10
11
|
import type { PaymentServiceRepo } from '../repo/paymentService';
|
|
@@ -32,10 +33,7 @@ export declare function fixOrderAsPurpose(params: {
|
|
|
32
33
|
}) => Promise<Pick<factory.order.IOrder, "typeOf" | "orderNumber" | "confirmationNumber"> & {
|
|
33
34
|
acceptedOffersMovieTicketUsed: IAcceptedOfferMovieTicketUsed[];
|
|
34
35
|
}>;
|
|
35
|
-
|
|
36
|
-
* 決済確定
|
|
37
|
-
*/
|
|
38
|
-
export declare function pay(params: factory.task.pay.IData & {
|
|
36
|
+
export declare function payTask2payActionAttributes(params: factory.task.pay.IData & {
|
|
39
37
|
sameAs?: {
|
|
40
38
|
/**
|
|
41
39
|
* 実行元タスクID
|
|
@@ -44,10 +42,19 @@ export declare function pay(params: factory.task.pay.IData & {
|
|
|
44
42
|
typeOf: 'Task';
|
|
45
43
|
};
|
|
46
44
|
}): (repos: {
|
|
45
|
+
acceptedOffer: AcceptedOfferRepo;
|
|
46
|
+
assetTransaction: AssetTransactionRepo;
|
|
47
|
+
order: OrderRepo;
|
|
48
|
+
}) => Promise<factory.action.trade.pay.IAttributes>;
|
|
49
|
+
/**
|
|
50
|
+
* 決済確定
|
|
51
|
+
*/
|
|
52
|
+
export declare function pay(payActionAttributes: factory.action.trade.pay.IAttributes): (repos: {
|
|
47
53
|
acceptedOffer: AcceptedOfferRepo;
|
|
48
54
|
action: ActionRepo;
|
|
49
55
|
accountingReport: AccountingReportRepo;
|
|
50
56
|
assetTransaction: AssetTransactionRepo;
|
|
57
|
+
credentials: CredentialsRepo;
|
|
51
58
|
event: EventRepo;
|
|
52
59
|
order: OrderRepo;
|
|
53
60
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
@@ -60,6 +67,7 @@ export declare function pay(params: factory.task.pay.IData & {
|
|
|
60
67
|
export declare function voidPayment(params: factory.task.voidPayment.IData): (repos: {
|
|
61
68
|
action: ActionRepo;
|
|
62
69
|
accountingReport: AccountingReportRepo;
|
|
70
|
+
credentials: CredentialsRepo;
|
|
63
71
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
64
72
|
paymentService: PaymentServiceRepo;
|
|
65
73
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
@@ -77,6 +85,7 @@ export declare function refund(params: factory.task.refund.IData & {
|
|
|
77
85
|
}): (repos: {
|
|
78
86
|
action: ActionRepo;
|
|
79
87
|
accountingReport: AccountingReportRepo;
|
|
88
|
+
credentials: CredentialsRepo;
|
|
80
89
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
81
90
|
paymentService: PaymentServiceRepo;
|
|
82
91
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.refund = exports.voidPayment = exports.pay = exports.fixOrderAsPurpose = void 0;
|
|
12
|
+
exports.refund = exports.voidPayment = exports.pay = exports.payTask2payActionAttributes = exports.fixOrderAsPurpose = void 0;
|
|
13
13
|
const factory = require("../factory");
|
|
14
14
|
const CreditCardPaymentService = require("./payment/creditCard");
|
|
15
15
|
const FaceToFacePaymentService = require("./payment/faceToFace");
|
|
@@ -96,21 +96,25 @@ function payTask2payActionAttributes(params) {
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
+
exports.payTask2payActionAttributes = payTask2payActionAttributes;
|
|
99
100
|
/**
|
|
100
101
|
* 決済確定
|
|
101
102
|
*/
|
|
102
|
-
function pay(
|
|
103
|
+
function pay(
|
|
104
|
+
// params: factory.task.pay.IData & {
|
|
105
|
+
// sameAs?: {
|
|
106
|
+
// /**
|
|
107
|
+
// * 実行元タスクID
|
|
108
|
+
// */
|
|
109
|
+
// id: string;
|
|
110
|
+
// typeOf: 'Task';
|
|
111
|
+
// };
|
|
112
|
+
// }
|
|
113
|
+
payActionAttributes) {
|
|
103
114
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
// let payActionAttributes: factory.action.trade.pay.IAttributes;
|
|
116
|
+
// payActionAttributes = await payTask2payActionAttributes(params)(repos);
|
|
104
117
|
var _a;
|
|
105
|
-
let payActionAttributes;
|
|
106
|
-
// if (params.purpose.typeOf === factory.actionType.ReturnAction) {
|
|
107
|
-
// // タスクにPayActionそのものが指定されていればそのまま処理
|
|
108
|
-
// payActionAttributes = params;
|
|
109
|
-
// } else {
|
|
110
|
-
// // 最適化されたタスクに対応(2024-01-19~)
|
|
111
|
-
// payActionAttributes = await payTask2payActionAttributes(params)(repos);
|
|
112
|
-
// }
|
|
113
|
-
payActionAttributes = yield payTask2payActionAttributes(params)(repos);
|
|
114
118
|
const paymentServiceType = (_a = payActionAttributes.object[0]) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
115
119
|
switch (paymentServiceType) {
|
|
116
120
|
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
@@ -16,6 +16,7 @@ const action_1 = require("../../repo/action");
|
|
|
16
16
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
17
17
|
const authorization_1 = require("../../repo/authorization");
|
|
18
18
|
const confirmationNumber_1 = require("../../repo/confirmationNumber");
|
|
19
|
+
const credentials_1 = require("../../repo/credentials");
|
|
19
20
|
const event_1 = require("../../repo/event");
|
|
20
21
|
const paymentService_1 = require("../../repo/paymentService");
|
|
21
22
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
@@ -45,6 +46,10 @@ function call(params) {
|
|
|
45
46
|
let callResult;
|
|
46
47
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
47
48
|
const transactionProcessRepo = new transactionProcess_1.TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
49
|
+
const paymentServiceId = params.data.object.issuedThrough.id;
|
|
50
|
+
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
51
|
+
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
52
|
+
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
48
53
|
try {
|
|
49
54
|
yield (0, any_1.authorize)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } // タスクIDを関連付け(2024-04-20~)
|
|
50
55
|
}))({
|
|
@@ -53,6 +58,10 @@ function call(params) {
|
|
|
53
58
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
54
59
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
55
60
|
confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo(redisClient),
|
|
61
|
+
credentials: new credentials_1.CredentialsRepo(redisClient, {
|
|
62
|
+
scope: `${factory.service.paymentService.PaymentServiceType.MovieTicket}:${paymentServiceId}`,
|
|
63
|
+
expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
|
|
64
|
+
}),
|
|
56
65
|
event: new event_1.EventRepo(connection),
|
|
57
66
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
58
67
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
const action_1 = require("../../repo/action");
|
|
15
|
+
const credentials_1 = require("../../repo/credentials");
|
|
15
16
|
const event_1 = require("../../repo/event");
|
|
16
17
|
const paymentService_1 = require("../../repo/paymentService");
|
|
17
18
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
@@ -23,7 +24,7 @@ const pay_1 = require("../assetTransaction/pay");
|
|
|
23
24
|
*/
|
|
24
25
|
function call(params) {
|
|
25
26
|
return ({ connection, redisClient, settings }, options) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
var _a, _b;
|
|
27
|
+
var _a, _b, _c;
|
|
27
28
|
if (redisClient === undefined) {
|
|
28
29
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
29
30
|
}
|
|
@@ -33,9 +34,17 @@ function call(params) {
|
|
|
33
34
|
}
|
|
34
35
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
35
36
|
const transactionProcessRepo = new transactionProcess_1.TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
37
|
+
const paymentServiceId = (_a = params.data.object[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
38
|
+
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
39
|
+
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
40
|
+
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
36
41
|
try {
|
|
37
42
|
yield (0, pay_1.check)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id, typeOf: 'Task' } }))({
|
|
38
43
|
action: actionRepo,
|
|
44
|
+
credentials: new credentials_1.CredentialsRepo(redisClient, {
|
|
45
|
+
scope: `${factory.service.paymentService.PaymentServiceType.MovieTicket}:${paymentServiceId}`,
|
|
46
|
+
expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
|
|
47
|
+
}),
|
|
39
48
|
event: new event_1.EventRepo(connection),
|
|
40
49
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
41
50
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
@@ -45,7 +54,7 @@ function call(params) {
|
|
|
45
54
|
catch (error) {
|
|
46
55
|
let throwsError = true;
|
|
47
56
|
// アクションが存在すればタスクを実行済扱いにする
|
|
48
|
-
const action = (yield actionRepo.searchBySameAs(Object.assign({ sameAs: { id: { $eq: params.id } }, typeOf: { $eq: factory.actionType.CheckAction } }, (typeof ((
|
|
57
|
+
const action = (yield actionRepo.searchBySameAs(Object.assign({ sameAs: { id: { $eq: params.id } }, typeOf: { $eq: factory.actionType.CheckAction } }, (typeof ((_b = params.data.purpose) === null || _b === void 0 ? void 0 : _b.id) === 'string')
|
|
49
58
|
? { purpose: { id: { $eq: params.data.purpose.id } } }
|
|
50
59
|
: undefined))).shift();
|
|
51
60
|
if (typeof (action === null || action === void 0 ? void 0 : action.id) === 'string') {
|
|
@@ -57,7 +66,7 @@ function call(params) {
|
|
|
57
66
|
}
|
|
58
67
|
finally {
|
|
59
68
|
// 取引プロセスロック解除
|
|
60
|
-
if (typeof ((
|
|
69
|
+
if (typeof ((_c = params.data.purpose) === null || _c === void 0 ? void 0 : _c.id) === 'string') {
|
|
61
70
|
yield transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
|
|
62
71
|
}
|
|
63
72
|
}
|
|
@@ -10,10 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
13
14
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
14
15
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
15
16
|
const action_1 = require("../../repo/action");
|
|
16
17
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
18
|
+
const credentials_1 = require("../../repo/credentials");
|
|
17
19
|
const event_1 = require("../../repo/event");
|
|
18
20
|
const order_1 = require("../../repo/order");
|
|
19
21
|
const paymentService_1 = require("../../repo/paymentService");
|
|
@@ -27,13 +29,36 @@ const payment_1 = require("../payment");
|
|
|
27
29
|
* タスク実行関数
|
|
28
30
|
*/
|
|
29
31
|
function call(params) {
|
|
30
|
-
return ({ connection, settings }) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
|
|
32
|
+
return ({ connection, redisClient, settings }) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
var _a;
|
|
34
|
+
if (redisClient === undefined) {
|
|
35
|
+
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
36
|
+
}
|
|
37
|
+
let payActionAttributes;
|
|
38
|
+
payActionAttributes = yield (0, payment_1.payTask2payActionAttributes)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id, typeOf: 'Task' } // タスクIDを関連付け(2024-04-20~)
|
|
32
39
|
}))({
|
|
40
|
+
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
41
|
+
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
42
|
+
order: new order_1.OrderRepo(connection)
|
|
43
|
+
});
|
|
44
|
+
const paymentServiceId = (_a = payActionAttributes.object.at(0)) === null || _a === void 0 ? void 0 : _a.id;
|
|
45
|
+
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
46
|
+
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
47
|
+
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
48
|
+
yield (0, payment_1.pay)(
|
|
49
|
+
// {
|
|
50
|
+
// ...params.data,
|
|
51
|
+
// sameAs: { id: params.id, typeOf: 'Task' } // タスクIDを関連付け(2024-04-20~)
|
|
52
|
+
// }
|
|
53
|
+
payActionAttributes)({
|
|
33
54
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
34
55
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
35
56
|
action: new action_1.ActionRepo(connection),
|
|
36
57
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
58
|
+
credentials: new credentials_1.CredentialsRepo(redisClient, {
|
|
59
|
+
scope: `${factory.service.paymentService.PaymentServiceType.MovieTicket}:${paymentServiceId}`,
|
|
60
|
+
expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
|
|
61
|
+
}),
|
|
37
62
|
event: new event_1.EventRepo(connection),
|
|
38
63
|
order: new order_1.OrderRepo(connection),
|
|
39
64
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
@@ -14,6 +14,7 @@ const factory = require("../../factory");
|
|
|
14
14
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
15
15
|
const action_1 = require("../../repo/action");
|
|
16
16
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
17
|
+
const credentials_1 = require("../../repo/credentials");
|
|
17
18
|
const paymentService_1 = require("../../repo/paymentService");
|
|
18
19
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
19
20
|
const product_1 = require("../../repo/product");
|
|
@@ -27,6 +28,7 @@ const payment_1 = require("../payment");
|
|
|
27
28
|
*/
|
|
28
29
|
function call(params) {
|
|
29
30
|
return ({ connection, redisClient, settings }) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
var _a;
|
|
30
32
|
if (redisClient === undefined) {
|
|
31
33
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
32
34
|
}
|
|
@@ -38,9 +40,17 @@ function call(params) {
|
|
|
38
40
|
else {
|
|
39
41
|
data = params;
|
|
40
42
|
}
|
|
43
|
+
const paymentServiceId = (_a = data.object.at(0)) === null || _a === void 0 ? void 0 : _a.id;
|
|
44
|
+
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
45
|
+
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
46
|
+
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
41
47
|
yield (0, payment_1.refund)(data)({
|
|
42
48
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
43
49
|
action: new action_1.ActionRepo(connection),
|
|
50
|
+
credentials: new credentials_1.CredentialsRepo(redisClient, {
|
|
51
|
+
scope: `${factory.service.paymentService.PaymentServiceType.MovieTicket}:${paymentServiceId}`,
|
|
52
|
+
expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
|
|
53
|
+
}),
|
|
44
54
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
45
55
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
46
56
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
@@ -10,8 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
13
14
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
14
15
|
const action_1 = require("../../repo/action");
|
|
16
|
+
const credentials_1 = require("../../repo/credentials");
|
|
15
17
|
const paymentService_1 = require("../../repo/paymentService");
|
|
16
18
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
17
19
|
const product_1 = require("../../repo/product");
|
|
@@ -23,10 +25,21 @@ const payment_1 = require("../payment");
|
|
|
23
25
|
* タスク実行関数
|
|
24
26
|
*/
|
|
25
27
|
function call(data) {
|
|
26
|
-
return ({ connection, settings }) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return ({ connection, redisClient, settings }) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
if (redisClient === undefined) {
|
|
30
|
+
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
31
|
+
}
|
|
32
|
+
const paymentServiceId = data.object.object.id;
|
|
33
|
+
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
34
|
+
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
35
|
+
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
27
36
|
yield (0, payment_1.voidPayment)(data)({
|
|
28
37
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
29
38
|
action: new action_1.ActionRepo(connection),
|
|
39
|
+
credentials: new credentials_1.CredentialsRepo(redisClient, {
|
|
40
|
+
scope: `${factory.service.paymentService.PaymentServiceType.MovieTicket}:${paymentServiceId}`,
|
|
41
|
+
expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
|
|
42
|
+
}),
|
|
30
43
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
31
44
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
32
45
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -31,6 +31,25 @@ interface IOnEventChanged {
|
|
|
31
31
|
informEvent?: factory.project.IInformParams[];
|
|
32
32
|
informEvent2agg?: factory.project.IInformParams[];
|
|
33
33
|
}
|
|
34
|
+
interface ISurfrockSettings {
|
|
35
|
+
/**
|
|
36
|
+
* 着券時タイムアウト
|
|
37
|
+
*/
|
|
38
|
+
timeout: number;
|
|
39
|
+
/**
|
|
40
|
+
* 認証時タイムアウト
|
|
41
|
+
*/
|
|
42
|
+
timeoutCheck: number;
|
|
43
|
+
/**
|
|
44
|
+
* 決済と返金の最小間隔(ms)
|
|
45
|
+
*/
|
|
46
|
+
minIntervalBetweenPayAndRefund: number;
|
|
47
|
+
/**
|
|
48
|
+
* surfrockクライアント認証情報保管期限
|
|
49
|
+
* 0の場合、保管しない
|
|
50
|
+
*/
|
|
51
|
+
credentialsExpireInSeconds?: number;
|
|
52
|
+
}
|
|
34
53
|
interface IOptions {
|
|
35
54
|
onOrderStatusChanged: IOnOrderStatusChanged;
|
|
36
55
|
onEventChanged: IOnEventChanged;
|
|
@@ -65,20 +84,7 @@ interface IOptions {
|
|
|
65
84
|
timeoutBackground: number;
|
|
66
85
|
useFetch: boolean;
|
|
67
86
|
};
|
|
68
|
-
movieticketReserve:
|
|
69
|
-
/**
|
|
70
|
-
* 着券時タイムアウト
|
|
71
|
-
*/
|
|
72
|
-
timeout: number;
|
|
73
|
-
/**
|
|
74
|
-
* 認証時タイムアウト
|
|
75
|
-
*/
|
|
76
|
-
timeoutCheck: number;
|
|
77
|
-
/**
|
|
78
|
-
* 決済と返金の最小間隔(ms)
|
|
79
|
-
*/
|
|
80
|
-
minIntervalBetweenPayAndRefund: number;
|
|
81
|
-
};
|
|
87
|
+
movieticketReserve: ISurfrockSettings;
|
|
82
88
|
useAssetTransactionSyncProcessing: boolean;
|
|
83
89
|
useExperimentalFeature: boolean;
|
|
84
90
|
useNotificationUseAction?: boolean;
|
|
@@ -124,20 +130,7 @@ declare class Settings {
|
|
|
124
130
|
timeoutBackground: number;
|
|
125
131
|
useFetch: boolean;
|
|
126
132
|
};
|
|
127
|
-
readonly movieticketReserve:
|
|
128
|
-
/**
|
|
129
|
-
* 着券時タイムアウト
|
|
130
|
-
*/
|
|
131
|
-
timeout: number;
|
|
132
|
-
/**
|
|
133
|
-
* 認証時タイムアウト
|
|
134
|
-
*/
|
|
135
|
-
timeoutCheck: number;
|
|
136
|
-
/**
|
|
137
|
-
* 決済と返金の最小間隔(ms)
|
|
138
|
-
*/
|
|
139
|
-
minIntervalBetweenPayAndRefund: number;
|
|
140
|
-
};
|
|
133
|
+
readonly movieticketReserve: ISurfrockSettings;
|
|
141
134
|
readonly useAssetTransactionSyncProcessing: boolean;
|
|
142
135
|
readonly useExperimentalFeature: boolean;
|
|
143
136
|
readonly useNotificationUseAction: boolean;
|
package/package.json
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "4.389.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.389.0-alpha.20",
|
|
15
15
|
"@cinerino/sdk": "10.16.0-alpha.9",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0-alpha.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
18
18
|
"@sendgrid/mail": "6.4.0",
|
|
19
|
-
"@surfrock/sdk": "1.
|
|
19
|
+
"@surfrock/sdk": "1.4.0-alpha.0",
|
|
20
20
|
"cdigit": "2.6.7",
|
|
21
21
|
"debug": "^3.2.7",
|
|
22
22
|
"google-libphonenumber": "^3.2.18",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"postversion": "git push origin --tags",
|
|
109
109
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
110
110
|
},
|
|
111
|
-
"version": "22.6.0-alpha.
|
|
111
|
+
"version": "22.6.0-alpha.32"
|
|
112
112
|
}
|