@chevre/domain 21.6.0-alpha.3 → 21.6.0-alpha.5

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.
@@ -105,7 +105,6 @@ async function main() {
105
105
  },
106
106
  offers: {
107
107
  typeOf: chevre.factory.offerType.Offer,
108
- priceCurrency: chevre.factory.priceCurrency.JPY,
109
108
  availabilityEnds: moment('2023-06-26T14:20:00.000Z')
110
109
  .toDate(),
111
110
  availabilityStarts: moment('2023-06-23T15:00:00.000Z')
@@ -275,7 +274,6 @@ async function main() {
275
274
  },
276
275
  offers: {
277
276
  typeOf: chevre.factory.offerType.Offer,
278
- priceCurrency: chevre.factory.priceCurrency.JPY,
279
277
  availabilityEnds: moment('2023-06-26T14:20:00.000Z')
280
278
  .toDate(),
281
279
  availabilityStarts: moment('2023-06-23T15:00:00.000Z')
@@ -4,16 +4,28 @@ import * as mongoose from 'mongoose';
4
4
  import { chevre } from '../../../lib/index';
5
5
 
6
6
  async function main() {
7
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
7
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
8
 
9
- const offerRepo = new chevre.repository.Offer(mongoose.connection);
9
+ const eventRepo = new chevre.repository.Event(mongoose.connection);
10
10
 
11
11
  let updateResult: any;
12
- updateResult = await offerRepo.unsetUnnecessaryFields({
13
- filter: { 'category.project': { $exists: true } },
14
- $unset: { 'category.project': 1 }
12
+ updateResult = await eventRepo.unsetUnnecessaryFields({
13
+ filter: { 'offers.acceptedPaymentMethod': { $exists: true } },
14
+ $unset: { 'offers.acceptedPaymentMethod': 1 }
15
15
  });
16
- console.log('offers unset', updateResult);
16
+ console.log('events unset', updateResult);
17
+
18
+ updateResult = await eventRepo.unsetUnnecessaryFields({
19
+ filter: { 'offers.project': { $exists: true } },
20
+ $unset: { 'offers.project': 1 }
21
+ });
22
+ console.log('events unset', updateResult);
23
+
24
+ updateResult = await eventRepo.unsetUnnecessaryFields({
25
+ filter: { 'offers.priceCurrency': { $exists: true } },
26
+ $unset: { 'offers.priceCurrency': 1 }
27
+ });
28
+ console.log('events unset', updateResult);
17
29
  }
18
30
 
19
31
  main()
@@ -7,7 +7,7 @@ exports.createStartParams = void 0;
7
7
  const factory = require("../../../factory");
8
8
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
9
9
  function createStartParams(params) {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
11
11
  const paymentServiceId = (params.paymentService !== undefined)
12
12
  ? String(params.paymentService.id)
13
13
  : '';
@@ -57,29 +57,33 @@ function createStartParams(params) {
57
57
  }
58
58
  const informPaymentParams = createInformPaymentParams({ paymentService: params.paymentService });
59
59
  const accountId = (_h = params.object.paymentMethod) === null || _h === void 0 ? void 0 : _h.accountId;
60
- return Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object: {
61
- // パラメータから必要なもののみ取り込む
62
- accountId: (typeof accountId === 'string') ? accountId : '',
63
- paymentMethodId: params.transactionNumber,
64
- typeOf: params.paymentServiceType,
65
- id: paymentServiceId,
66
- onPaymentStatusChanged: { informPayment: informPaymentParams },
67
- paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_j = params.object.paymentMethod) === null || _j === void 0 ? void 0 : _j.additionalProperty))
68
- ? (_k = params.object.paymentMethod) === null || _k === void 0 ? void 0 : _k.additionalProperty
69
- : [], name: (typeof ((_l = params.object.paymentMethod) === null || _l === void 0 ? void 0 : _l.name) === 'string')
70
- ? params.object.paymentMethod.name
71
- : paymentMethodType, amount: params.amount, paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.description) === 'string')
72
- ? { description: (_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.description }
73
- : undefined), (totalPaymentDue !== undefined)
74
- ? { totalPaymentDue: totalPaymentDue }
75
- : undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.method) === 'string')
76
- ? { method: (_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.method }
77
- : undefined), (((_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.creditCard) !== undefined)
78
- ? { creditCard: (_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.creditCard }
79
- : undefined), (Array.isArray((_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.movieTickets))
80
- ? { movieTickets: (_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.movieTickets }
81
- : undefined)
82
- }, expires: params.expires }, (typeof ((_v = params.location) === null || _v === void 0 ? void 0 : _v.typeOf) === 'string')
60
+ const creditCardAsPaymentServiceOutputCurrency = (_l = (_k = (_j = params.paymentService) === null || _j === void 0 ? void 0 : _j.serviceOutput) === null || _k === void 0 ? void 0 : _k.amount) === null || _l === void 0 ? void 0 : _l.currency;
61
+ const object = {
62
+ // パラメータから必要なもののみ取り込む
63
+ accountId: (typeof accountId === 'string') ? accountId : '',
64
+ paymentMethodId: params.transactionNumber,
65
+ typeOf: params.paymentServiceType,
66
+ id: paymentServiceId,
67
+ onPaymentStatusChanged: { informPayment: informPaymentParams },
68
+ paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.additionalProperty))
69
+ ? (_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.additionalProperty
70
+ : [], name: (typeof ((_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.name) === 'string')
71
+ ? params.object.paymentMethod.name
72
+ : paymentMethodType, amount: params.amount, paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.description) === 'string')
73
+ ? { description: (_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.description }
74
+ : undefined), (totalPaymentDue !== undefined)
75
+ ? { totalPaymentDue: totalPaymentDue }
76
+ : undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.method) === 'string')
77
+ ? { method: (_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.method }
78
+ : undefined), (((_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.creditCard) !== undefined)
79
+ ? { creditCard: (_v = params.object.paymentMethod) === null || _v === void 0 ? void 0 : _v.creditCard }
80
+ : undefined), (Array.isArray((_w = params.object.paymentMethod) === null || _w === void 0 ? void 0 : _w.movieTickets))
81
+ ? { movieTickets: (_x = params.object.paymentMethod) === null || _x === void 0 ? void 0 : _x.movieTickets }
82
+ : undefined), (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
83
+ ? { serviceOutput: { amount: { currency: creditCardAsPaymentServiceOutputCurrency } } }
84
+ : undefined)
85
+ };
86
+ return Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object, expires: params.expires }, (typeof ((_y = params.location) === null || _y === void 0 ? void 0 : _y.typeOf) === 'string')
83
87
  ? { location: params.location }
