@chevre/domain 21.19.0 → 21.20.0-alpha.0

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,80 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+ import * as redis from 'redis';
4
+
5
+ import { chevre } from '../../../../lib/index';
6
+
7
+ const project = { id: String(process.env.PROJECT_ID) };
8
+ const CLIENT_ID = '51qbjcfr72h62m06vtv5kkhgje';
9
+
10
+ async function main() {
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
+ const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
13
+ socket: {
14
+ port: Number(<string>process.env.REDIS_PORT),
15
+ host: <string>process.env.REDIS_HOST
16
+ },
17
+ password: <string>process.env.REDIS_KEY
18
+ });
19
+ await client.connect();
20
+
21
+ const transaction = await (await chevre.service.transaction.createService()).placeOrderInProgress.start({
22
+ project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
23
+ agent: { id: CLIENT_ID, typeOf: chevre.factory.creativeWorkType.WebApplication },
24
+ object: {
25
+ clientUser: <any>{ client_id: CLIENT_ID }
26
+ },
27
+ seller: { id: '59d20831e53ebc2b4e774466' },
28
+ validateEligibleCustomerType: false
29
+ })({
30
+ seller: await chevre.repository.Seller.createInstance(mongoose.connection),
31
+ transaction: await chevre.repository.Transaction.createInstance(mongoose.connection)
32
+ });
33
+ console.log('transaction started', transaction);
34
+
35
+ const publishPaymentUrlResult = await (await chevre.service.payment.any.createService()).publishPaymentUrl({
36
+ project: { id: project.id },
37
+ agent: { id: CLIENT_ID },
38
+ object: {
39
+ // accountId?: string;
40
+ // additionalProperty?: IPropertyValue<string>[];
41
+ amount: 1,
42
+ // description?: string;
43
+ // name?: string;
44
+ paymentMethod: 'PayPay',
45
+ // paymentMethodId?: string;
46
+ typeOf: chevre.factory.action.authorize.paymentMethod.any.ResultType.Payment,
47
+ issuedThrough: { id: '60e9560176a391000b23e20b' },
48
+ method: '1',
49
+ creditCard: {
50
+ cardNo: '4100000000000100',
51
+ expire: '2812',
52
+ cardPass: '123',
53
+ holderName: 'AA AA'
54
+ }
55
+ },
56
+ purpose: { id: transaction.id, typeOf: transaction.typeOf },
57
+ paymentServiceType: chevre.factory.service.paymentService.PaymentServiceType.CreditCard,
58
+ location: {
59
+ typeOf: chevre.factory.creativeWorkType.WebApplication,
60
+ id: CLIENT_ID
61
+ }
62
+ // options: {
63
+ // use3DS: true
64
+ // }
65
+ })({
66
+ assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection),
67
+ paymentAccepted: await chevre.repository.SellerPaymentAccepted.createInstance(mongoose.connection),
68
+ paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
69
+ paymentServiceProvider: await chevre.repository.PaymentServiceProvider.createInstance(mongoose.connection),
70
+ person: await chevre.repository.Person.createInstance({ userPoolId: '' }),
71
+ project: await chevre.repository.Project.createInstance(mongoose.connection),
72
+ transactionNumber: await chevre.repository.TransactionNumber.createInstance(client),
73
+ transaction: await chevre.repository.Transaction.createInstance(mongoose.connection)
74
+ });
75
+ console.log(publishPaymentUrlResult);
76
+ }
77
+
78
+ main()
79
+ .then(console.log)
80
+ .catch(console.error);
@@ -16,6 +16,7 @@ import type { MongoRepository as ProductRepo } from '../../repo/product';
16
16
  import type { MongoRepository as ProjectRepo } from '../../repo/project';
17
17
  import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
18
18
  import type { MongoRepository as TaskRepo } from '../../repo/task';
19
+ import * as CreditCardPayment from '../payment/creditCard';
19
20
  import * as MovieTicketPayment from '../payment/movieTicket';
