@chevre/domain 22.7.0-alpha.13 → 22.7.0-alpha.14

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.
@@ -0,0 +1,114 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+ import { call as deletePerson } from '../../../lib/chevre/service/task/deletePerson';
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ // tslint:disable-next-line:max-func-body-length
7
+ async function main() {
8
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
9
+
10
+ const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
11
+ const setting = await settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['userPoolIdNew']);
12
+ if (typeof setting?.userPoolIdNew !== 'string') {
13
+ throw new chevre.factory.errors.NotFound('setting.userPoolIdNew');
14
+ }
15
+
16
+ const DISCONTINUE_PEOPLE_PROJECT = process.env.USE_DISCONTINUE_PEOPLE_PROJECT;
17
+
18
+ /**
19
+ * 1リクエストで生成するタスク数
20
+ */
21
+ const NUM_TASKS = 1;
22
+
23
+ if (typeof DISCONTINUE_PEOPLE_PROJECT === 'string' && DISCONTINUE_PEOPLE_PROJECT.length > 0) {
24
+ const ownershipInfoRepo = await chevre.repository.OwnershipInfo.createInstance(mongoose.connection);
25
+ const deletingOwnershipInfos = (await ownershipInfoRepo.projectFields({
26
+ limit: NUM_TASKS,
27
+ page: 1,
28
+ sort: { ownedFrom: chevre.factory.sortType.Ascending },
29
+ project: { id: { $eq: DISCONTINUE_PEOPLE_PROJECT } },
30
+ typeOfGood: {
31
+ // typeOf: { $eq: chevre.factory.permit.PermitType.Permit },
32
+ issuedThrough: {
33
+ typeOf: {
34
+ // $eq: chevre.factory.product.ProductType.PaymentCard
35
+ $eq: chevre.factory.product.ProductType.EventService
36
+ }
37
+ }
38
+ }
39
+ }));
40
+ console.log(deletingOwnershipInfos.length, 'deletingOwnershipInfos found');
41
+
42
+ if (deletingOwnershipInfos.length > 0) {
43
+ const runsAt: Date = new Date();
44
+ const userPoolId: string = setting.userPoolIdNew;
45
+
46
+ for (const deletingOwnershipInfo of deletingOwnershipInfos) {
47
+ const personId: string = (Array.isArray(deletingOwnershipInfo.ownedBy))
48
+ ? deletingOwnershipInfo.ownedBy[0]?.id
49
+ : deletingOwnershipInfo.ownedBy.id;
50
+
51
+ console.log(
52
+ 'deleting person...',
53
+ personId, deletingOwnershipInfo.id, deletingOwnershipInfo.ownedFrom
54
+ );
55
+ await deletePerson({
56
+ id: '',
57
+ project: { typeOf: chevre.factory.organizationType.Project, id: DISCONTINUE_PEOPLE_PROJECT },
58
+ name: chevre.factory.taskName.DeletePerson,
59
+ status: chevre.factory.taskStatus.Ready,
60
+ runsAt,
61
+ remainingNumberOfTries: 10,
62
+ numberOfTried: 0,
63
+ data: {
64
+ id: personId,
65
+ agent: {
66
+ id: DISCONTINUE_PEOPLE_PROJECT,
67
+ typeOf: chevre.factory.organizationType.Project,
68
+ name: 'example'
69
+ },
70
+ physically: true,
71
+ userPoolId,
72
+ project: { id: DISCONTINUE_PEOPLE_PROJECT },
73
+ migrate: false,
74
+ useUsernameAsGMOMemberId: true,
75
+ executeBackground: true
76
+ }
77
+ })(
78
+ {
79
+ connection: mongoose.connection,
80
+ settings: new chevre.settings.Settings({
81
+ abortedTasksWithoutReport: [],
82
+ numTryConfirmReserveTransaction: 10,
83
+ deliverOrderLimit: 1,
84
+ coa: {
85
+ timeout: 20000
86
+ },
87
+ gmo: {
88
+ timeout: 5000,
89
+ timeoutBackground: 5000,
90
+ useFetch: true
91
+ },
92
+ movieticketReserve: {
93
+ timeout: 1000,
94
+ timeoutCheck: 1000,
95
+ minIntervalBetweenPayAndRefund: 1000,
96
+ credentialsExpireInSeconds: 1000
97
+ },
98
+ useExperimentalFeature: false
99
+ }),
100
+ credentials: <any>{}
101
+ },
102
+ {
103
+ executeById: false,
104
+ executeByName: true
105
+ }
106
+ );
107
+ }
108
+ }
109
+ }
110
+ }
111
+
112
+ main()
113
+ .then(console.log)
114
+ .catch(console.error);
@@ -134,7 +134,7 @@ export declare function start(params: factory.assetTransaction.pay.IStartParamsW
134
134
  checkedAction: {
135
135
  id: string;
136
136
  };
137
- }): IStartOperation<factory.assetTransaction.pay.ITransaction>;
137
+ }): IStartOperation<Pick<factory.assetTransaction.pay.ITransaction, 'id' | 'object'>>;
138
138
  /**
139
139
  * 取引確定
140
140
  */
