@chevre/domain 25.2.0-alpha.25 → 25.2.0-alpha.27
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/factory/customerTelephone2COATelNum.d.ts +3 -0
- package/lib/chevre/factory/customerTelephone2COATelNum.js +23 -0
- package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
- package/lib/chevre/repo/action/acceptPay.js +47 -19
- package/lib/chevre/repo/person.d.ts +0 -15
- package/lib/chevre/repo/person.js +122 -108
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -6
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +3 -1
- package/lib/chevre/service/payment/any/findAcceptAction.js +14 -6
- package/lib/chevre/service/reserve/searchByOrder.js +2 -6
- package/lib/chevre/service/task/confirmReserveTransaction.js +2 -7
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +2 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +19 -9
- package/package.json +5 -4
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customerTelephone2COATelNum = customerTelephone2COATelNum;
|
|
4
|
+
// import { PhoneNumberFormat, PhoneNumberUtil } from 'google-libphonenumber';
|
|
5
|
+
const libphonenumber_js_1 = require("libphonenumber-js");
|
|
6
|
+
const factory_1 = require("../factory");
|
|
7
|
+
function customerTelephone2COATelNum(params) {
|
|
8
|
+
const { telephone } = params;
|
|
9
|
+
// 電話番号のフォーマットを日本人にリーダブルに調整(COAではこのフォーマットで扱うので)
|
|
10
|
+
// const phoneUtil = PhoneNumberUtil.getInstance();
|
|
11
|
+
// const phoneNumber = phoneUtil.parse(telephone, 'JP');
|
|
12
|
+
// let telNum = phoneUtil.format(phoneNumber, PhoneNumberFormat.NATIONAL);
|
|
13
|
+
const phoneNumber = (0, libphonenumber_js_1.parsePhoneNumberFromString)(telephone, 'JP');
|
|
14
|
+
// isValid検証はgoogle-libphonenumber時代にしていなかったため、ひとまずなし
|
|
15
|
+
// if (phoneNumber === undefined || !phoneNumber.isValid()) {
|
|
16
|
+
if (phoneNumber === undefined) {
|
|
17
|
+
throw new factory_1.factory.errors.Internal(`phoneNumber undefined. telephone: ${telephone}`);
|
|
18
|
+
}
|
|
19
|
+
let telNum = phoneNumber.format('NATIONAL');
|
|
20
|
+
// COAでは数字のみ受け付けるので数字以外を除去
|
|
21
|
+
telNum = telNum.replace(/[^\d]/g, '');
|
|
22
|
+
return telNum;
|
|
23
|
+
}
|
|
@@ -37,4 +37,19 @@ export declare class AcceptPayActionRepo extends ActionProcessRepo<IAcceptPayAct
|
|
|
37
37
|
transactionNumber: string;
|
|
38
38
|
};
|
|
39
39
|
}, inclusion: IKeyOfProjection[]): Promise<IAcceptPayAction[]>;
|
|
40
|
+
/**
|
|
41
|
+
* アクションIDからレシピのafterMediaを参照する
|
|
42
|
+
*/
|
|
43
|
+
findPaymentUrlById(params: {
|
|
44
|
+
project: {
|
|
45
|
+
id: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* アクションID
|
|
49
|
+
*/
|
|
50
|
+
id: string;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
paymentMethodId: string;
|
|
53
|
+
paymentUrl?: string;
|
|
54
|
+
}>;
|
|
40
55
|
}
|
|
@@ -29,25 +29,6 @@ class AcceptPayActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
29
29
|
...(typeof limit === 'number') ? { limit } : undefined,
|
|
30
30
|
...(typeof page === 'number') ? { page } : undefined,
|
|
31
31
|
}, inclusion);
|
|
32
|
-
// const andConditions: FilterQuery<IAcceptPayAction>[] = [
|
|
33
|
-
// { typeOf: { $eq: factory.actionType.AcceptAction } },
|
|
34
|
-
// { 'project.id': { $eq: params.project.id } },
|
|
35
|
-
// { 'object.typeOf': { $exists: true, $eq: factory.assetTransactionType.Pay } },
|
|
36
|
-
// { 'purpose.id': { $exists: true, $eq: params.purpose.id } }
|
|
37
|
-
// ];
|
|
38
|
-
// let positiveProjectionFields: IKeyOfProjection[] = AVAILABLE_PROJECT_FIELDS;
|
|
39
|
-
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
40
|
-
// positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
41
|
-
// }
|
|
42
|
-
// const projection: ProjectionType<IAcceptPayAction> = {
|
|
43
|
-
// _id: 0,
|
|
44
|
-
// id: { $toString: '$_id' },
|
|
45
|
-
// ...Object.fromEntries<1>(positiveProjectionFields.map((key) => ([key, 1])))
|
|
46
|
-
// };
|
|
47
|
-
// const query = this.actionModel.find({ $and: andConditions }, projection);
|
|
48
|
-
// return query.setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
49
|
-
// .lean<IAcceptPayAction[]>()
|
|
50
|
-
// .exec();
|
|
51
32
|
}
|
|
52
33
|
/**
|
|
53
34
|
* 決済取引番号から完了済の決済採用アクションを参照する
|
|
@@ -66,5 +47,52 @@ class AcceptPayActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
66
47
|
}
|
|
67
48
|
}, inclusion);
|
|
68
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* アクションIDからレシピのafterMediaを参照する
|
|
52
|
+
*/
|
|
53
|
+
async findPaymentUrlById(params) {
|
|
54
|
+
const acceptActionWithResult = await this.actionModel.findOne({
|
|
55
|
+
typeOf: { $eq: factory_1.factory.actionType.AcceptAction }, // 採用アクション
|
|
56
|
+
_id: { $eq: params.id }
|
|
57
|
+
}, {
|
|
58
|
+
_id: 0,
|
|
59
|
+
result: 1,
|
|
60
|
+
object: 1
|
|
61
|
+
})
|
|
62
|
+
.lean() // 2024-08-26~
|
|
63
|
+
.exec();
|
|
64
|
+
if (acceptActionWithResult === null) {
|
|
65
|
+
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
66
|
+
}
|
|
67
|
+
const paymentMethodId = acceptActionWithResult.object.transactionNumber;
|
|
68
|
+
// アクション未完了であればpaymentMethodIdだけ返す
|
|
69
|
+
if (acceptActionWithResult.result === undefined) {
|
|
70
|
+
return { paymentMethodId };
|
|
71
|
+
}
|
|
72
|
+
const recipe = await this.actionRecipeModel.findOne({
|
|
73
|
+
'project.id': { $eq: params.project.id },
|
|
74
|
+
'recipeFor.id': { $eq: params.id }
|
|
75
|
+
}, {
|
|
76
|
+
_id: 0,
|
|
77
|
+
step: 1
|
|
78
|
+
})
|
|
79
|
+
.lean()
|
|
80
|
+
.exec();
|
|
81
|
+
const afterMedia = recipe?.step[0]?.itemListElement[1]?.itemListElement[0]?.afterMedia;
|
|
82
|
+
let paymentUrl;
|
|
83
|
+
// 3DS拡張(2024-01-02~)
|
|
84
|
+
const retUrl = acceptActionWithResult.object.object.paymentMethod.creditCard?.retUrl;
|
|
85
|
+
if (typeof retUrl === 'string' && retUrl.length > 0) {
|
|
86
|
+
paymentUrl = afterMedia?.redirectUrl;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
paymentUrl = afterMedia?.acsUrl;
|
|
90
|
+
}
|
|
91
|
+
// アクション完了済であれば、レシピからpaymentUrlを必ず参照できるはず
|
|
92
|
+
if (typeof paymentUrl !== 'string' || paymentUrl === '') {
|
|
93
|
+
throw new factory_1.factory.errors.Internal(`Payment URL unable to publish. [retUrl: ${retUrl}]`);
|
|
94
|
+
}
|
|
95
|
+
return { paymentMethodId, paymentUrl };
|
|
96
|
+
}
|
|
69
97
|
}
|
|
70
98
|
exports.AcceptPayActionRepo = AcceptPayActionRepo;
|
|
@@ -21,20 +21,12 @@ export declare class PersonRepo {
|
|
|
21
21
|
userPoolId?: string;
|
|
22
22
|
attributes?: AttributeType[];
|
|
23
23
|
}): factory.person.IPerson;
|
|
24
|
-
static PROFILE2ATTRIBUTE(params: factory.person.IProfile): AttributeType[];
|
|
25
24
|
/**
|
|
26
25
|
* 管理者権限でユーザー属性を取得する
|
|
27
26
|
*/
|
|
28
27
|
getUserAttributes(params: {
|
|
29
28
|
username: string;
|
|
30
29
|
}): Promise<factory.person.IProfile>;
|
|
31
|
-
/**
|
|
32
|
-
* 管理者権限でプロフィール更新
|
|
33
|
-
*/
|
|
34
|
-
updateProfile(params: {
|
|
35
|
-
username: string;
|
|
36
|
-
profile: factory.person.IProfile;
|
|
37
|
-
}): Promise<void>;
|
|
38
30
|
/**
|
|
39
31
|
* 管理者権限でsubでユーザーを検索する
|
|
40
32
|
*/
|
|
@@ -45,13 +37,6 @@ export declare class PersonRepo {
|
|
|
45
37
|
* アクセストークンでユーザー属性を取得する
|
|
46
38
|
*/
|
|
47
39
|
getUserAttributesByAccessToken(accessToken: string): Promise<factory.person.IProfile>;
|
|
48
|
-
/**
|
|
49
|
-
* 会員プロフィール更新
|
|
50
|
-
*/
|
|
51
|
-
updateProfileByAccessToken(params: {
|
|
52
|
-
accessToken: string;
|
|
53
|
-
profile: factory.person.IProfile;
|
|
54
|
-
}): Promise<void>;
|
|
55
40
|
/**
|
|
56
41
|
* 削除
|
|
57
42
|
*/
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PersonRepo = void 0;
|
|
4
|
-
// import { fromEnv } from '@aws-sdk/credential-providers';
|
|
5
|
-
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
6
4
|
const factory_1 = require("../factory");
|
|
7
5
|
/**
|
|
8
6
|
* 会員リポジトリ
|
|
@@ -92,73 +90,81 @@ class PersonRepo {
|
|
|
92
90
|
}
|
|
93
91
|
return person;
|
|
94
92
|
}
|
|
95
|
-
static PROFILE2ATTRIBUTE(params) {
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
93
|
+
// public static PROFILE2ATTRIBUTE(params: factory.person.IProfile): AttributeType[] {
|
|
94
|
+
// let formatedPhoneNumber: string | undefined;
|
|
95
|
+
// if (typeof params.telephone === 'string' && params.telephone.length > 0) {
|
|
96
|
+
// try {
|
|
97
|
+
// // const phoneUtil = PhoneNumberUtil.getInstance();
|
|
98
|
+
// // const phoneNumber = phoneUtil.parse(params.telephone);
|
|
99
|
+
// // /* istanbul ignore if */
|
|
100
|
+
// // if (!phoneUtil.isValidNumber(phoneNumber)) {
|
|
101
|
+
// // throw new factory.errors.Argument('telephone', 'Invalid phone number');
|
|
102
|
+
// // }
|
|
103
|
+
// // formatedPhoneNumber = phoneUtil.format(phoneNumber, PhoneNumberFormat.E164);
|
|
104
|
+
// const phoneNumber = parsePhoneNumberFromString(params.telephone);
|
|
105
|
+
// if (phoneNumber === undefined || !phoneNumber.isValid()) {
|
|
106
|
+
// throw new factory.errors.Argument('telephone', 'Invalid phone number');
|
|
107
|
+
// }
|
|
108
|
+
// formatedPhoneNumber = phoneNumber.format('E.164');
|
|
109
|
+
// } catch (_error) {
|
|
110
|
+
// throw new factory.errors.Argument('telephone', 'Invalid phone number');
|
|
111
|
+
// }
|
|
112
|
+
// }
|
|
113
|
+
// const userAttributes: AttributeType[] = [];
|
|
114
|
+
// if (typeof params.givenName === 'string') {
|
|
115
|
+
// userAttributes.push({
|
|
116
|
+
// Name: 'given_name',
|
|
117
|
+
// Value: params.givenName
|
|
118
|
+
// });
|
|
119
|
+
// }
|
|
120
|
+
// if (typeof params.familyName === 'string') {
|
|
121
|
+
// userAttributes.push({
|
|
122
|
+
// Name: 'family_name',
|
|
123
|
+
// Value: params.familyName
|
|
124
|
+
// });
|
|
125
|
+
// }
|
|
126
|
+
// if (typeof params.email === 'string') {
|
|
127
|
+
// userAttributes.push({
|
|
128
|
+
// Name: 'email',
|
|
129
|
+
// Value: params.email
|
|
130
|
+
// });
|
|
131
|
+
// }
|
|
132
|
+
// if (typeof formatedPhoneNumber === 'string') {
|
|
133
|
+
// userAttributes.push({
|
|
134
|
+
// Name: 'phone_number',
|
|
135
|
+
// Value: formatedPhoneNumber
|
|
136
|
+
// });
|
|
137
|
+
// }
|
|
138
|
+
// if (Array.isArray(params.additionalProperty)) {
|
|
139
|
+
// userAttributes.push(...params.additionalProperty.map((a) => {
|
|
140
|
+
// let userAttributesValue: string = a.value;
|
|
141
|
+
// // custom:telephoneに関してもtelephoneと同様のバリデーションを追加
|
|
142
|
+
// if (a.name === 'custom:telephone') {
|
|
143
|
+
// try {
|
|
144
|
+
// // const phoneUtil = PhoneNumberUtil.getInstance();
|
|
145
|
+
// // const phoneNumber = phoneUtil.parse(String(a.value));
|
|
146
|
+
// // /* istanbul ignore if */
|
|
147
|
+
// // if (!phoneUtil.isValidNumber(phoneNumber)) {
|
|
148
|
+
// // throw new factory.errors.Argument('custom:telephone', 'Invalid phone number');
|
|
149
|
+
// // }
|
|
150
|
+
// // userAttributesValue = phoneUtil.format(phoneNumber, PhoneNumberFormat.E164);
|
|
151
|
+
// const phoneNumber = parsePhoneNumberFromString(String(a.value));
|
|
152
|
+
// if (phoneNumber === undefined || !phoneNumber.isValid()) {
|
|
153
|
+
// throw new factory.errors.Argument('telephone', 'Invalid phone number');
|
|
154
|
+
// }
|
|
155
|
+
// userAttributesValue = phoneNumber.format('E.164');
|
|
156
|
+
// } catch (_error) {
|
|
157
|
+
// throw new factory.errors.Argument('custome:telephone', 'Invalid phone number');
|
|
158
|
+
// }
|
|
159
|
+
// }
|
|
160
|
+
// return {
|
|
161
|
+
// Name: a.name,
|
|
162
|
+
// Value: userAttributesValue
|
|
163
|
+
// };
|
|
164
|
+
// }));
|
|
165
|
+
// }
|
|
166
|
+
// return userAttributes;
|
|
167
|
+
// }
|
|
162
168
|
/**
|
|
163
169
|
* 管理者権限でユーザー属性を取得する
|
|
164
170
|
*/
|
|
@@ -177,26 +183,30 @@ class PersonRepo {
|
|
|
177
183
|
});
|
|
178
184
|
});
|
|
179
185
|
}
|
|
180
|
-
/**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
async updateProfile(params
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
186
|
+
// /**
|
|
187
|
+
// * 管理者権限でプロフィール更新
|
|
188
|
+
// */
|
|
189
|
+
// public async updateProfile(params: {
|
|
190
|
+
// username: string;
|
|
191
|
+
// profile: factory.person.IProfile;
|
|
192
|
+
// }): Promise<void> {
|
|
193
|
+
// return new Promise<void>((resolve, reject) => {
|
|
194
|
+
// const userAttributes = PersonRepo.PROFILE2ATTRIBUTE(params.profile);
|
|
195
|
+
// this.cognitoIdentityServiceProvider.adminUpdateUserAttributes(
|
|
196
|
+
// {
|
|
197
|
+
// UserPoolId: this.userPoolId,
|
|
198
|
+
// Username: params.username,
|
|
199
|
+
// UserAttributes: userAttributes
|
|
200
|
+
// },
|
|
201
|
+
// (err) => {
|
|
202
|
+
// if (err instanceof Error) {
|
|
203
|
+
// reject(new factory.errors.Argument('profile', err.message));
|
|
204
|
+
// } else {
|
|
205
|
+
// resolve();
|
|
206
|
+
// }
|
|
207
|
+
// });
|
|
208
|
+
// });
|
|
209
|
+
// }
|
|
200
210
|
/**
|
|
201
211
|
* 管理者権限でsubでユーザーを検索する
|
|
202
212
|
*/
|
|
@@ -249,25 +259,29 @@ class PersonRepo {
|
|
|
249
259
|
});
|
|
250
260
|
});
|
|
251
261
|
}
|
|
252
|
-
/**
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
async updateProfileByAccessToken(params
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
262
|
+
// /**
|
|
263
|
+
// * 会員プロフィール更新
|
|
264
|
+
// */
|
|
265
|
+
// public async updateProfileByAccessToken(params: {
|
|
266
|
+
// accessToken: string;
|
|
267
|
+
// profile: factory.person.IProfile;
|
|
268
|
+
// }): Promise<void> {
|
|
269
|
+
// return new Promise<void>((resolve, reject) => {
|
|
270
|
+
// const userAttributes = PersonRepo.PROFILE2ATTRIBUTE(params.profile);
|
|
271
|
+
// this.cognitoIdentityServiceProvider.updateUserAttributes(
|
|
272
|
+
// {
|
|
273
|
+
// AccessToken: params.accessToken,
|
|
274
|
+
// UserAttributes: userAttributes
|
|
275
|
+
// },
|
|
276
|
+
// (err) => {
|
|
277
|
+
// if (err instanceof Error) {
|
|
278
|
+
// reject(new factory.errors.Argument('profile', err.message));
|
|
279
|
+
// } else {
|
|
280
|
+
// resolve();
|
|
281
|
+
// }
|
|
282
|
+
// });
|
|
283
|
+
// });
|
|
284
|
+
// }
|
|
271
285
|
/**
|
|
272
286
|
* 削除
|
|
273
287
|
*/
|
|
@@ -167,7 +167,7 @@ function publishPaymentUrl(params, options) {
|
|
|
167
167
|
}
|
|
168
168
|
const actionResult = {
|
|
169
169
|
paymentMethodId: result.paymentMethodId,
|
|
170
|
-
paymentUrl: result.paymentUrl
|
|
170
|
+
// paymentUrl: result.paymentUrl // result.paymentUrlは廃止(2026-07-14~)
|
|
171
171
|
};
|
|
172
172
|
await repos.acceptPayAction.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result: actionResult, recipe });
|
|
173
173
|
return result;
|
|
@@ -8,7 +8,7 @@ exports.onOrderReturned = onOrderReturned;
|
|
|
8
8
|
* 注文返品時処理
|
|
9
9
|
*/
|
|
10
10
|
const debug_1 = __importDefault(require("debug"));
|
|
11
|
-
const
|
|
11
|
+
const customerTelephone2COATelNum_1 = require("../../../factory/customerTelephone2COATelNum");
|
|
12
12
|
const factory_1 = require("../../../factory");
|
|
13
13
|
// import { createMaskedCustomer } from '../../../factory/order';
|
|
14
14
|
const factory_2 = require("./onOrderReturned/factory");
|
|
@@ -104,11 +104,7 @@ function createReturnReserveTransactionTasks(order, simpleOrder) {
|
|
|
104
104
|
if (typeof superEventLocationBranchCode !== 'string') {
|
|
105
105
|
throw new factory_1.factory.errors.ArgumentNull('order.reservationForSuperEventLocationBranchCodes');
|
|
106
106
|
}
|
|
107
|
-
const
|
|
108
|
-
const phoneNumber = phoneUtil.parse(order.customer.telephone, 'JP');
|
|
109
|
-
let telNum = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.NATIONAL);
|
|
110
|
-
// COAでは数字のみ受け付けるので数字以外を除去
|
|
111
|
-
telNum = telNum.replace(/[^\d]/g, '');
|
|
107
|
+
const telNum = (0, customerTelephone2COATelNum_1.customerTelephone2COATelNum)({ telephone: String(order.customer.telephone) });
|
|
112
108
|
returnReserveTransactionAction = {
|
|
113
109
|
project: order.project,
|
|
114
110
|
typeOf: factory_1.factory.actionType.ReturnAction,
|
|
@@ -18,7 +18,9 @@ interface IFindAcceptActionResult {
|
|
|
18
18
|
name?: string;
|
|
19
19
|
message?: string;
|
|
20
20
|
};
|
|
21
|
-
result?: factory.action.accept.pay.IResult
|
|
21
|
+
result?: Pick<factory.action.accept.pay.IResult, 'paymentMethodId'> & {
|
|
22
|
+
paymentUrl: string;
|
|
23
|
+
};
|
|
22
24
|
}
|
|
23
25
|
declare function findAcceptAction(params: {
|
|
24
26
|
project: {
|
|
@@ -42,12 +42,20 @@ function findAcceptAction(params) {
|
|
|
42
42
|
if (acceptAction.purpose?.id !== params.purpose.id) {
|
|
43
43
|
throw new factory_1.factory.errors.NotFound('Action');
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
// result.paymentUrl廃止につき、paymentUrlはrecipeを参照する(2026-07-14~)
|
|
46
|
+
// const acceptActionWithResult = await repos.acceptPayAction.findById(
|
|
47
|
+
// { id: acceptAction.id, typeOf: factory.actionType.AcceptAction },
|
|
48
|
+
// ['result', 'object'],
|
|
49
|
+
// []
|
|
50
|
+
// ) as Pick<factory.action.accept.pay.IAction, 'result' | 'object'>;
|
|
51
|
+
const acceptPayResult = await repos.acceptPayAction.findPaymentUrlById({
|
|
52
|
+
project: { id: params.project.id },
|
|
53
|
+
id: acceptAction.id
|
|
54
|
+
});
|
|
46
55
|
action = {
|
|
47
56
|
id: acceptAction.id,
|
|
48
57
|
actionStatus: acceptAction.actionStatus,
|
|
49
|
-
// add object.transactionNumber(2025-08-26~)
|
|
50
|
-
object: { transactionNumber: acceptActionWithResult.object.transactionNumber },
|
|
58
|
+
object: { transactionNumber: acceptPayResult.paymentMethodId }, // add object.transactionNumber(2025-08-26~)
|
|
51
59
|
...(acceptAction.error !== undefined)
|
|
52
60
|
? {
|
|
53
61
|
error: (Array.isArray(acceptAction.error))
|
|
@@ -55,11 +63,11 @@ function findAcceptAction(params) {
|
|
|
55
63
|
: acceptAction.error
|
|
56
64
|
}
|
|
57
65
|
: undefined,
|
|
58
|
-
...(
|
|
66
|
+
...(typeof acceptPayResult.paymentUrl === 'string')
|
|
59
67
|
? {
|
|
60
68
|
result: {
|
|
61
|
-
paymentMethodId:
|
|
62
|
-
paymentUrl:
|
|
69
|
+
paymentMethodId: acceptPayResult.paymentMethodId,
|
|
70
|
+
paymentUrl: acceptPayResult.paymentUrl
|
|
63
71
|
}
|
|
64
72
|
}
|
|
65
73
|
: undefined
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.searchByOrder = searchByOrder;
|
|
4
|
-
const
|
|
4
|
+
const customerTelephone2COATelNum_1 = require("../../factory/customerTelephone2COATelNum");
|
|
5
5
|
const factory_1 = require("../../factory");
|
|
6
6
|
function searchByOrder(params) {
|
|
7
7
|
return async (repos) => {
|
|
@@ -42,11 +42,7 @@ function searchByOrder(params) {
|
|
|
42
42
|
if (order === undefined) {
|
|
43
43
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.order.OrderType.Order);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
const phoneNumber = phoneUtil.parse(order.customer.telephone, 'JP');
|
|
47
|
-
let telNum = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.NATIONAL);
|
|
48
|
-
// COAでは数字のみ受け付けるので数字以外を除去
|
|
49
|
-
telNum = telNum.replace(/[^\d]/g, '');
|
|
45
|
+
const telNum = (0, customerTelephone2COATelNum_1.customerTelephone2COATelNum)({ telephone: String(order.customer.telephone) });
|
|
50
46
|
const reservationNumber = (await repos.acceptedOffer.distinctValues({
|
|
51
47
|
orderNumber: { $in: [params.orderNumber] }
|
|
52
48
|
}, 'acceptedOffers.itemOffered.reservationNumber')).shift();
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.call = call;
|
|
4
4
|
exports.confirmReserveTransaction = confirmReserveTransaction;
|
|
5
5
|
const coa_service_1 = require("@motionpicture/coa-service");
|
|
6
|
-
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
7
6
|
const util_1 = require("util");
|
|
7
|
+
const customerTelephone2COATelNum_1 = require("../../factory/customerTelephone2COATelNum");
|
|
8
8
|
const factory_1 = require("../../factory");
|
|
9
9
|
const confirm_1 = require("../assetTransaction/reserve/confirm");
|
|
10
10
|
const reserveCOA_1 = require("../assetTransaction/reserveCOA");
|
|
@@ -71,12 +71,7 @@ function createConfirmObject4COAByOrder(params) {
|
|
|
71
71
|
&& o.offeredThrough?.identifier === factory_1.factory.service.webAPI.Identifier.COA;
|
|
72
72
|
});
|
|
73
73
|
const customer = params.order.customer;
|
|
74
|
-
|
|
75
|
-
const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
76
|
-
const phoneNumber = phoneUtil.parse(customer.telephone, 'JP');
|
|
77
|
-
let telNum = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.NATIONAL);
|
|
78
|
-
// COAでは数字のみ受け付けるので数字以外を除去
|
|
79
|
-
telNum = telNum.replace(/[^\d]/g, '');
|
|
74
|
+
const telNum = (0, customerTelephone2COATelNum_1.customerTelephone2COATelNum)({ telephone: String(customer.telephone) });
|
|
80
75
|
const mailAddr = customer.email;
|
|
81
76
|
if (mailAddr === undefined) {
|
|
82
77
|
throw new factory_1.factory.errors.Argument('order', 'order.customer.email undefined');
|
|
@@ -115,8 +115,8 @@ function validatePaymentUrl(params) {
|
|
|
115
115
|
// check existing accept action(2025-02-26~)
|
|
116
116
|
const acceptActionExists = acceptPayActions.some(({ object, result }) => {
|
|
117
117
|
return object.transactionNumber === paymentMethodId
|
|
118
|
-
&& result?.paymentMethodId === paymentMethodId
|
|
119
|
-
|
|
118
|
+
&& result?.paymentMethodId === paymentMethodId;
|
|
119
|
+
// && typeof result?.paymentUrl === 'string'; // result.paymentUrlは廃止(2026-07-14~)
|
|
120
120
|
});
|
|
121
121
|
debug('validatePaymentUrl: acceptActionExists:', acceptActionExists);
|
|
122
122
|
if (!acceptActionExists) {
|
|
@@ -13,6 +13,8 @@ export declare function updateAgent(params: {
|
|
|
13
13
|
agent: factory.order.ICustomer & {
|
|
14
14
|
telephoneRegion?: string;
|
|
15
15
|
};
|
|
16
|
+
}, options: {
|
|
17
|
+
useLibphonenumber: boolean;
|
|
16
18
|
}): (repos: {
|
|
17
19
|
orderInTransaction: OrderInTransactionRepo;
|
|
18
20
|
placeOrder: PlaceOrderRepo;
|
|
@@ -2,17 +2,28 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateAgent = updateAgent;
|
|
4
4
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
5
|
+
const libphonenumber_js_1 = require("libphonenumber-js");
|
|
5
6
|
const factory_1 = require("../../../factory");
|
|
6
|
-
function fixCustomer(params) {
|
|
7
|
+
function fixCustomer(params, options) {
|
|
7
8
|
return async (repos) => {
|
|
9
|
+
const { useLibphonenumber } = options;
|
|
8
10
|
let formattedTelephone;
|
|
9
11
|
try {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
if (useLibphonenumber) {
|
|
13
|
+
const phoneNumber = (0, libphonenumber_js_1.parsePhoneNumberFromString)(String(params.agent.telephone), params.agent.telephoneRegion);
|
|
14
|
+
if (phoneNumber === undefined || !phoneNumber.isValid()) {
|
|
15
|
+
throw new factory_1.factory.errors.Argument('telephone', 'Invalid phone number');
|
|
16
|
+
}
|
|
17
|
+
formattedTelephone = phoneNumber.format('E.164');
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
21
|
+
const phoneNumber = phoneUtil.parse(params.agent.telephone, params.agent.telephoneRegion);
|
|
22
|
+
if (!phoneUtil.isValidNumber(phoneNumber)) {
|
|
23
|
+
throw new factory_1.factory.errors.Argument('telephone', 'Invalid phone number');
|
|
24
|
+
}
|
|
25
|
+
formattedTelephone = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.E164);
|
|
14
26
|
}
|
|
15
|
-
formattedTelephone = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.E164);
|
|
16
27
|
}
|
|
17
28
|
catch (error) {
|
|
18
29
|
throw new factory_1.factory.errors.Argument('telephone', (error instanceof Error) ? error.message : String(error));
|
|
@@ -68,9 +79,9 @@ function fixCustomer(params) {
|
|
|
68
79
|
/**
|
|
69
80
|
* 取引人プロフィール更新
|
|
70
81
|
*/
|
|
71
|
-
function updateAgent(params) {
|
|
82
|
+
function updateAgent(params, options) {
|
|
72
83
|
return async (repos) => {
|
|
73
|
-
const { customer, transaction } = await fixCustomer(params)(repos);
|
|
84
|
+
const { customer, transaction } = await fixCustomer(params, options)(repos);
|
|
74
85
|
// also save in orderInTransaction(2024-06-20~)
|
|
75
86
|
if (customer !== undefined) {
|
|
76
87
|
// // 注文ドキュメントを参照(2026-06-24~)
|
|
@@ -95,6 +106,5 @@ function updateAgent(params) {
|
|
|
95
106
|
customer: customerInOrder
|
|
96
107
|
});
|
|
97
108
|
}
|
|
98
|
-
// return newAgent;
|
|
99
109
|
};
|
|
100
110
|
}
|
package/package.json
CHANGED
|
@@ -11,15 +11,16 @@
|
|
|
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": "9.5.0-alpha.
|
|
14
|
+
"@chevre/factory": "9.5.0-alpha.9",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
18
18
|
"@surfrock/sdk": "2.0.0",
|
|
19
19
|
"debug": "4.4.3",
|
|
20
|
-
"google-libphonenumber": "
|
|
20
|
+
"google-libphonenumber": "3.2.18",
|
|
21
21
|
"http-status": "2.1.0",
|
|
22
22
|
"jsonwebtoken": "9.0.0",
|
|
23
|
+
"libphonenumber-js": "1.13.8",
|
|
23
24
|
"lodash.difference": "^4.5.0",
|
|
24
25
|
"moment": "^2.29.1",
|
|
25
26
|
"moment-timezone": "^0.5.33",
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"@sendgrid/helpers": "8.0.0",
|
|
35
36
|
"@size-limit/preset-big-lib": "12.0.0",
|
|
36
37
|
"@types/debug": "4.1.13",
|
|
37
|
-
"@types/google-libphonenumber": "
|
|
38
|
+
"@types/google-libphonenumber": "7.4.19",
|
|
38
39
|
"@types/jsonwebtoken": "9.0.1",
|
|
39
40
|
"@types/lodash.difference": "^4.5.6",
|
|
40
41
|
"@types/node": "22.19.7",
|
|
@@ -91,5 +92,5 @@
|
|
|
91
92
|
"postversion": "git push origin --tags",
|
|
92
93
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
94
|
},
|
|
94
|
-
"version": "25.2.0-alpha.
|
|
95
|
+
"version": "25.2.0-alpha.27"
|
|
95
96
|
}
|