20
21
  export interface IStartOperationRepos {
21
22
  accountingReport: AccountingReportRepo;
@@ -79,10 +80,10 @@ export type IInvalidatePaymentUrlOperation<T> = (repos: {
79
80
  task: TaskRepo;
80
81
  assetTransaction: AssetTransactionRepo;
81
82
  }) => Promise<T>;
82
- export interface IPublishPaymentUrlResult {
83
+ export type IPublishPaymentUrlResult = CreditCardPayment.IAuthorizeResult & {
83
84
  paymentMethodId: string;
84
85
  paymentUrl: string;
85
- }
86
+ };
86
87
  /**
87
88
  * 外部決済ロケーション発行
88
89
  */
@@ -47,7 +47,11 @@ function publishPaymentUrl(params) {
47
47
  }
48
48
  result = {
49
49
  paymentMethodId: transactionNumber,
50
- paymentUrl: acsUrl
50
+ paymentUrl: acsUrl,
51
+ entryTranArgs: authorizeResult.entryTranArgs,
52
+ entryTranResult: authorizeResult.entryTranResult,
53
+ execTranArgs: authorizeResult.execTranArgs,
54
+ execTranResult: authorizeResult.execTranResult
51
55
  };
52
56
  break;
53
57
  default:
@@ -98,7 +98,7 @@ declare function publishPaymentUrl(params: {
98
98
  purpose: factory.action.authorize.paymentMethod.any.IPurpose;
99
99
  paymentServiceType: factory.service.paymentService.PaymentServiceType;
100
100
  location: factory.action.trade.pay.ILocation;
101
- }): IPublishPaymentUrlOperation<PayTransactionService.IPublishPaymentUrlResult>;
101
+ }): IPublishPaymentUrlOperation<Pick<PayTransactionService.IPublishPaymentUrlResult, 'paymentMethodId' | 'paymentUrl'>>;
102
102
  /**
103
103
  * 決済承認
104
104
  */
@@ -232,13 +232,21 @@ function publishPaymentUrl(params) {
232
232
  typeOf: params.object.paymentMethod,
233
233
  paymentMethodId: result.paymentMethodId,
234
234
  paymentUrl: result.paymentUrl,
235
- issuedThrough: { id: (typeof startParams.object.id === 'string') ? startParams.object.id : '' }
235
+ issuedThrough: { id: (typeof startParams.object.id === 'string') ? startParams.object.id : '' },
236
+ // GMO IFを保管(2024-01-01~)
237
+ entryTranArgs: result.entryTranArgs,
238
+ entryTranResult: result.entryTranResult,
239
+ execTranArgs: result.execTranArgs,
240
+ execTranResult: result.execTranResult
236
241
  };
237
242
  yield repos.transaction.findByIdAndUpdateInProgress({
238
243
  id: transaction.id,
239
244
  update: { $set: { 'object.paymentMethods': paymentMethodByPaymentUrl } }
240
245
  });
241
- return result;
246
+ return {
247
+ paymentMethodId: result.paymentMethodId,
248
+ paymentUrl: result.paymentUrl
249
+ };
242
250
  });
243
251
  }
244
252
  exports.publishPaymentUrl = publishPaymentUrl;
@@ -28,6 +28,12 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
28
28
  execTranArgs: GMO.factory.credit.IExecTranArgs;
29
29
  execTranResult: GMO.factory.credit.IExecTranResult;
30
30
  }>;
31
+ interface IAuthorizeResult {
32
+ entryTranArgs: GMO.factory.credit.IEntryTranArgs;
33
+ entryTranResult: GMO.factory.credit.IEntryTranResult;
34
+ execTranArgs: GMO.factory.credit.IExecTranArgs;
35
+ execTranResult: GMO.factory.credit.IExecTranResult;
36
+ }
31
37
  /**
32
38
  * クレジットカード決済中止
33
39
  */
@@ -81,4 +87,4 @@ declare function searchGMOTrade(params: {
81
87
  shopId: string;
82
88
  shopPass: string;
83
89
  }): Promise<GMO.factory.credit.ISearchTradeResult>;
84
- export { getGMOInfoFromSeller, authorize, payCreditCard, refundCreditCard, searchGMOTrade, voidTransaction };
90
+ export { IAuthorizeResult, getGMOInfoFromSeller, authorize, payCreditCard, refundCreditCard, searchGMOTrade, voidTransaction };
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.350.0",
13
+ "@chevre/factory": "4.351.0-alpha.0",
14
14
  "@cinerino/sdk": "5.6.0",
15
15
  "@motionpicture/coa-service": "9.2.0",
16
16
  "@motionpicture/gmo-service": "5.2.0",
@@ -115,5 +115,5 @@
115
115
  "postversion": "git push origin --tags",
116
116
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
117
  },
118
- "version": "21.19.0"
118
+ "version": "21.20.0-alpha.0"
119
119
  }