@chevre/domain 24.0.0-alpha.29 → 24.0.0-alpha.30
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/action/actionProcess.d.ts +1 -1
- package/lib/chevre/repo/action/authorizeMoneyTransferOffer.d.ts +40 -0
- package/lib/chevre/repo/action/authorizeMoneyTransferOffer.js +61 -0
- package/lib/chevre/repo/action/authorizeProductOffer.d.ts +26 -0
- package/lib/chevre/repo/action/authorizeProductOffer.js +52 -0
- package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +1 -1
- package/lib/chevre/repo/place/hasPOS.js +3 -3
- package/lib/chevre/repo/productModel.d.ts +3 -1
- package/lib/chevre/repo/productModel.js +15 -11
- package/lib/chevre/repo/transaction/moneyTransfer.js +7 -7
- package/lib/chevre/repository.d.ts +12 -2
- package/lib/chevre/repository.js +26 -4
- package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +3 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +3 -3
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.d.ts +3 -2
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +4 -4
- package/lib/chevre/service/offer/product.d.ts +5 -3
- package/lib/chevre/service/offer/product.js +7 -7
- package/lib/chevre/service/task/voidMoneyTransferTransaction.js +5 -3
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +4 -3
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +7 -4
- package/lib/chevre/service/transaction/moneyTransfer.js +6 -6
- package/package.json +1 -1
|
@@ -130,7 +130,7 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
|
|
|
130
130
|
};
|
|
131
131
|
object?: {
|
|
132
132
|
typeOf?: {
|
|
133
|
-
$eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.offerType.AggregateOffer;
|
|
133
|
+
$eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.offerType.AggregateOffer | factory.offerType.Offer;
|
|
134
134
|
};
|
|
135
135
|
paymentMethodId?: {
|
|
136
136
|
$eq?: string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
export type IAuthorizeMoneyTransferOfferAction = factory.action.authorize.offer.moneyTransfer.IAction;
|
|
4
|
+
/**
|
|
5
|
+
* 通貨転送オファー承認リポジトリ
|
|
6
|
+
*/
|
|
7
|
+
export declare class AuthorizeMoneyTransferOfferActionRepo extends ActionProcessRepo<IAuthorizeMoneyTransferOfferAction, never> {
|
|
8
|
+
/**
|
|
9
|
+
* 取引に対する通貨転送オファー承認アクションを検索する
|
|
10
|
+
*/
|
|
11
|
+
findAuthorizeMoneyTransferOfferActionsByPurpose(params: {
|
|
12
|
+
/**
|
|
13
|
+
* 注文取引でフィルター
|
|
14
|
+
*/
|
|
15
|
+
purpose: {
|
|
16
|
+
typeOf: factory.transactionType;
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* アクションステータスでフィルター
|
|
21
|
+
*/
|
|
22
|
+
actionStatus?: {
|
|
23
|
+
$eq?: factory.actionStatusType.CompletedActionStatus;
|
|
24
|
+
};
|
|
25
|
+
}): Promise<IAuthorizeMoneyTransferOfferAction[]>;
|
|
26
|
+
/**
|
|
27
|
+
* アクションに資産取引情報を保管する
|
|
28
|
+
*/
|
|
29
|
+
saveAssetTransactionNumber(params: {
|
|
30
|
+
id: string;
|
|
31
|
+
update: {
|
|
32
|
+
'object.itemOffered.amount.currency': string;
|
|
33
|
+
'object.itemOffered.object.pendingTransaction': {
|
|
34
|
+
typeOf: factory.assetTransactionType.MoneyTransfer;
|
|
35
|
+
id: string;
|
|
36
|
+
transactionNumber: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AuthorizeMoneyTransferOfferActionRepo = void 0;
|
|
27
|
+
const factory = __importStar(require("../../factory"));
|
|
28
|
+
// import { MONGO_MAX_TIME_MS } from '../settings';
|
|
29
|
+
const actionProcess_1 = require("./actionProcess");
|
|
30
|
+
/**
|
|
31
|
+
* 通貨転送オファー承認リポジトリ
|
|
32
|
+
*/
|
|
33
|
+
class AuthorizeMoneyTransferOfferActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
34
|
+
/**
|
|
35
|
+
* 取引に対する通貨転送オファー承認アクションを検索する
|
|
36
|
+
*/
|
|
37
|
+
async findAuthorizeMoneyTransferOfferActionsByPurpose(params) {
|
|
38
|
+
const authorizeActions = await this.findAnyActionsByPurpose({
|
|
39
|
+
...params,
|
|
40
|
+
typeOf: factory.actionType.AuthorizeAction,
|
|
41
|
+
object: {
|
|
42
|
+
typeOf: { $eq: factory.offerType.Offer }
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return authorizeActions.filter((a) => a.object.itemOffered?.typeOf === factory.actionType.MoneyTransfer);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* アクションに資産取引情報を保管する
|
|
49
|
+
*/
|
|
50
|
+
async saveAssetTransactionNumber(params) {
|
|
51
|
+
await this.actionModel.findOneAndUpdate({ _id: { $eq: params.id } }, params.update, { projection: { _id: 1 } })
|
|
52
|
+
.lean()
|
|
53
|
+
.exec()
|
|
54
|
+
.then((doc) => {
|
|
55
|
+
if (doc === null) {
|
|
56
|
+
throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.AuthorizeMoneyTransferOfferActionRepo = AuthorizeMoneyTransferOfferActionRepo;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
export type IAuthorizeProductOfferAction = factory.action.authorize.offer.product.IAction;
|
|
4
|
+
/**
|
|
5
|
+
* プロダクトオファー承認リポジトリ
|
|
6
|
+
*/
|
|
7
|
+
export declare class AuthorizeProductOfferActionRepo extends ActionProcessRepo<IAuthorizeProductOfferAction, never> {
|
|
8
|
+
/**
|
|
9
|
+
* 取引に対するプロダクトオファー承認アクションを検索する
|
|
10
|
+
*/
|
|
11
|
+
findAuthorizeProductOfferActionsByPurpose(params: {
|
|
12
|
+
/**
|
|
13
|
+
* 注文取引でフィルター
|
|
14
|
+
*/
|
|
15
|
+
purpose: {
|
|
16
|
+
typeOf: factory.transactionType;
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* アクションステータスでフィルター
|
|
21
|
+
*/
|
|
22
|
+
actionStatus?: {
|
|
23
|
+
$eq?: factory.actionStatusType.CompletedActionStatus;
|
|
24
|
+
};
|
|
25
|
+
}): Promise<IAuthorizeProductOfferAction[]>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AuthorizeProductOfferActionRepo = void 0;
|
|
27
|
+
const factory = __importStar(require("../../factory"));
|
|
28
|
+
// import { MONGO_MAX_TIME_MS } from '../settings';
|
|
29
|
+
const availableProductTypes_1 = require("../../factory/availableProductTypes");
|
|
30
|
+
const actionProcess_1 = require("./actionProcess");
|
|
31
|
+
/**
|
|
32
|
+
* プロダクトオファー承認リポジトリ
|
|
33
|
+
*/
|
|
34
|
+
class AuthorizeProductOfferActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
35
|
+
/**
|
|
36
|
+
* 取引に対するプロダクトオファー承認アクションを検索する
|
|
37
|
+
*/
|
|
38
|
+
async findAuthorizeProductOfferActionsByPurpose(params) {
|
|
39
|
+
const authorizeActions = await this.findAnyActionsByPurpose({
|
|
40
|
+
...params,
|
|
41
|
+
typeOf: factory.actionType.AuthorizeAction,
|
|
42
|
+
object: {
|
|
43
|
+
typeOf: { $eq: factory.offerType.Offer }
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return authorizeActions.filter((a) => Array.isArray(a.object)
|
|
47
|
+
&& a.object.length > 0
|
|
48
|
+
// && a.object[0].typeOf === factory.offerType.Offer
|
|
49
|
+
&& availableProductTypes_1.availableProductTypes.indexOf(a.object[0].itemOffered.typeOf) >= 0);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.AuthorizeProductOfferActionRepo = AuthorizeProductOfferActionRepo;
|
|
@@ -2,7 +2,7 @@ import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from '
|
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import * as factory from '../../../factory';
|
|
4
4
|
export interface IProductModel {
|
|
5
|
-
id
|
|
5
|
+
id: string;
|
|
6
6
|
project: {
|
|
7
7
|
id: string;
|
|
8
8
|
typeOf: factory.organizationType.Project;
|
|
@@ -109,7 +109,7 @@ class HasPOSRepo {
|
|
|
109
109
|
if (doc === null) {
|
|
110
110
|
throw new factory.errors.AlreadyInUse('hasPOS', ['id']);
|
|
111
111
|
}
|
|
112
|
-
return doc.toObject();
|
|
112
|
+
return doc.toObject({ virtuals: true });
|
|
113
113
|
}
|
|
114
114
|
async updateByBranchCode(params) {
|
|
115
115
|
const doc = await this.civicStructureModel.findOneAndUpdate({
|
|
@@ -133,7 +133,7 @@ class HasPOSRepo {
|
|
|
133
133
|
if (doc === null) {
|
|
134
134
|
throw new factory.errors.NotFound('hasPOS');
|
|
135
135
|
}
|
|
136
|
-
return doc.toObject();
|
|
136
|
+
return doc.toObject({ virtuals: true });
|
|
137
137
|
}
|
|
138
138
|
async deleteByBranchCode(params) {
|
|
139
139
|
const doc = await this.civicStructureModel.findOneAndUpdate({
|
|
@@ -149,7 +149,7 @@ class HasPOSRepo {
|
|
|
149
149
|
if (doc === null) {
|
|
150
150
|
throw new factory.errors.NotFound('hasPOS');
|
|
151
151
|
}
|
|
152
|
-
return doc.toObject();
|
|
152
|
+
return doc.toObject({ virtuals: true });
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
exports.HasPOSRepo = HasPOSRepo;
|
|
@@ -93,7 +93,7 @@ class ProductModelRepo {
|
|
|
93
93
|
// }
|
|
94
94
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
95
95
|
.exec()
|
|
96
|
-
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
96
|
+
.then((docs) => docs.map((doc) => doc.toObject({ virtuals: true })));
|
|
97
97
|
}
|
|
98
98
|
async deleteById(params) {
|
|
99
99
|
await this.productModelModel.findOneAndDelete({ _id: params.id })
|
|
@@ -103,24 +103,28 @@ class ProductModelRepo {
|
|
|
103
103
|
* プロダクトを保管する
|
|
104
104
|
*/
|
|
105
105
|
async save(params) {
|
|
106
|
-
let
|
|
106
|
+
let savedId;
|
|
107
107
|
if (typeof params.id === 'string') {
|
|
108
108
|
// 上書き禁止属性を除外
|
|
109
109
|
const { category, id, project, typeOf, ...setFields } = params.$set;
|
|
110
|
-
|
|
110
|
+
const updatedDoc = await this.productModelModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
|
|
111
111
|
$set: setFields
|
|
112
|
-
// $unset: params.$unset
|
|
113
112
|
}, { upsert: false, new: true, projection: { _id: 1 } })
|
|
114
113
|
.exec();
|
|
114
|
+
if (updatedDoc === null) {
|
|
115
|
+
throw new factory.errors.NotFound(this.productModelModel.modelName);
|
|
116
|
+
}
|
|
117
|
+
savedId = updatedDoc.id;
|
|
115
118
|
}
|
|
116
119
|
else {
|
|
117
120
|
const { id, ...createParams } = params.$set;
|
|
118
|
-
|
|
121
|
+
const createdDoc = await this.productModelModel.create(createParams);
|
|
122
|
+
savedId = createdDoc.id;
|
|
119
123
|
}
|
|
120
|
-
if (doc === null) {
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
return
|
|
124
|
+
// if (doc === null) {
|
|
125
|
+
// throw new factory.errors.NotFound(this.productModelModel.modelName);
|
|
126
|
+
// }
|
|
127
|
+
return { id: savedId };
|
|
124
128
|
}
|
|
125
129
|
/**
|
|
126
130
|
* 区分から同期する
|
|
@@ -139,7 +143,7 @@ class ProductModelRepo {
|
|
|
139
143
|
typeOf: factory.offerType.Offer
|
|
140
144
|
}]
|
|
141
145
|
};
|
|
142
|
-
const {
|
|
146
|
+
const { project, typeOf, offers, category, ...setFields } = upsertingProductModel;
|
|
143
147
|
const doc = await this.productModelModel.findOneAndUpdate({
|
|
144
148
|
'project.id': { $eq: upsertingProductModel.project.id },
|
|
145
149
|
'category.id': { $exists: true, $eq: upsertingProductModel.category.id }
|
|
@@ -151,7 +155,7 @@ class ProductModelRepo {
|
|
|
151
155
|
if (doc === null) {
|
|
152
156
|
throw new factory.errors.NotFound(this.productModelModel.modelName);
|
|
153
157
|
}
|
|
154
|
-
return doc.toObject();
|
|
158
|
+
return doc.toObject({ virtuals: true });
|
|
155
159
|
}
|
|
156
160
|
/**
|
|
157
161
|
* 区分から削除する
|
|
@@ -141,13 +141,13 @@ class MoneyTransferRepo {
|
|
|
141
141
|
if (typeof tasksExportActionStatusEq === 'string') {
|
|
142
142
|
andConditions.push({ 'tasksExportAction.actionStatus': { $exists: true, $eq: tasksExportActionStatusEq } });
|
|
143
143
|
}
|
|
144
|
-
switch (params.typeOf) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
144
|
+
// switch (params.typeOf) {
|
|
145
|
+
// case factory.transactionType.PlaceOrder:
|
|
146
|
+
// throw new factory.errors.NotImplemented(`use PlaceOrderRepo`);
|
|
147
|
+
// case factory.transactionType.ReturnOrder:
|
|
148
|
+
// throw new factory.errors.NotImplemented(`use ReturnOrderRepo`);
|
|
149
|
+
// default:
|
|
150
|
+
// }
|
|
151
151
|
return andConditions;
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
@@ -11,7 +11,9 @@ import type { ActionRepo } from './repo/action';
|
|
|
11
11
|
import type { AcceptCOAOfferActionRepo } from './repo/action/acceptCOAOffer';
|
|
12
12
|
import type { AcceptPayActionRepo } from './repo/action/acceptPay';
|
|
13
13
|
import type { AuthorizeInvoiceActionRepo } from './repo/action/authorizeInvoice';
|
|
14
|
+
import type { AuthorizeMoneyTransferOfferActionRepo } from './repo/action/authorizeMoneyTransferOffer';
|
|
14
15
|
import type { AuthorizeOfferActionRepo } from './repo/action/authorizeOffer';
|
|
16
|
+
import type { AuthorizeProductOfferActionRepo } from './repo/action/authorizeProductOffer';
|
|
15
17
|
import type { AuthorizePaymentMethodActionRepo } from './repo/action/authorizePaymentMethod';
|
|
16
18
|
import type { CheckMovieTicketActionRepo } from './repo/action/checkMovieTicket';
|
|
17
19
|
import type { CheckThingActionRepo } from './repo/action/checkThing';
|
|
@@ -144,12 +146,20 @@ export declare namespace action {
|
|
|
144
146
|
namespace AuthorizeInvoice {
|
|
145
147
|
function createInstance(...params: ConstructorParameters<typeof AuthorizeInvoiceActionRepo>): Promise<AuthorizeInvoiceActionRepo>;
|
|
146
148
|
}
|
|
149
|
+
type AuthorizeMoneyTransferOffer = AuthorizeMoneyTransferOfferActionRepo;
|
|
150
|
+
namespace AuthorizeMoneyTransferOffer {
|
|
151
|
+
function createInstance(...params: ConstructorParameters<typeof AuthorizeMoneyTransferOfferActionRepo>): Promise<AuthorizeMoneyTransferOfferActionRepo>;
|
|
152
|
+
}
|
|
147
153
|
type AuthorizeOffer = AuthorizeOfferActionRepo;
|
|
148
154
|
namespace AuthorizeOffer {
|
|
149
155
|
function createInstance(...params: ConstructorParameters<typeof AuthorizeOfferActionRepo>): Promise<AuthorizeOfferActionRepo>;
|
|
150
156
|
}
|
|
151
|
-
type
|
|
152
|
-
namespace
|
|
157
|
+
type AuthorizeProductOffer = AuthorizeProductOfferActionRepo;
|
|
158
|
+
namespace AuthorizeProductOffer {
|
|
159
|
+
function createInstance(...params: ConstructorParameters<typeof AuthorizeProductOfferActionRepo>): Promise<AuthorizeProductOfferActionRepo>;
|
|
160
|
+
}
|
|
161
|
+
type AuthorizePaymentMethod = AuthorizePaymentMethodActionRepo;
|
|
162
|
+
namespace AuthorizePaymentMethod {
|
|
153
163
|
function createInstance(...params: ConstructorParameters<typeof AuthorizePaymentMethodActionRepo>): Promise<AuthorizePaymentMethodActionRepo>;
|
|
154
164
|
}
|
|
155
165
|
type CheckMovieTicket = CheckMovieTicketActionRepo;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -137,6 +137,17 @@ var action;
|
|
|
137
137
|
}
|
|
138
138
|
AuthorizeInvoice.createInstance = createInstance;
|
|
139
139
|
})(AuthorizeInvoice = action.AuthorizeInvoice || (action.AuthorizeInvoice = {}));
|
|
140
|
+
let AuthorizeMoneyTransferOffer;
|
|
141
|
+
(function (AuthorizeMoneyTransferOffer) {
|
|
142
|
+
let repo;
|
|
143
|
+
async function createInstance(...params) {
|
|
144
|
+
if (repo === undefined) {
|
|
145
|
+
repo = (await Promise.resolve().then(() => __importStar(require('./repo/action/authorizeMoneyTransferOffer')))).AuthorizeMoneyTransferOfferActionRepo;
|
|
146
|
+
}
|
|
147
|
+
return new repo(...params);
|
|
148
|
+
}
|
|
149
|
+
AuthorizeMoneyTransferOffer.createInstance = createInstance;
|
|
150
|
+
})(AuthorizeMoneyTransferOffer = action.AuthorizeMoneyTransferOffer || (action.AuthorizeMoneyTransferOffer = {}));
|
|
140
151
|
let AuthorizeOffer;
|
|
141
152
|
(function (AuthorizeOffer) {
|
|
142
153
|
let repo;
|
|
@@ -148,8 +159,19 @@ var action;
|
|
|
148
159
|
}
|
|
149
160
|
AuthorizeOffer.createInstance = createInstance;
|
|
150
161
|
})(AuthorizeOffer = action.AuthorizeOffer || (action.AuthorizeOffer = {}));
|
|
151
|
-
let
|
|
152
|
-
(function (
|
|
162
|
+
let AuthorizeProductOffer;
|
|
163
|
+
(function (AuthorizeProductOffer) {
|
|
164
|
+
let repo;
|
|
165
|
+
async function createInstance(...params) {
|
|
166
|
+
if (repo === undefined) {
|
|
167
|
+
repo = (await Promise.resolve().then(() => __importStar(require('./repo/action/authorizeProductOffer')))).AuthorizeProductOfferActionRepo;
|
|
168
|
+
}
|
|
169
|
+
return new repo(...params);
|
|
170
|
+
}
|
|
171
|
+
AuthorizeProductOffer.createInstance = createInstance;
|
|
172
|
+
})(AuthorizeProductOffer = action.AuthorizeProductOffer || (action.AuthorizeProductOffer = {}));
|
|
173
|
+
let AuthorizePaymentMethod;
|
|
174
|
+
(function (AuthorizePaymentMethod) {
|
|
153
175
|
let repo;
|
|
154
176
|
async function createInstance(...params) {
|
|
155
177
|
if (repo === undefined) {
|
|
@@ -157,8 +179,8 @@ var action;
|
|
|
157
179
|
}
|
|
158
180
|
return new repo(...params);
|
|
159
181
|
}
|
|
160
|
-
|
|
161
|
-
})(
|
|
182
|
+
AuthorizePaymentMethod.createInstance = createInstance;
|
|
183
|
+
})(AuthorizePaymentMethod = action.AuthorizePaymentMethod || (action.AuthorizePaymentMethod = {}));
|
|
162
184
|
let CheckMovieTicket;
|
|
163
185
|
(function (CheckMovieTicket) {
|
|
164
186
|
let repo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthorizeMoneyTransferOfferActionRepo } from '../../../repo/action/authorizeMoneyTransferOffer';
|
|
3
3
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
4
4
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
5
5
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
@@ -8,7 +8,8 @@ import type { ProjectRepo } from '../../../repo/project';
|
|
|
8
8
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
9
9
|
import type { TransactionNumberRepo } from '../../../repo/transactionNumber';
|
|
10
10
|
interface IAuthorizeRepos {
|
|
11
|
-
action
|
|
11
|
+
action?: never;
|
|
12
|
+
authorizeMoneyTransferOfferAction: AuthorizeMoneyTransferOfferActionRepo;
|
|
12
13
|
product: ProductRepo;
|
|
13
14
|
project: ProjectRepo;
|
|
14
15
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -61,7 +61,7 @@ function authorize(params) {
|
|
|
61
61
|
object: params.object,
|
|
62
62
|
transactionNumber
|
|
63
63
|
});
|
|
64
|
-
const action = await repos.
|
|
64
|
+
const action = await repos.authorizeMoneyTransferOfferAction.start(actionAttributes);
|
|
65
65
|
// priceを確定する
|
|
66
66
|
let price = 0;
|
|
67
67
|
try {
|
|
@@ -86,7 +86,7 @@ function authorize(params) {
|
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
88
88
|
try {
|
|
89
|
-
await repos.
|
|
89
|
+
await repos.authorizeMoneyTransferOfferAction.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
90
90
|
}
|
|
91
91
|
catch (__) {
|
|
92
92
|
// 失敗したら仕方ない
|
|
@@ -100,7 +100,7 @@ function authorize(params) {
|
|
|
100
100
|
responseBody
|
|
101
101
|
// acceptedOffers: acceptedOffers4result // discontinue(2024-06-17~)
|
|
102
102
|
};
|
|
103
|
-
await repos.
|
|
103
|
+
await repos.authorizeMoneyTransferOfferAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
104
104
|
return { id: action.id };
|
|
105
105
|
};
|
|
106
106
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthorizeMoneyTransferOfferActionRepo } from '../../../repo/action/authorizeMoneyTransferOffer';
|
|
3
3
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
4
4
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
5
5
|
export declare function voidTransaction(params: factory.task.IData<factory.taskName.VoidMoneyTransferTransaction>): (repos: {
|
|
6
|
-
action
|
|
6
|
+
action?: never;
|
|
7
|
+
authorizeMoneyTransferOfferAction: AuthorizeMoneyTransferOfferActionRepo;
|
|
7
8
|
assetTransaction: AssetTransactionRepo;
|
|
8
9
|
placeOrder: PlaceOrderRepo;
|
|
9
10
|
}) => Promise<void>;
|
|
@@ -40,7 +40,7 @@ function voidTransaction(params) {
|
|
|
40
40
|
}
|
|
41
41
|
let authorizeActions;
|
|
42
42
|
if (typeof params.id === 'string') {
|
|
43
|
-
const authorizeAction = await repos.
|
|
43
|
+
const authorizeAction = await repos.authorizeMoneyTransferOfferAction.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
44
44
|
// 取引内のアクションかどうか確認
|
|
45
45
|
if (transaction !== undefined) {
|
|
46
46
|
if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
|
|
@@ -50,8 +50,8 @@ function voidTransaction(params) {
|
|
|
50
50
|
authorizeActions = [authorizeAction];
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
authorizeActions = await repos.
|
|
54
|
-
typeOf: factory.actionType.AuthorizeAction,
|
|
53
|
+
authorizeActions = await repos.authorizeMoneyTransferOfferAction.findAuthorizeMoneyTransferOfferActionsByPurpose({
|
|
54
|
+
// typeOf: factory.actionType.AuthorizeAction,
|
|
55
55
|
purpose: {
|
|
56
56
|
typeOf: params.purpose.typeOf,
|
|
57
57
|
id: params.purpose.id
|
|
@@ -61,7 +61,7 @@ function voidTransaction(params) {
|
|
|
61
61
|
.filter((a) => a.object.itemOffered?.typeOf === factory.actionType.MoneyTransfer);
|
|
62
62
|
}
|
|
63
63
|
await Promise.all(authorizeActions.map(async (action) => {
|
|
64
|
-
await repos.
|
|
64
|
+
await repos.authorizeMoneyTransferOfferAction.cancelWithVoid({ typeOf: action.typeOf, id: action.id });
|
|
65
65
|
const pendingTransactionTransactionNumber = action.object.itemOffered.object?.pendingTransaction?.transactionNumber;
|
|
66
66
|
if (typeof pendingTransactionTransactionNumber === 'string') {
|
|
67
67
|
// 取引が存在すれば中止
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import type { AccountRepo } from '../../repo/account';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AuthorizeProductOfferActionRepo } from '../../repo/action/authorizeProductOffer';
|
|
4
4
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
5
5
|
import type { OfferRepo } from '../../repo/offer/unitPriceInCatalog';
|
|
6
6
|
import type { OfferCatalogRepo } from '../../repo/offerCatalog';
|
|
@@ -15,7 +15,8 @@ import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
|
15
15
|
import type { TransactionNumberRepo } from '../../repo/transactionNumber';
|
|
16
16
|
export interface IAuthorizeOperationRepos {
|
|
17
17
|
account: AccountRepo;
|
|
18
|
-
action
|
|
18
|
+
action?: never;
|
|
19
|
+
authorizeProductOfferAction: AuthorizeProductOfferActionRepo;
|
|
19
20
|
assetTransaction: AssetTransactionRepo;
|
|
20
21
|
offer: OfferRepo;
|
|
21
22
|
offerCatalog: OfferCatalogRepo;
|
|
@@ -94,7 +95,8 @@ export declare function authorize(params: {
|
|
|
94
95
|
result: IAuthorizeOfferAction['result'];
|
|
95
96
|
}>;
|
|
96
97
|
export declare function voidTransaction(params: factory.task.IData<factory.taskName.VoidRegisterServiceTransaction>): (repos: {
|
|
97
|
-
action
|
|
98
|
+
action?: never;
|
|
99
|
+
authorizeProductOfferAction: AuthorizeProductOfferActionRepo;
|
|
98
100
|
assetTransaction: AssetTransactionRepo;
|
|
99
101
|
placeOrder: PlaceOrderRepo;
|
|
100
102
|
}) => Promise<void>;
|
|
@@ -142,7 +142,7 @@ function authorize(params) {
|
|
|
142
142
|
transaction: transaction,
|
|
143
143
|
transactionNumber: transactionNumber
|
|
144
144
|
});
|
|
145
|
-
const action = await repos.
|
|
145
|
+
const action = await repos.authorizeProductOfferAction.start(actionAttributes);
|
|
146
146
|
try {
|
|
147
147
|
// 会員の場合のみ排他ロック
|
|
148
148
|
// if (params.agent.typeOf === factory.personType.Person) {
|
|
@@ -168,14 +168,14 @@ function authorize(params) {
|
|
|
168
168
|
}
|
|
169
169
|
catch (error) {
|
|
170
170
|
try {
|
|
171
|
-
await repos.
|
|
171
|
+
await repos.authorizeProductOfferAction.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
172
172
|
}
|
|
173
173
|
catch (__) {
|
|
174
174
|
// no op
|
|
175
175
|
}
|
|
176
176
|
throw error;
|
|
177
177
|
}
|
|
178
|
-
await repos.
|
|
178
|
+
await repos.authorizeProductOfferAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
179
179
|
return { id: action.id, result };
|
|
180
180
|
};
|
|
181
181
|
}
|
|
@@ -230,15 +230,15 @@ function voidTransaction(params) {
|
|
|
230
230
|
}
|
|
231
231
|
let authorizeActions;
|
|
232
232
|
if (typeof params.id === 'string') {
|
|
233
|
-
const action = await repos.
|
|
233
|
+
const action = await repos.authorizeProductOfferAction.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
234
234
|
if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
|
|
235
235
|
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
236
236
|
}
|
|
237
237
|
authorizeActions = [action];
|
|
238
238
|
}
|
|
239
239
|
else {
|
|
240
|
-
authorizeActions = await repos.
|
|
241
|
-
typeOf: factory.actionType.AuthorizeAction,
|
|
240
|
+
authorizeActions = await repos.authorizeProductOfferAction.findAuthorizeProductOfferActionsByPurpose({
|
|
241
|
+
// typeOf: factory.actionType.AuthorizeAction,
|
|
242
242
|
purpose: {
|
|
243
243
|
typeOf: params.purpose.typeOf,
|
|
244
244
|
id: params.purpose.id
|
|
@@ -260,7 +260,7 @@ function voidTransaction(params) {
|
|
|
260
260
|
// purpose: params.purpose
|
|
261
261
|
// })(repos);
|
|
262
262
|
}
|
|
263
|
-
await repos.
|
|
263
|
+
await repos.authorizeProductOfferAction.cancelWithVoid({ typeOf: action.typeOf, id: action.id });
|
|
264
264
|
await processVoidRegisterServiceTransaction({
|
|
265
265
|
action,
|
|
266
266
|
project: params.project
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.call = call;
|
|
4
|
-
|
|
4
|
+
// import { ActionRepo } from '../../repo/action';
|
|
5
|
+
const authorizeMoneyTransferOffer_1 = require("../../repo/action/authorizeMoneyTransferOffer");
|
|
5
6
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
6
7
|
// import { TransactionRepo } from '../../repo/transaction';
|
|
7
8
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
@@ -11,12 +12,13 @@ const voidTransaction_1 = require("../offer/moneyTransfer/voidTransaction");
|
|
|
11
12
|
*/
|
|
12
13
|
function call(data) {
|
|
13
14
|
return async ({ connection }) => {
|
|
14
|
-
const actionRepo = new
|
|
15
|
+
// const actionRepo = new ActionRepo(connection);
|
|
15
16
|
const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection);
|
|
16
17
|
const placeOrderRepo = new placeOrder_1.PlaceOrderRepo(connection);
|
|
17
18
|
// const transactionRepo = new TransactionRepo(connection);
|
|
18
19
|
await (0, voidTransaction_1.voidTransaction)(data)({
|
|
19
|
-
action: actionRepo,
|
|
20
|
+
// action: actionRepo,
|
|
21
|
+
authorizeMoneyTransferOfferAction: new authorizeMoneyTransferOffer_1.AuthorizeMoneyTransferOfferActionRepo(connection),
|
|
20
22
|
assetTransaction: assetTransactionRepo,
|
|
21
23
|
placeOrder: placeOrderRepo
|
|
22
24
|
// transaction: transactionRepo
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.call = call;
|
|
4
|
-
|
|
4
|
+
// import { ActionRepo } from '../../repo/action';
|
|
5
|
+
const authorizeProductOffer_1 = require("../../repo/action/authorizeProductOffer");
|
|
5
6
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
6
7
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
7
8
|
const product_1 = require("../offer/product");
|
|
@@ -10,11 +11,11 @@ const product_1 = require("../offer/product");
|
|
|
10
11
|
*/
|
|
11
12
|
function call(data) {
|
|
12
13
|
return async ({ connection }) => {
|
|
13
|
-
const actionRepo = new
|
|
14
|
+
// const actionRepo = new ActionRepo(connection);
|
|
14
15
|
const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection);
|
|
15
16
|
const placeOrderRepo = new placeOrder_1.PlaceOrderRepo(connection);
|
|
16
17
|
await (0, product_1.voidTransaction)(data)({
|
|
17
|
-
|
|
18
|
+
authorizeProductOfferAction: new authorizeProductOffer_1.AuthorizeProductOfferActionRepo(connection),
|
|
18
19
|
assetTransaction: assetTransactionRepo,
|
|
19
20
|
placeOrder: placeOrderRepo
|
|
20
21
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AuthorizeMoneyTransferOfferActionRepo } from '../../repo/action/authorizeMoneyTransferOffer';
|
|
2
2
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
3
3
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
4
4
|
import type { OrderRepo } from '../../repo/order';
|
|
@@ -13,7 +13,8 @@ import type { IStartedTransaction, MoneyTransferRepo } from '../../repo/transact
|
|
|
13
13
|
import type { TransactionNumberRepo } from '../../repo/transactionNumber';
|
|
14
14
|
import { moneyTransfer as MoneyTransferFactory } from '../../factory/transaction';
|
|
15
15
|
export interface IStartOperationRepos {
|
|
16
|
-
action
|
|
16
|
+
action?: never;
|
|
17
|
+
authorizeMoneyTransferOfferAction: AuthorizeMoneyTransferOfferActionRepo;
|
|
17
18
|
authorization: AuthorizationRepo;
|
|
18
19
|
order: OrderRepo;
|
|
19
20
|
passport: PassportRepo;
|
|
@@ -32,7 +33,8 @@ export type ITaskAndTransactionOperation<T> = (repos: {
|
|
|
32
33
|
moneyTransfer: MoneyTransferRepo;
|
|
33
34
|
}) => Promise<T>;
|
|
34
35
|
export type IConfirmOperation<T> = (repos: {
|
|
35
|
-
action
|
|
36
|
+
action?: never;
|
|
37
|
+
authorizeMoneyTransferOfferAction: AuthorizeMoneyTransferOfferActionRepo;
|
|
36
38
|
moneyTransfer: MoneyTransferRepo;
|
|
37
39
|
}) => Promise<T>;
|
|
38
40
|
export type IStartParams = MoneyTransferFactory.IStartParams;
|
|
@@ -42,7 +44,8 @@ export type IStartParams = MoneyTransferFactory.IStartParams;
|
|
|
42
44
|
*/
|
|
43
45
|
export declare function start(params: IStartParams): IStartOperation<IStartedTransaction>;
|
|
44
46
|
export type IAuthorizeOperation<T> = (repos: {
|
|
45
|
-
action
|
|
47
|
+
action?: never;
|
|
48
|
+
authorizeMoneyTransferOfferAction: AuthorizeMoneyTransferOfferActionRepo;
|
|
46
49
|
authorization: AuthorizationRepo;
|
|
47
50
|
order: OrderRepo;
|
|
48
51
|
product: ProductRepo;
|
|
@@ -225,7 +225,7 @@ function processAuthorizePaymentCard(params) {
|
|
|
225
225
|
transaction,
|
|
226
226
|
transactionNumber
|
|
227
227
|
});
|
|
228
|
-
const action = await repos.
|
|
228
|
+
const action = await repos.authorizeMoneyTransferOfferAction.start(actionAttributes);
|
|
229
229
|
// 口座取引開始
|
|
230
230
|
let responseBody;
|
|
231
231
|
try {
|
|
@@ -237,7 +237,7 @@ function processAuthorizePaymentCard(params) {
|
|
|
237
237
|
transactionNumber
|
|
238
238
|
})(repos);
|
|
239
239
|
// アクションにchevre取引情報を保管
|
|
240
|
-
await repos.
|
|
240
|
+
await repos.authorizeMoneyTransferOfferAction.saveAssetTransactionNumber({
|
|
241
241
|
id: action.id,
|
|
242
242
|
update: {
|
|
243
243
|
'object.itemOffered.amount.currency': params.object.itemOffered.amount.currency,
|
|
@@ -251,7 +251,7 @@ function processAuthorizePaymentCard(params) {
|
|
|
251
251
|
}
|
|
252
252
|
catch (error) {
|
|
253
253
|
try {
|
|
254
|
-
await repos.
|
|
254
|
+
await repos.authorizeMoneyTransferOfferAction.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
255
255
|
}
|
|
256
256
|
catch (__) {
|
|
257
257
|
// no op
|
|
@@ -265,7 +265,7 @@ function processAuthorizePaymentCard(params) {
|
|
|
265
265
|
responseBody: responseBody
|
|
266
266
|
// acceptedOffers: [] // PlaceOrderではないのでacceptedOffersとしては空 // discontinue(2024-06-17~)
|
|
267
267
|
};
|
|
268
|
-
await repos.
|
|
268
|
+
await repos.authorizeMoneyTransferOfferAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
function createAuthorizeMoneyTransferOfferActionAttributes(params) {
|
|
@@ -601,8 +601,8 @@ function confirm(params) {
|
|
|
601
601
|
}
|
|
602
602
|
function searchAuthorizeActions(params) {
|
|
603
603
|
return async (repos) => {
|
|
604
|
-
let authorizeActions = await repos.
|
|
605
|
-
typeOf: factory.actionType.AuthorizeAction,
|
|
604
|
+
let authorizeActions = await repos.authorizeMoneyTransferOfferAction.findAuthorizeMoneyTransferOfferActionsByPurpose({
|
|
605
|
+
// typeOf: factory.actionType.AuthorizeAction,
|
|
606
606
|
purpose: {
|
|
607
607
|
typeOf: params.transaction.typeOf,
|
|
608
608
|
id: params.transaction.id
|
package/package.json
CHANGED