@@ -408,23 +408,18 @@ function processAuthorizeMovieTicket(params, transaction, paymentServiceId,
408
408
  // useCheckByIdentifierIfNotYet: boolean,
409
409
  options) {
410
410
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
411
- const { accountsReceivablesByServiceType } = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId, options)(repos, settings);
412
- // const payActionInObject: factory.assetTransaction.pay.IPayActionInObject = {
413
- // actionStatus: payAction.actionStatus,
414
- // id: payAction.id,
415
- // typeOf: payAction.typeOf
416
- // };
417
- return saveAuthorizeResult({
418
- id: transaction.id,
419
- update: {
420
- // ↓discontinue(2024-06-14~)
421
- // 'object.accountId': accountId,
422
- // 'object.paymentMethod.accountId': accountId,
423
- // 'object.payAction': payActionInObject, // 最適化(2024-04-09~)
424
- // 認証レスポンスより計上金額を保管(2023-05-15~)
425
- 'object.accountsReceivablesByServiceType': accountsReceivablesByServiceType
426
- }
427
- })(repos);
411
+ // const { accountsReceivablesByServiceType } = await MovieTicketPayment.authorize(
412
+ // params, transaction, paymentServiceId, options
413
+ // )(repos, settings);
414
+ yield MovieTicketPayment.authorize(params, transaction, paymentServiceId, options)(repos, settings);
415
+ return transaction;
416
+ // discontinue(2024-12-17~)
417
+ // return saveAuthorizeResult({
418
+ // id: transaction.id,
419
+ // update: {
420
+ // 'object.accountsReceivablesByServiceType': accountsReceivablesByServiceType // 認証レスポンスより計上金額を保管(2023-05-15~)
421
+ // }
422
+ // })(repos);
428
423
  });
429
424
  }
430
425
  function saveAuthorizeResult(params) {
@@ -27,7 +27,7 @@ export declare function creatPayTransactionStartParams(params: {
27
27
  export declare function createMovieTicket(params: factory.action.trade.pay.IMovieTicket): factory.action.trade.pay.IMovieTicket;
28
28
  export declare function createAuthorizeResult(params: {
29
29
  object: factory.action.authorize.paymentMethod.any.IObjectIncludingPaymentMethodDetails;
30
- payTransaction: factory.assetTransaction.pay.ITransaction;
30
+ payTransaction: Pick<factory.assetTransaction.pay.ITransaction, 'object'>;
31
31
  permit?: Pick<factory.ownershipInfo.IPermitAsGood, 'identifier'>;
32
32
  }): factory.action.authorize.paymentMethod.any.IResult;
33
33
  /**
package/package.json CHANGED
@@ -11,7 +11,7 @@
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.391.0-alpha.2",
14
+ "@chevre/factory": "4.391.0-alpha.3",
15
15
  "@cinerino/sdk": "10.19.0-alpha.1",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.3.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.7.0-alpha.13"
115
+ "version": "22.7.0-alpha.14"
116
116
  }