@chevre/domain 22.9.0-alpha.20 → 22.9.0-alpha.22
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/migratePaymentServiceChannelsCreditCard.ts +11 -38
- package/lib/chevre/repo/action.d.ts +4 -4
- package/lib/chevre/repo/potentialAction.d.ts +4 -0
- package/lib/chevre/repo/potentialAction.js +2 -1
- package/lib/chevre/service/notification.js +28 -5
- package/lib/chevre/service/payment/any/factory.d.ts +1 -0
- package/lib/chevre/service/payment/any/factory.js +3 -3
- package/lib/chevre/service/payment/any/{fixConfirmationNumberAsNeeded.d.ts → fixOrderAsNeeded.d.ts} +10 -2
- package/lib/chevre/service/payment/any/{fixConfirmationNumberAsNeeded.js → fixOrderAsNeeded.js} +12 -4
- package/lib/chevre/service/payment/any/onPayActionCompleted.js +12 -2
- package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.js +10 -2
- package/lib/chevre/service/payment/any.d.ts +4 -0
- package/lib/chevre/service/payment/any.js +10 -8
- package/lib/chevre/service/payment/movieTicket/authorize.js +7 -2
- package/lib/chevre/service/task/authorizePayment.js +5 -6
- package/lib/chevre/service/transaction/placeOrder.js +0 -2
- package/package.json +3 -3
|
@@ -66,51 +66,23 @@ async function main() {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
// docs(same serviceUrl and different siteId,sitePass ) exist?
|
|
69
|
-
const credentials =
|
|
70
|
-
|
|
71
|
-
if (typeof credentials?.siteId !== 'string') {
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
if (typeof credentials?.sitePass !== 'string') {
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
const sameServiceUrlDocs = await paymentServiceRepo.getModel()
|
|
78
|
-
.find({
|
|
79
|
-
$and: [
|
|
80
|
-
{ 'project.id': { $eq: paymentService.project.id } },
|
|
81
|
-
{ 'availableChannel.serviceUrl': { $eq: serviceUrl } },
|
|
82
|
-
{
|
|
83
|
-
$or: [
|
|
84
|
-
{ 'availableChannel.credentials.siteId': { $ne: credentials.siteId } },
|
|
85
|
-
{ 'availableChannel.credentials.sitePass': { $ne: credentials.sitePass } }
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
})
|
|
90
|
-
.exec();
|
|
91
|
-
if (sameServiceUrlDocs.length > 0) {
|
|
92
|
-
unexpectedProjectIds.push(paymentService.project.id);
|
|
93
|
-
console.log(
|
|
94
|
-
sameServiceUrlDocs.length, 'unexpected.', paymentService.project.id, paymentService.productID, i);
|
|
95
|
-
}
|
|
69
|
+
// const credentials =
|
|
70
|
+
// <chevre.factory.serviceChannel.ICredentialsCreditCard | undefined>paymentService.availableChannel?.credentials;
|
|
71
|
+
// if (typeof credentials?.siteId !== 'string') {
|
|
72
|
+
// throw new Error('siteId must be string');
|
|
73
|
+
// }
|
|
74
|
+
// if (typeof credentials?.sitePass !== 'string') {
|
|
75
|
+
// throw new Error('sitePass must be string');
|
|
76
|
+
// }
|
|
96
77
|
|
|
97
78
|
if (alreadyMigrated) {
|
|
98
79
|
console.log(
|
|
99
80
|
'already migrated.', paymentService.project.id, i);
|
|
100
81
|
} else {
|
|
101
|
-
const newChannel: chevre.factory.serviceChannel.IServiceChannelCreditCard = {
|
|
102
|
-
credentials,
|
|
103
|
-
project: { id: paymentService.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
104
|
-
providesService: {
|
|
105
|
-
typeOf: chevre.factory.service.paymentService.PaymentServiceType.CreditCard
|
|
106
|
-
},
|
|
107
|
-
serviceUrl,
|
|
108
|
-
typeOf: 'ServiceChannel'
|
|
109
|
-
};
|
|
110
82
|
console.log(
|
|
111
83
|
'updating...',
|
|
112
|
-
paymentService.project.id, i
|
|
113
|
-
await paymentServiceRepo.saveChannelByServiceUrl(newChannel);
|
|
84
|
+
paymentService.project.id, i);
|
|
85
|
+
// await paymentServiceRepo.saveChannelByServiceUrl(newChannel);
|
|
114
86
|
updateCount += 1;
|
|
115
87
|
console.log(
|
|
116
88
|
'updated.',
|
|
@@ -121,6 +93,7 @@ async function main() {
|
|
|
121
93
|
serviceUrls = [...new Set(serviceUrls)];
|
|
122
94
|
console.log('unexpectedProjectIds:', unexpectedProjectIds);
|
|
123
95
|
// console.log(serviceUrls);
|
|
96
|
+
console.log(serviceUrls);
|
|
124
97
|
console.log(serviceUrls.length, 'serviceUrls found');
|
|
125
98
|
console.log(i, 'docs checked');
|
|
126
99
|
console.log(updateCount, 'docs updated');
|
|
@@ -342,7 +342,7 @@ export declare class ActionRepo {
|
|
|
342
342
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
343
343
|
typeOf: factory.actionType;
|
|
344
344
|
result?: any;
|
|
345
|
-
recipient?: import("@chevre/factory/lib/action").
|
|
345
|
+
recipient?: import("@chevre/factory/lib/action").IRecipient | undefined;
|
|
346
346
|
agent: import("@chevre/factory/lib/action").IParticipant;
|
|
347
347
|
purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
|
|
348
348
|
targetCollection?: any;
|
|
@@ -367,7 +367,7 @@ export declare class ActionRepo {
|
|
|
367
367
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
368
368
|
typeOf: factory.actionType;
|
|
369
369
|
result?: any;
|
|
370
|
-
recipient?: import("@chevre/factory/lib/action").
|
|
370
|
+
recipient?: import("@chevre/factory/lib/action").IRecipient | undefined;
|
|
371
371
|
agent: import("@chevre/factory/lib/action").IParticipant;
|
|
372
372
|
purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
|
|
373
373
|
targetCollection?: any;
|
|
@@ -394,7 +394,7 @@ export declare class ActionRepo {
|
|
|
394
394
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
395
395
|
typeOf: factory.actionType;
|
|
396
396
|
result?: any;
|
|
397
|
-
recipient?: import("@chevre/factory/lib/action").
|
|
397
|
+
recipient?: import("@chevre/factory/lib/action").IRecipient | undefined;
|
|
398
398
|
agent: import("@chevre/factory/lib/action").IParticipant;
|
|
399
399
|
purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
|
|
400
400
|
targetCollection?: any;
|
|
@@ -419,7 +419,7 @@ export declare class ActionRepo {
|
|
|
419
419
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
420
420
|
typeOf: factory.actionType;
|
|
421
421
|
result?: any;
|
|
422
|
-
recipient?: import("@chevre/factory/lib/action").
|
|
422
|
+
recipient?: import("@chevre/factory/lib/action").IRecipient | undefined;
|
|
423
423
|
agent: import("@chevre/factory/lib/action").IParticipant;
|
|
424
424
|
purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
|
|
425
425
|
targetCollection?: any;
|
|
@@ -26,11 +26,13 @@ export declare class PotentialActionRepo {
|
|
|
26
26
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, {
|
|
27
27
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
28
28
|
typeOf: factory.actionType.InformAction;
|
|
29
|
+
recipient?: factory.potentialAction.IInformRecipient | undefined;
|
|
29
30
|
identifier: string;
|
|
30
31
|
target: factory.entryPoint.IEntryPoint;
|
|
31
32
|
}> & {
|
|
32
33
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
33
34
|
typeOf: factory.actionType.InformAction;
|
|
35
|
+
recipient?: factory.potentialAction.IInformRecipient | undefined;
|
|
34
36
|
identifier: string;
|
|
35
37
|
target: factory.entryPoint.IEntryPoint;
|
|
36
38
|
} & {
|
|
@@ -38,11 +40,13 @@ export declare class PotentialActionRepo {
|
|
|
38
40
|
}, QueryOptions<import("mongoose").Document<unknown, {}, {
|
|
39
41
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
40
42
|
typeOf: factory.actionType.InformAction;
|
|
43
|
+
recipient?: factory.potentialAction.IInformRecipient | undefined;
|
|
41
44
|
identifier: string;
|
|
42
45
|
target: factory.entryPoint.IEntryPoint;
|
|
43
46
|
}> & {
|
|
44
47
|
project: Pick<factory.project.IProject, "id" | "typeOf">;
|
|
45
48
|
typeOf: factory.actionType.InformAction;
|
|
49
|
+
recipient?: factory.potentialAction.IInformRecipient | undefined;
|
|
46
50
|
identifier: string;
|
|
47
51
|
target: factory.entryPoint.IEntryPoint;
|
|
48
52
|
} & {
|
|
@@ -239,8 +239,27 @@ function sleep(waitTime) {
|
|
|
239
239
|
}
|
|
240
240
|
function createInformActionAttributes(params) {
|
|
241
241
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
242
|
-
var _a;
|
|
242
|
+
var _a, _b;
|
|
243
243
|
const { about, object, purpose, recipient, project, id, typeOf } = params;
|
|
244
|
+
// redefine recipient(2025-02-15~)
|
|
245
|
+
let informRecipient;
|
|
246
|
+
// let informRecipient: factory.action.interact.inform.IRecipient | factory.action.interact.inform.IRecipientDeprecated = {
|
|
247
|
+
// ...recipient
|
|
248
|
+
// // url: target.urlTemplate // discontinue(2025-02-15~)
|
|
249
|
+
// };
|
|
250
|
+
if ((recipient === null || recipient === void 0 ? void 0 : recipient.typeOf) === factory.organizationType.Corporation && typeof recipient.id === 'string') {
|
|
251
|
+
informRecipient = {
|
|
252
|
+
id: recipient.id,
|
|
253
|
+
name: recipient.name,
|
|
254
|
+
typeOf: recipient.typeOf
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
else if ((recipient === null || recipient === void 0 ? void 0 : recipient.typeOf) === factory.creativeWorkType.WebApplication) {
|
|
258
|
+
informRecipient = {
|
|
259
|
+
name: recipient.name,
|
|
260
|
+
typeOf: recipient.typeOf
|
|
261
|
+
};
|
|
262
|
+
}
|
|
244
263
|
let target;
|
|
245
264
|
if (typeOf === factory.actionType.InformAction && typeof id === 'string' && id !== '') {
|
|
246
265
|
// find target from potentialAction(2025-02-06~)
|
|
@@ -249,22 +268,26 @@ function createInformActionAttributes(params) {
|
|
|
249
268
|
page: 1,
|
|
250
269
|
id: { $eq: id },
|
|
251
270
|
typeOf: { $eq: typeOf }
|
|
252
|
-
}, ['target'])).shift();
|
|
271
|
+
}, ['target', 'recipient'])).shift();
|
|
253
272
|
if (potentialInformAction === undefined) {
|
|
254
273
|
throw new factory.errors.NotFound(factory.actionType.InformAction);
|
|
255
274
|
}
|
|
275
|
+
if (typeof ((_a = potentialInformAction.recipient) === null || _a === void 0 ? void 0 : _a.name) === 'string') {
|
|
276
|
+
informRecipient = { name: potentialInformAction.recipient.name, typeOf: potentialInformAction.recipient.typeOf };
|
|
277
|
+
}
|
|
256
278
|
target = potentialInformAction.target;
|
|
257
279
|
}
|
|
258
280
|
else {
|
|
259
|
-
if (((
|
|
281
|
+
if (((_b = params.target) === null || _b === void 0 ? void 0 : _b.typeOf) === 'EntryPoint') {
|
|
260
282
|
target = params.target;
|
|
261
283
|
}
|
|
262
284
|
}
|
|
263
|
-
|
|
285
|
+
if (informRecipient === undefined) {
|
|
286
|
+
throw new factory.errors.ArgumentNull('recipient');
|
|
287
|
+
}
|
|
264
288
|
if (target === undefined) {
|
|
265
289
|
throw new factory.errors.ArgumentNull('target');
|
|
266
290
|
}
|
|
267
|
-
const informRecipient = Object.assign(Object.assign({}, recipient), { url: target.urlTemplate });
|
|
268
291
|
return Object.assign(Object.assign(Object.assign({ agent: { id: project.id, typeOf: factory.organizationType.Project }, object, project: { id: project.id, typeOf: factory.organizationType.Project }, recipient: informRecipient, typeOf: factory.actionType.InformAction }, (typeof (purpose === null || purpose === void 0 ? void 0 : purpose.typeOf) === 'string') ? { purpose } : undefined), (typeof (about === null || about === void 0 ? void 0 : about.typeOf) === 'string') ? { about } : undefined), (typeof (target === null || target === void 0 ? void 0 : target.typeOf) === 'string') ? { target } : undefined // add(2025-02-06~)
|
|
269
292
|
);
|
|
270
293
|
});
|
|
@@ -32,6 +32,7 @@ export declare function creatPayTransactionStartParams(params: {
|
|
|
32
32
|
* 決済カード決済承認の場合、事前発行済の確認番号を決済取引へ連携
|
|
33
33
|
*/
|
|
34
34
|
confirmationNumber: string;
|
|
35
|
+
orderNumber: string;
|
|
35
36
|
};
|
|
36
37
|
}): factory.assetTransaction.pay.IStartParamsWithoutDetail;
|
|
37
38
|
export declare function createMovieTicket(params: factory.action.trade.pay.IMovieTicket): factory.action.trade.pay.IMovieTicket;
|
|
@@ -53,8 +53,7 @@ function creatPayTransactionStartParams(params) {
|
|
|
53
53
|
.toDate();
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
const confirmationNumber = params.order.confirmationNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
56
|
+
const { confirmationNumber, orderNumber } = params.order;
|
|
58
57
|
const issuedThroughId = (_a = params.object.issuedThrough) === null || _a === void 0 ? void 0 : _a.id;
|
|
59
58
|
const accountId = (typeof params.accountId === 'string')
|
|
60
59
|
? params.accountId
|
|
@@ -87,7 +86,8 @@ function creatPayTransactionStartParams(params) {
|
|
|
87
86
|
paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ identifier: params.object.paymentMethod, 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)
|
|
88
87
|
}, expires: expires, purpose: {
|
|
89
88
|
typeOf: factory.order.OrderType.Order,
|
|
90
|
-
confirmationNumber
|
|
89
|
+
confirmationNumber,
|
|
90
|
+
orderNumber
|
|
91
91
|
} }, (typeof ((_d = params.location) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
92
92
|
? { location: params.location }
|
|
93
93
|
: undefined);
|
package/lib/chevre/service/payment/any/{fixConfirmationNumberAsNeeded.d.ts → fixOrderAsNeeded.d.ts}
RENAMED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
|
|
3
|
+
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
4
|
+
import type { ProjectRepo } from '../../../repo/project';
|
|
3
5
|
import type { TransactionRepo } from '../../../repo/transaction';
|
|
4
|
-
declare function
|
|
6
|
+
declare function fixOrderAsNeeded(params: {
|
|
7
|
+
project: {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
5
10
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
6
11
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
7
12
|
}): (repos: {
|
|
13
|
+
project: ProjectRepo;
|
|
8
14
|
transaction: TransactionRepo;
|
|
9
15
|
confirmationNumber: ConfirmationNumberRepo;
|
|
16
|
+
orderNumber: OrderNumberRepo;
|
|
10
17
|
}) => Promise<{
|
|
11
18
|
confirmationNumber: string;
|
|
19
|
+
orderNumber: string;
|
|
12
20
|
}>;
|
|
13
|
-
export {
|
|
21
|
+
export { fixOrderAsNeeded };
|
package/lib/chevre/service/payment/any/{fixConfirmationNumberAsNeeded.js → fixOrderAsNeeded.js}
RENAMED
|
@@ -9,11 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.fixOrderAsNeeded = fixOrderAsNeeded;
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
14
|
const publishConfirmationNumberIfNotExist_1 = require("../../transaction/placeOrder/publishConfirmationNumberIfNotExist");
|
|
15
|
-
|
|
15
|
+
const publishOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/publishOrderNumberIfNotExist");
|
|
16
|
+
function fixOrderAsNeeded(params) {
|
|
16
17
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const orderDate = new Date();
|
|
17
19
|
// publish always(2025-02-12~)
|
|
18
20
|
// MovieTicketの場合、確認番号を発行(着券に連携するため)(2024-05-27~)
|
|
19
21
|
// let confirmationNumber: string | undefined;
|
|
@@ -22,12 +24,18 @@ function fixConfirmationNumberAsNeeded(params) {
|
|
|
22
24
|
confirmationNumber = yield (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({
|
|
23
25
|
id: params.purpose.id,
|
|
24
26
|
status: { $in: [factory.transactionStatusType.InProgress] },
|
|
25
|
-
object: { orderDate
|
|
27
|
+
object: { orderDate }
|
|
26
28
|
})({
|
|
27
29
|
confirmationNumber: repos.confirmationNumber,
|
|
28
30
|
transaction: repos.transaction
|
|
29
31
|
});
|
|
30
32
|
// }
|
|
31
|
-
|
|
33
|
+
// publish orderNumber(2025-02-14~)
|
|
34
|
+
const orderNumber = yield (0, publishOrderNumberIfNotExist_1.publishOrderNumberIfNotExist)({
|
|
35
|
+
project: { id: params.project.id },
|
|
36
|
+
id: params.purpose.id,
|
|
37
|
+
object: { orderDate }
|
|
38
|
+
})(repos);
|
|
39
|
+
return { confirmationNumber, orderNumber };
|
|
32
40
|
});
|
|
33
41
|
}
|
|
@@ -32,9 +32,19 @@ function onPayActionCompleted(payAction) {
|
|
|
32
32
|
taskAttributes.push(...informPayment.map(({ purpose, recipient, id }) => {
|
|
33
33
|
let data;
|
|
34
34
|
if (typeof id === 'string' && id !== '') {
|
|
35
|
-
|
|
35
|
+
let about;
|
|
36
|
+
if (payAction.purpose.typeOf === factory.order.OrderType.Order) {
|
|
37
|
+
if (typeof payAction.purpose.orderNumber === 'string') {
|
|
38
|
+
about = { orderNumber: payAction.purpose.orderNumber, typeOf: factory.order.OrderType.Order };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (payAction.purpose.typeOf === factory.actionType.ReturnAction) {
|
|
42
|
+
about = { orderNumber: payAction.purpose.object.orderNumber, typeOf: factory.order.OrderType.Order };
|
|
43
|
+
}
|
|
44
|
+
data = Object.assign(Object.assign({
|
|
36
45
|
// optimize(2024-07-01~)
|
|
37
|
-
recipient, object: aciton4inform, id, typeOf: factory.actionType.InformAction }, (typeof (purpose === null || purpose === void 0 ? void 0 : purpose.typeOf) === 'string') ? { purpose } : undefined)
|
|
46
|
+
recipient, object: aciton4inform, id, typeOf: factory.actionType.InformAction }, (typeof (purpose === null || purpose === void 0 ? void 0 : purpose.typeOf) === 'string') ? { purpose } : undefined), (typeof (about === null || about === void 0 ? void 0 : about.typeOf) === 'string') ? { about } : undefined // add(2025-02-14~)
|
|
47
|
+
);
|
|
38
48
|
}
|
|
39
49
|
else {
|
|
40
50
|
throw new factory.errors.ArgumentNull('potentialActions.informPayment.id'); // 2025-02-09~
|
|
@@ -108,9 +108,17 @@ function onRefundActionCompletedOrFailed(refundAction) {
|
|
|
108
108
|
taskAttributes.push(...informPayment.map(({ purpose, recipient, id }) => {
|
|
109
109
|
let data;
|
|
110
110
|
if (typeof id === 'string' && id !== '') {
|
|
111
|
-
|
|
111
|
+
let about;
|
|
112
|
+
if (refundAction.purpose.typeOf === factory.actionType.ReturnAction) {
|
|
113
|
+
about = {
|
|
114
|
+
orderNumber: refundAction.purpose.object.orderNumber,
|
|
115
|
+
typeOf: factory.order.OrderType.Order
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
data = Object.assign(Object.assign({
|
|
112
119
|
// optimize(2024-07-01~)
|
|
113
|
-
recipient, object: aciton4inform, id, typeOf: factory.actionType.InformAction }, (typeof (purpose === null || purpose === void 0 ? void 0 : purpose.typeOf) === 'string') ? { purpose } : undefined)
|
|
120
|
+
recipient, object: aciton4inform, id, typeOf: factory.actionType.InformAction }, (typeof (purpose === null || purpose === void 0 ? void 0 : purpose.typeOf) === 'string') ? { purpose } : undefined), (typeof (about === null || about === void 0 ? void 0 : about.typeOf) === 'string') ? { about } : undefined // add(2025-02-14~)
|
|
121
|
+
);
|
|
114
122
|
}
|
|
115
123
|
else {
|
|
116
124
|
throw new factory.errors.ArgumentNull('potentialActions.informPayment.id'); // 2025-02-09~
|
|
@@ -10,10 +10,12 @@ import type { AuthorizationRepo } from '../../repo/authorization';
|
|
|
10
10
|
import type { ConfirmationNumberRepo } from '../../repo/confirmationNumber';
|
|
11
11
|
import type { CredentialsRepo } from '../../repo/credentials';
|
|
12
12
|
import type { EventRepo } from '../../repo/event';
|
|
13
|
+
import type { OrderNumberRepo } from '../../repo/orderNumber';
|
|
13
14
|
import type { PaymentServiceRepo } from '../../repo/paymentService';
|
|
14
15
|
import type { PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
15
16
|
import type { PotentialActionRepo } from '../../repo/potentialAction';
|
|
16
17
|
import type { ProductRepo } from '../../repo/product';
|
|
18
|
+
import type { ProjectRepo } from '../../repo/project';
|
|
17
19
|
import type { SellerPaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
|
|
18
20
|
import type { TaskRepo } from '../../repo/task';
|
|
19
21
|
import type { TicketRepo } from '../../repo/ticket';
|
|
@@ -81,11 +83,13 @@ interface IAuthorizeRepos {
|
|
|
81
83
|
confirmationNumber: ConfirmationNumberRepo;
|
|
82
84
|
credentials: CredentialsRepo;
|
|
83
85
|
event: EventRepo;
|
|
86
|
+
orderNumber: OrderNumberRepo;
|
|
84
87
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
85
88
|
paymentService: PaymentServiceRepo;
|
|
86
89
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
87
90
|
potentialAction: PotentialActionRepo;
|
|
88
91
|
product: ProductRepo;
|
|
92
|
+
project: ProjectRepo;
|
|
89
93
|
task: TaskRepo;
|
|
90
94
|
ticket: TicketRepo;
|
|
91
95
|
transaction: TransactionRepo;
|
|
@@ -24,7 +24,7 @@ exports.publishPaymentUrl = publishPaymentUrl;
|
|
|
24
24
|
const factory = require("../../factory");
|
|
25
25
|
const PayTransactionService = require("../assetTransaction/pay");
|
|
26
26
|
const factory_1 = require("./any/factory");
|
|
27
|
-
const
|
|
27
|
+
const fixOrderAsNeeded_1 = require("./any/fixOrderAsNeeded");
|
|
28
28
|
const handlePrePublishedPaymentMethodIdOnAuthorizing_1 = require("./any/handlePrePublishedPaymentMethodIdOnAuthorizing");
|
|
29
29
|
const onPaymentStatusChanged_1 = require("./any/onPaymentStatusChanged");
|
|
30
30
|
Object.defineProperty(exports, "onPaymentStatusChanged", { enumerable: true, get: function () { return onPaymentStatusChanged_1.onPaymentStatusChanged; } });
|
|
@@ -315,18 +315,18 @@ function minimizeObjectIncludingPaymentMethodDetails(authorizeObjectIncludingPay
|
|
|
315
315
|
*/
|
|
316
316
|
function authorize(params) {
|
|
317
317
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
318
|
-
return (repos, settings
|
|
319
|
-
// credentials: {
|
|
320
|
-
// jwt: JWTCredentials;
|
|
321
|
-
// }
|
|
322
|
-
) => __awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
323
319
|
var _a, _b;
|
|
324
320
|
const { paymentServiceType, purpose, project } = params;
|
|
325
321
|
if (purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
326
322
|
throw new factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
327
323
|
}
|
|
328
324
|
const transaction = yield repos.transaction.projectFieldsInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['agent', 'expires', 'typeOf', 'project', 'seller']);
|
|
329
|
-
const { confirmationNumber } = yield (0,
|
|
325
|
+
const { confirmationNumber, orderNumber } = yield (0, fixOrderAsNeeded_1.fixOrderAsNeeded)({
|
|
326
|
+
project: { id: transaction.project.id },
|
|
327
|
+
purpose,
|
|
328
|
+
paymentServiceType
|
|
329
|
+
})(repos);
|
|
330
330
|
// 取引番号生成
|
|
331
331
|
let transactionNumber;
|
|
332
332
|
let pendingPaymentAgencyTransaction;
|
|
@@ -416,7 +416,9 @@ function authorize(params) {
|
|
|
416
416
|
transaction: transaction,
|
|
417
417
|
transactionNumber: transactionNumber,
|
|
418
418
|
location: params.location,
|
|
419
|
-
|
|
419
|
+
// confirmationNumber required(2025-02-12~)
|
|
420
|
+
// orderNumber required(2025-02-14~)
|
|
421
|
+
order: { confirmationNumber, orderNumber }
|
|
420
422
|
});
|
|
421
423
|
payTransaction = yield PayTransactionService.start(startParams, Object.assign({
|
|
422
424
|
// useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet,
|
|
@@ -21,7 +21,7 @@ const validation_1 = require("./validation");
|
|
|
21
21
|
// tslint:disable-next-line:max-func-body-length
|
|
22
22
|
function authorize(params, transaction, paymentServiceId, options) {
|
|
23
23
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
var _a, _b, _c;
|
|
24
|
+
var _a, _b, _c, _d;
|
|
25
25
|
let accountId;
|
|
26
26
|
let accountsReceivablesByServiceType = [];
|
|
27
27
|
try {
|
|
@@ -58,16 +58,21 @@ function authorize(params, transaction, paymentServiceId, options) {
|
|
|
58
58
|
typeOf: transaction.recipient.typeOf
|
|
59
59
|
};
|
|
60
60
|
const confirmationNumber = (_b = params.purpose) === null || _b === void 0 ? void 0 : _b.confirmationNumber;
|
|
61
|
+
const orderNumber = (_c = params.purpose) === null || _c === void 0 ? void 0 : _c.orderNumber;
|
|
61
62
|
if (typeof confirmationNumber !== 'string' || confirmationNumber === '') {
|
|
62
63
|
throw new factory.errors.ArgumentNull('purpose.confirmationNumber');
|
|
63
64
|
}
|
|
65
|
+
if (typeof orderNumber !== 'string' || orderNumber === '') {
|
|
66
|
+
throw new factory.errors.ArgumentNull('purpose.orderNumber');
|
|
67
|
+
}
|
|
64
68
|
const purpose = {
|
|
65
69
|
confirmationNumber,
|
|
70
|
+
orderNumber, // required(2025-02-14~)
|
|
66
71
|
typeOf: factory.order.OrderType.Order
|
|
67
72
|
};
|
|
68
73
|
const payActionAttributes = Object.assign({ project: transaction.project, typeOf: factory.actionType.PayAction, object: [payObject], agent: transaction.project, recipient,
|
|
69
74
|
instrument,
|
|
70
|
-
purpose }, (typeof ((
|
|
75
|
+
purpose }, (typeof ((_d = options.executor) === null || _d === void 0 ? void 0 : _d.id) === 'string')
|
|
71
76
|
? { sameAs: { id: options.executor.id, typeOf: 'Task' } } // link sameAs(2024-06-04~)
|
|
72
77
|
: undefined);
|
|
73
78
|
// callOnPayActionCompleted: false(2025-02-10~)
|
|
@@ -18,10 +18,12 @@ const authorization_1 = require("../../repo/authorization");
|
|
|
18
18
|
const confirmationNumber_1 = require("../../repo/confirmationNumber");
|
|
19
19
|
const credentials_1 = require("../../repo/credentials");
|
|
20
20
|
const event_1 = require("../../repo/event");
|
|
21
|
+
const orderNumber_1 = require("../../repo/orderNumber");
|
|
21
22
|
const paymentService_1 = require("../../repo/paymentService");
|
|
22
23
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
23
24
|
const potentialAction_1 = require("../../repo/potentialAction");
|
|
24
25
|
const product_1 = require("../../repo/product");
|
|
26
|
+
const project_1 = require("../../repo/project");
|
|
25
27
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
26
28
|
const task_1 = require("../../repo/task");
|
|
27
29
|
const ticket_1 = require("../../repo/ticket");
|
|
@@ -37,9 +39,6 @@ function call(params) {
|
|
|
37
39
|
if (redisClient === undefined) {
|
|
38
40
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
39
41
|
}
|
|
40
|
-
// if (credentials.jwt === undefined) {
|
|
41
|
-
// throw new factory.errors.Argument('settings', 'jwtCredentials required');
|
|
42
|
-
// }
|
|
43
42
|
// 遅延実行(executeByName)には対応しない
|
|
44
43
|
if (!options.executeById) {
|
|
45
44
|
return;
|
|
@@ -64,19 +63,19 @@ function call(params) {
|
|
|
64
63
|
expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
|
|
65
64
|
}),
|
|
66
65
|
event: new event_1.EventRepo(connection),
|
|
66
|
+
orderNumber: new orderNumber_1.OrderNumberRepo(redisClient),
|
|
67
67
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
68
68
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
69
69
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
70
70
|
potentialAction: new potentialAction_1.PotentialActionRepo(connection),
|
|
71
71
|
product: new product_1.ProductRepo(connection),
|
|
72
|
+
project: new project_1.ProjectRepo(connection),
|
|
72
73
|
task: new task_1.TaskRepo(connection),
|
|
73
74
|
ticket: new ticket_1.TicketRepo(connection),
|
|
74
75
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
75
76
|
transactionNumber: new transactionNumber_1.TransactionNumberRepo(redisClient),
|
|
76
77
|
transactionProcess: transactionProcessRepo
|
|
77
|
-
}, settings
|
|
78
|
-
// { jwt: credentials.jwt }
|
|
79
|
-
);
|
|
78
|
+
}, settings);
|
|
80
79
|
}
|
|
81
80
|
catch (error) {
|
|
82
81
|
let throwsError = true;
|
|
@@ -10,7 +10,5 @@ const confirm_1 = require("./placeOrder/confirm");
|
|
|
10
10
|
Object.defineProperty(exports, "confirm", { enumerable: true, get: function () { return confirm_1.confirm; } });
|
|
11
11
|
const exportTasksById_1 = require("./placeOrder/exportTasksById");
|
|
12
12
|
Object.defineProperty(exports, "exportTasksById", { enumerable: true, get: function () { return exportTasksById_1.exportTasksById; } });
|
|
13
|
-
// import { publishConfirmationNumberIfNotExist } from './placeOrder/publishConfirmationNumberIfNotExist';
|
|
14
|
-
// import { publishOrderNumberIfNotExist } from './placeOrder/publishOrderNumberIfNotExist';
|
|
15
13
|
const start_1 = require("./placeOrder/start");
|
|
16
14
|
Object.defineProperty(exports, "start", { enumerable: true, get: function () { return start_1.start; } });
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
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.393.0-alpha.
|
|
15
|
-
"@cinerino/sdk": "10.21.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.393.0-alpha.16",
|
|
15
|
+
"@cinerino/sdk": "10.21.0-alpha.15",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
18
18
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"postversion": "git push origin --tags",
|
|
113
113
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
114
114
|
},
|
|
115
|
-
"version": "22.9.0-alpha.
|
|
115
|
+
"version": "22.9.0-alpha.22"
|
|
116
116
|
}
|