84
88
  : undefined);
85
89
  }
@@ -111,6 +111,7 @@ function createPayObject(params) {
111
111
  return payObject;
112
112
  }
113
113
  function createPayObjectServiceOutput(params) {
114
+ var _a, _b;
114
115
  const transaction = params.transaction;
115
116
  const paymentMethod = transaction.object.paymentMethod;
116
117
  const order = params.order;
@@ -118,7 +119,15 @@ function createPayObjectServiceOutput(params) {
118
119
  switch (transaction.object.typeOf) {
119
120
  case factory.service.paymentService.PaymentServiceType.FaceToFace:
120
121
  case factory.service.paymentService.PaymentServiceType.PaymentCard:
122
+ break;
121
123
  case factory.service.paymentService.PaymentServiceType.CreditCard:
124
+ // CreditCardIFのカード通貨区分を追加(2023-08-07~)
125
+ const creditCardAsPaymentServiceOutput = (typeof ((_b = (_a = transaction.object.serviceOutput) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency) === 'string')
126
+ ? { amount: { currency: transaction.object.serviceOutput.amount.currency } }
127
+ : undefined;
128
+ if (creditCardAsPaymentServiceOutput !== undefined) {
129
+ paymentServiceOutput = creditCardAsPaymentServiceOutput;
130
+ }
122
131
  break;
123
132
  case factory.service.paymentService.PaymentServiceType.MovieTicket:
124
133
  const paymentMethodType = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf;
@@ -129,9 +138,7 @@ function createPayObjectServiceOutput(params) {
129
138
  const amount = movieTicket2amount(transaction, movieTicket);
130
139
  const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType));
131
140
  return Object.assign(Object.assign({ identifier: movieTicket.identifier }, (typeof (amount === null || amount === void 0 ? void 0 : amount.value) === 'number') ? { amount } : undefined), (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
132
- ? {
133
- serviceOutput: reservation4invoice
134
- }
141
+ ? { serviceOutput: reservation4invoice }
135
142
  : undefined);
136
143
  });
137
144
  }
@@ -455,14 +455,13 @@ function createScreeningEventFromCOA(params) {
455
455
  .toDate();
456
456
  }
457
457
  const offers = {
458
- // 不要なので廃止(2022-12-19~)
459
- // project: { typeOf: params.project.typeOf, id: params.project.id },
460
458
  typeOf: factory.offerType.Offer,
461
459
  offeredThrough: {
462
460
  typeOf: 'WebAPI',
463
461
  identifier: factory.service.webAPI.Identifier.COA
464
462
  },
465
- priceCurrency: factory.priceCurrency.JPY,
463
+ // 廃止(2023-08-07~)
464
+ // priceCurrency: factory.priceCurrency.JPY,
466
465
  itemOffered: {
467
466
  serviceOutput: {
468
467
  reservedTicket: {
@@ -605,10 +604,7 @@ function createScreeningEventSeriesFromCOA(params) {
605
604
  endDate: endDate,
606
605
  startDate: startDate,
607
606
  coaInfo,
608
- offers: Object.assign({
609
- // 不要なので廃止(2023-06-09~)
610
- // project: { typeOf: params.project.typeOf, id: params.project.id },
611
- typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY }, (Array.isArray(unacceptedPaymentMethod)) ? { unacceptedPaymentMethod: unacceptedPaymentMethod } : undefined),
607
+ offers: Object.assign({ typeOf: factory.offerType.Offer }, (Array.isArray(unacceptedPaymentMethod)) ? { unacceptedPaymentMethod: unacceptedPaymentMethod } : undefined),
612
608
  additionalProperty
613
609
  };
614
610
  }
@@ -80,27 +80,29 @@ function createMovieTicket(params) {
80
80
  };
81
81
  }
82
82
  function createAuthorizeResult(params) {
83
- var _a, _b, _c, _d;
83
+ var _a, _b, _c, _d, _e, _f;
84
84
  const payTransactionObject = params.payTransaction.object;
85
85
  const totalPaymentDue = (_a = payTransactionObject.paymentMethod) === null || _a === void 0 ? void 0 : _a.totalPaymentDue;
86
86
  if (typeof (totalPaymentDue === null || totalPaymentDue === void 0 ? void 0 : totalPaymentDue.typeOf) !== 'string') {
87
87
  throw new factory.errors.ServiceUnavailable('payTransaction.object.paymentMethod.totalPaymentDue undefined');
88
88
  }
89
+ const creditCardAsPaymentServiceOutputCurrency = (_c = (_b = payTransactionObject.serviceOutput) === null || _b === void 0 ? void 0 : _b.amount) === null || _c === void 0 ? void 0 : _c.currency;
90
+ const issuedThrough = Object.assign({ typeOf: payTransactionObject.typeOf, id: (typeof payTransactionObject.id === 'string') ? payTransactionObject.id : '' }, (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
91
+ ? { serviceOutput: { amount: { currency: creditCardAsPaymentServiceOutputCurrency } } }
92
+ : undefined);
89
93
  return {
90
- accountId: (typeof ((_b = payTransactionObject.paymentMethod) === null || _b === void 0 ? void 0 : _b.accountId) === 'string')
94
+ accountId: (typeof ((_d = payTransactionObject.paymentMethod) === null || _d === void 0 ? void 0 : _d.accountId) === 'string')
91
95
  ? payTransactionObject.paymentMethod.accountId
92
96
  : '',
93
- amount: params.object.amount,
94
- issuedThrough: {
95
- typeOf: payTransactionObject.typeOf,
96
- id: (typeof payTransactionObject.id === 'string') ? payTransactionObject.id : ''
97
- },
97
+ // 廃止(2023-08-07~)
98
+ // amount: params.object.amount,
99
+ issuedThrough,
98
100
  paymentMethod: params.object.paymentMethod,
99
101
  paymentStatus: factory.paymentStatusType.PaymentDue,
100
- paymentMethodId: (typeof ((_c = payTransactionObject.paymentMethod) === null || _c === void 0 ? void 0 : _c.paymentMethodId) === 'string')
102
+ paymentMethodId: (typeof ((_e = payTransactionObject.paymentMethod) === null || _e === void 0 ? void 0 : _e.paymentMethodId) === 'string')
101
103
  ? payTransactionObject.paymentMethod.paymentMethodId
102
104
  : '',
103
- name: (typeof ((_d = payTransactionObject.paymentMethod) === null || _d === void 0 ? void 0 : _d.name) === 'string')
105
+ name: (typeof ((_f = payTransactionObject.paymentMethod) === null || _f === void 0 ? void 0 : _f.name) === 'string')
104
106
  ? payTransactionObject.paymentMethod.name
105
107
  : params.object.paymentMethod,
106
108
  totalPaymentDue: totalPaymentDue,
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.324.0-alpha.0",
12
+ "@chevre/factory": "4.324.0-alpha.2",
13
13
  "@cinerino/sdk": "3.162.2",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.6.0-alpha.3"
120
+ "version": "21.6.0-alpha.5"
121
121
  }