@chevre/domain 22.9.0-alpha.36 → 22.9.0-alpha.37
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.
|
@@ -106,8 +106,7 @@ export declare function publishPaymentUrl(params: Pick<factory.assetTransaction.
|
|
|
106
106
|
* 決済ロケーションを無効化する
|
|
107
107
|
* 実質、外部で実行された決済に対する返金処理
|
|
108
108
|
*/
|
|
109
|
-
export declare function invalidatePaymentUrl(params: Omit<factory.task.
|
|
110
|
-
purpose: factory.action.trade.refund.IPurposeAsPlaceOrder;
|
|
109
|
+
export declare function invalidatePaymentUrl(params: Omit<factory.task.invalidatePaymentUrl.IData, 'sameAs'> & {
|
|
111
110
|
sameAs?: {
|
|
112
111
|
id: string;
|
|
113
112
|
};
|
|
@@ -61,8 +61,9 @@ function voidPayTransaction(params) {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
function invalidatePaymentUrl(params) {
|
|
64
|
+
// tslint:disable-next-line:max-func-body-length
|
|
64
65
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
var _a, _b, _c, _d
|
|
66
|
+
var _a, _b, _c, _d;
|
|
66
67
|
if (params.purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
67
68
|
throw new factory.errors.Argument('purpose.typeOf', `must be ${factory.transactionType.PlaceOrder}`);
|
|
68
69
|
}
|
|
@@ -79,49 +80,100 @@ function invalidatePaymentUrl(params) {
|
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
refundFee: 0
|
|
121
|
-
}], purpose: { typeOf: transaction.typeOf, id: transaction.id }, instrument: [] }, (typeof ((_e = params.sameAs) === null || _e === void 0 ? void 0 : _e.id) === 'string') ? { sameAs: params.sameAs } : undefined))(repos, settings);
|
|
122
|
-
}
|
|
83
|
+
// support multiple accept actions(2025-02-25~)
|
|
84
|
+
const acceptPayActions = yield repos.action.search({
|
|
85
|
+
project: { id: { $eq: transaction.project.id } },
|
|
86
|
+
typeOf: { $eq: factory.actionType.AcceptAction },
|
|
87
|
+
actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
88
|
+
purpose: { id: { $in: [transaction.id] } },
|
|
89
|
+
object: {
|
|
90
|
+
// transactionNumber: { $eq: paymentMethodIdByPaymentUrl },
|
|
91
|
+
typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
92
|
+
}
|
|
93
|
+
}, ['object']);
|
|
94
|
+
for (const acceptPayAction of acceptPayActions) {
|
|
95
|
+
const paymentMethodIdByPaymentUrl = acceptPayAction.object.transactionNumber;
|
|
96
|
+
const paymentMethodType = acceptPayAction.object.object.paymentMethod.identifier;
|
|
97
|
+
if (typeof paymentMethodType === 'string' && paymentMethodType.length > 0) {
|
|
98
|
+
// chevreで決済URL無効化
|
|
99
|
+
yield PayTransactionService.invalidatePaymentUrl(Object.assign({ project: transaction.project, typeOf: factory.actionType.RefundAction, agent: {
|
|
100
|
+
typeOf: transaction.seller.typeOf,
|
|
101
|
+
name: (typeof transaction.seller.name === 'string')
|
|
102
|
+
? transaction.seller.name
|
|
103
|
+
: String((_c = transaction.seller.name) === null || _c === void 0 ? void 0 : _c.ja),
|
|
104
|
+
id: transaction.seller.id
|
|
105
|
+
}, recipient: {
|
|
106
|
+
typeOf: transaction.agent.typeOf,
|
|
107
|
+
id: transaction.agent.id,
|
|
108
|
+
name: transaction.agent.name
|
|
109
|
+
}, object: [{
|
|
110
|
+
typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
111
|
+
id: acceptPayAction.object.object.id,
|
|
112
|
+
paymentMethod: {
|
|
113
|
+
additionalProperty: [],
|
|
114
|
+
name: paymentMethodType,
|
|
115
|
+
typeOf: paymentMethodType,
|
|
116
|
+
paymentMethodId: paymentMethodIdByPaymentUrl
|
|
117
|
+
},
|
|
118
|
+
refundFee: 0
|
|
119
|
+
}], purpose: { typeOf: transaction.typeOf, id: transaction.id }, instrument: [] }, (typeof ((_d = params.sameAs) === null || _d === void 0 ? void 0 : _d.id) === 'string') ? { sameAs: params.sameAs } : undefined))(repos, settings);
|
|
123
120
|
}
|
|
124
121
|
}
|
|
122
|
+
// const paymentMethodIdByPaymentUrl = transaction.object.paymentMethods?.paymentMethodId;
|
|
123
|
+
// if (typeof paymentMethodIdByPaymentUrl === 'string' && paymentMethodIdByPaymentUrl.length > 0) {
|
|
124
|
+
// const acceptPayAction = (<Pick<IAcceptPayAction, 'object'>[]>await repos.action.search(
|
|
125
|
+
// {
|
|
126
|
+
// limit: 1,
|
|
127
|
+
// page: 1,
|
|
128
|
+
// project: { id: { $eq: transaction.project.id } },
|
|
129
|
+
// typeOf: { $eq: factory.actionType.AcceptAction },
|
|
130
|
+
// actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
131
|
+
// purpose: { id: { $in: [transaction.id] } },
|
|
132
|
+
// object: {
|
|
133
|
+
// transactionNumber: { $eq: paymentMethodIdByPaymentUrl },
|
|
134
|
+
// typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
135
|
+
// }
|
|
136
|
+
// },
|
|
137
|
+
// ['object']
|
|
138
|
+
// )).shift();
|
|
139
|
+
// if (acceptPayAction !== undefined) {
|
|
140
|
+
// // const paymentMethodType = transaction.object.paymentMethods?.typeOf;
|
|
141
|
+
// const paymentMethodType = acceptPayAction.object.object.paymentMethod.identifier;
|
|
142
|
+
// if (typeof paymentMethodType === 'string' && paymentMethodType.length > 0) {
|
|
143
|
+
// // chevreで決済URL無効化
|
|
144
|
+
// await PayTransactionService.invalidatePaymentUrl({
|
|
145
|
+
// project: transaction.project,
|
|
146
|
+
// typeOf: factory.actionType.RefundAction,
|
|
147
|
+
// agent: {
|
|
148
|
+
// typeOf: transaction.seller.typeOf,
|
|
149
|
+
// name: (typeof transaction.seller.name === 'string')
|
|
150
|
+
// ? transaction.seller.name
|
|
151
|
+
// : String(transaction.seller.name?.ja),
|
|
152
|
+
// id: transaction.seller.id
|
|
153
|
+
// },
|
|
154
|
+
// recipient: {
|
|
155
|
+
// typeOf: transaction.agent.typeOf,
|
|
156
|
+
// id: transaction.agent.id,
|
|
157
|
+
// name: transaction.agent.name
|
|
158
|
+
// },
|
|
159
|
+
// object: [{
|
|
160
|
+
// typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
161
|
+
// id: acceptPayAction.object.object.id,
|
|
162
|
+
// paymentMethod: {
|
|
163
|
+
// additionalProperty: [],
|
|
164
|
+
// name: paymentMethodType,
|
|
165
|
+
// typeOf: paymentMethodType,
|
|
166
|
+
// paymentMethodId: paymentMethodIdByPaymentUrl
|
|
167
|
+
// },
|
|
168
|
+
// refundFee: 0
|
|
169
|
+
// }],
|
|
170
|
+
// purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
171
|
+
// instrument: [],
|
|
172
|
+
// ...(typeof params.sameAs?.id === 'string') ? { sameAs: params.sameAs } : undefined
|
|
173
|
+
// })(repos, settings);
|
|
174
|
+
// }
|
|
175
|
+
// }
|
|
176
|
+
// }
|
|
125
177
|
});
|
|
126
178
|
}
|
|
127
179
|
/**
|
package/package.json
CHANGED