@cinerino/sdk 3.104.0-alpha.2 → 3.104.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.
@@ -3368,11 +3368,11 @@ var TaskName;
3368
3368
  /**
3369
3369
  * 決済
3370
3370
  */
3371
- TaskName["ConfirmPay"] = "confirmPay";
3371
+ // ConfirmPay = 'confirmPay',
3372
3372
  /**
3373
3373
  * 返金
3374
3374
  */
3375
- TaskName["ConfirmRefund"] = "confirmRefund";
3375
+ // ConfirmRefund = 'confirmRefund',
3376
3376
  /**
3377
3377
  * サービス登録
3378
3378
  */
@@ -7653,6 +7653,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
7653
7653
  Object.defineProperty(exports, "__esModule", { value: true });
7654
7654
  exports.OfferService = void 0;
7655
7655
  var http_status_1 = require("http-status");
7656
+ var factory = require("../factory");
7656
7657
  var service_1 = require("../service");
7657
7658
  /**
7658
7659
  * オファーサービス
@@ -7763,11 +7764,50 @@ var OfferService = /** @class */ (function (_super) {
7763
7764
  });
7764
7765
  });
7765
7766
  };
7767
+ /**
7768
+ * プロダクトオファー承認
7769
+ */
7770
+ OfferService.prototype.authorizeProduct = function (params) {
7771
+ return __awaiter(this, void 0, void 0, function () {
7772
+ var _this = this;
7773
+ return __generator(this, function (_a) {
7774
+ return [2 /*return*/, this.fetch({
7775
+ uri: "/offers/" + factory.product.ProductType.Product + "/authorize",
7776
+ method: 'POST',
7777
+ expectedStatusCodes: [http_status_1.CREATED],
7778
+ body: params
7779
+ })
7780
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
7781
+ return [2 /*return*/, response.json()];
7782
+ }); }); })];
7783
+ });
7784
+ });
7785
+ };
7786
+ /**
7787
+ * オファー承認取消
7788
+ */
7789
+ OfferService.prototype.voidAuthorization = function (params) {
7790
+ return __awaiter(this, void 0, void 0, function () {
7791
+ return __generator(this, function (_a) {
7792
+ switch (_a.label) {
7793
+ case 0: return [4 /*yield*/, this.fetch({
7794
+ uri: "/offers/" + params.object.itemOffered.typeOf + "/authorize/" + params.id + "/void",
7795
+ method: 'PUT',
7796
+ expectedStatusCodes: [http_status_1.NO_CONTENT],
7797
+ body: params
7798
+ })];
7799
+ case 1:
7800
+ _a.sent();
7801
+ return [2 /*return*/];
7802
+ }
7803
+ });
7804
+ });
7805
+ };
7766
7806
  return OfferService;
7767
7807
  }(service_1.Service));
7768
7808
  exports.OfferService = OfferService;
7769
7809
 
7770
- },{"../service":212,"http-status":275}],184:[function(require,module,exports){
7810
+ },{"../factory":205,"../service":212,"http-status":275}],184:[function(require,module,exports){
7771
7811
  "use strict";
7772
7812
  var __extends = (this && this.__extends) || (function () {
7773
7813
  var extendStatics = function (d, b) {
@@ -11090,7 +11130,7 @@ var PlaceOrderTransactionService = /** @class */ (function (_super) {
11090
11130
  case 0: return [4 /*yield*/, this.fetch({
11091
11131
  uri: "/transactions/" + this.typeOf + "/" + params.id + "/publishConfirmationNumberIfNotExist",
11092
11132
  method: 'POST',
11093
- expectedStatusCodes: [http_status_1.NO_CONTENT]
11133
+ expectedStatusCodes: [http_status_1.NO_CONTENT, http_status_1.OK]
11094
11134
  })];
11095
11135
  case 1:
11096
11136
  _a.sent();
@@ -11099,6 +11139,24 @@ var PlaceOrderTransactionService = /** @class */ (function (_super) {
11099
11139
  });
11100
11140
  });
11101
11141
  };
11142
+ /**
11143
+ * 注文番号発行
11144
+ */
11145
+ PlaceOrderTransactionService.prototype.publishOrderNumberIfNotExist = function (params) {
11146
+ return __awaiter(this, void 0, void 0, function () {
11147
+ var _this = this;
11148
+ return __generator(this, function (_a) {
11149
+ return [2 /*return*/, this.fetch({
11150
+ uri: "/transactions/" + this.typeOf + "/" + params.id + "/publishOrderNumberIfNotExist",
11151
+ method: 'POST',
11152
+ expectedStatusCodes: [http_status_1.OK]
11153
+ })
11154
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
11155
+ return [2 /*return*/, response.json()];
11156
+ }); }); })];
11157
+ });
11158
+ });
11159
+ };
11102
11160
  /**
11103
11161
  * 取引検索
11104
11162
  */
@@ -203,7 +203,7 @@ async function main() {
203
203
  value: '12345'
204
204
  }],
205
205
  // email: '',
206
- familyName: 'Motion',
206
+ familyName: 'SDK',
207
207
  gender: 'Female',
208
208
  givenName: 'Taro',
209
209
  telephone: '+819012345678'
@@ -0,0 +1,154 @@
1
+ // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
+ import * as moment from 'moment';
3
+ import * as client from '../../../../lib/index';
4
+ import * as auth from '../../auth/authAsAdmin';
5
+
6
+ const project = { id: process.env.PROJECT_ID };
7
+
8
+ const profile = {
9
+ email: <string>process.env.TEST_PROFILE_EMAIL,
10
+ givenName: 'Taro',
11
+ familyName: 'SDK',
12
+ name: 'Taro ☆ SDK',
13
+ telephone: '+819012345678'
14
+ };
15
+
16
+ export type IAuthorizeReservationAction
17
+ = client.factory.action.authorize.offer.seatReservation.IAction<client.factory.service.webAPI.Identifier.Chevre>;
18
+
19
+ // tslint:disable-next-line:max-func-body-length
20
+ async function main() {
21
+ const authClient = await auth.login();
22
+ await authClient.refreshAccessToken();
23
+ const loginTicket = authClient.verifyIdToken({});
24
+ console.log('username is', loginTicket.getUsername());
25
+
26
+ const sellerService = new client.chevre.service.Seller({
27
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
28
+ auth: authClient,
29
+ project
30
+ });
31
+ const placeOrderService = new client.chevre.service.transaction.PlaceOrder({
32
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
33
+ auth: authClient,
34
+ project
35
+ });
36
+
37
+ console.log('finding profile...');
38
+ // const profile = await personService.getProfile({ personId: 'me' });
39
+ console.log('profile found');
40
+
41
+ // 販売劇場検索
42
+ const searchSellersResult = await sellerService.search({});
43
+ // tslint:disable-next-line:insecure-random
44
+ const seller = searchSellersResult.data[Math.floor(searchSellersResult.data.length * Math.random())];
45
+ if (seller === undefined) {
46
+ throw new Error('No seller');
47
+ }
48
+ console.log('ordering from seller...', (<client.factory.multilingualString>seller.name).ja);
49
+
50
+ console.log('starting transaction...');
51
+ const transaction = await placeOrderService.start({
52
+ expires: moment()
53
+ .add(10, 'minutes')
54
+ .toDate(),
55
+ agent: {
56
+ identifier: [
57
+ {
58
+ name: 'SampleName',
59
+ value: 'SampleValue'
60
+ },
61
+ ...(typeof process.env.LINE_NOTIFY_URL === 'string' && process.env.LINE_NOTIFY_URL.length > 0)
62
+ ? [
63
+ {
64
+ name: 'onOrderPlaced.recipient.url',
65
+ value: process.env.LINE_NOTIFY_URL
66
+ },
67
+ {
68
+ name: 'onOrderPlaced.object.customer.identifier',
69
+ value: 'onOrderPlaced.object.customer.identifier.value1'
70
+ },
71
+ {
72
+ name: 'onOrderPlaced.object.customer.identifier',
73
+ value: 'onOrderPlaced.object.customer.identifier.value2'
74
+ }
75
+
76
+ ]
77
+ : []
78
+ ]
79
+ },
80
+ seller: {
81
+ typeOf: seller.typeOf,
82
+ id: String(seller.id)
83
+ },
84
+ object: {
85
+ // passport: { token: passportToken }
86
+ }
87
+ });
88
+ console.log('transaction started', transaction.id);
89
+
90
+ // 購入者情報入力時間
91
+ // tslint:disable-next-line:no-magic-numbers
92
+ await wait(5000);
93
+
94
+ const settingProfile: client.factory.person.IProfile = {
95
+ givenName: 'Taro',
96
+ familyName: 'SDK',
97
+ telephone: '+819012345678',
98
+ email: profile.email
99
+ };
100
+ console.log('setting customer profile...');
101
+ await placeOrderService.setProfile({ id: transaction.id, agent: settingProfile });
102
+ console.log('customer profile set');
103
+
104
+ // let i = 0;
105
+ // setInterval(
106
+ // async () => {
107
+ // i += 1;
108
+ // try {
109
+ // console.log('setting customer profile...');
110
+ // await placeOrderService.setProfile({ id: transaction.id, agent: settingProfile });
111
+ // console.log('customer profile set');
112
+
113
+ // } catch (error) {
114
+ // console.error('setting profile failed.', error.message);
115
+ // }
116
+ // },
117
+ // // tslint:disable-next-line:no-magic-numbers
118
+ // 500
119
+ // );
120
+
121
+ // return;
122
+
123
+ // 購入情報確認時間
124
+ // tslint:disable-next-line:no-magic-numbers
125
+ await wait(5000);
126
+
127
+ const publishOrderNumberReulst = await placeOrderService.publishOrderNumberIfNotExist({ id: transaction.id });
128
+ console.log(publishOrderNumberReulst.orderNumber);
129
+
130
+ // 取引を中止する場合はコチラ↓
131
+ // console.log('取引を中止します...');
132
+ // await placeOrderService.cancel({ id: transaction.id });
133
+ // console.log('取引を中止しました。');
134
+
135
+ console.log('confirming transaction...');
136
+ const confirmResult = await placeOrderService.confirm({
137
+ id: transaction.id,
138
+ sendEmailMessage: true
139
+ // expectsReservationIds: true
140
+ });
141
+ const order = confirmResult.order;
142
+ console.log('transaction confirmed', confirmResult);
143
+ console.log('transaction confirmed', order.orderNumber);
144
+ }
145
+
146
+ async function wait(waitInMilliseconds: number) {
147
+ return new Promise((resolve) => setTimeout(resolve, waitInMilliseconds));
148
+ }
149
+
150
+ main()
151
+ .then(() => {
152
+ console.log('success!');
153
+ })
154
+ .catch(console.error);
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
9
9
  const profile = {
10
10
  email: <string>process.env.TEST_PROFILE_EMAIL,
11
11
  givenName: 'Taro',
12
- familyName: 'Motion',
13
- name: 'Taro ☆ Motion',
12
+ familyName: 'SDK',
13
+ name: 'Taro ☆ SDK',
14
14
  telephone: '+819012345678'
15
15
  };
16
16
 
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
9
9
  const profile = {
10
10
  email: <string>process.env.TEST_PROFILE_EMAIL,
11
11
  givenName: 'Taro',
12
- familyName: 'Motion',
13
- name: 'Taro ☆ Motion',
12
+ familyName: 'SDK',
13
+ name: 'Taro ☆ SDK',
14
14
  telephone: '+819012345678'
15
15
  };
16
16
 
@@ -4,13 +4,13 @@ import * as client from '../../../lib/index';
4
4
  // import { auth } from '../auth/clientCredentials';
5
5
  import * as auth from '../auth/auth';
6
6
 
7
- const project = { id: 'cinerino' };
7
+ const project = { id: process.env.PROJECT_ID };
8
8
 
9
9
  const profile = {
10
10
  email: <string>process.env.TEST_PROFILE_EMAIL,
11
11
  givenName: 'Taro',
12
- familyName: 'Motion',
13
- name: 'Taro ☆ Motion',
12
+ familyName: 'SDK',
13
+ name: 'Taro ☆ SDK',
14
14
  telephone: '+819012345678'
15
15
  };
16
16
 
@@ -124,8 +124,8 @@ async function main() {
124
124
  const profile = {
125
125
  email: '',
126
126
  givenName: 'Taro',
127
- familyName: 'Motion',
128
- name: 'Taro ☆ Motion',
127
+ familyName: 'SDK',
128
+ name: 'Taro ☆ SDK',
129
129
  telephone: '+819012345678'
130
130
  };
131
131
  await placeOrderService.setProfile({
@@ -132,8 +132,8 @@ async function main() {
132
132
  const profile = {
133
133
  email: '',
134
134
  givenName: 'Taro',
135
- familyName: 'Motion',
136
- name: 'Taro ☆ Motion',
135
+ familyName: 'SDK',
136
+ name: 'Taro ☆ SDK',
137
137
  telephone: '+819012345678'
138
138
  };
139
139
  await placeOrderService.setProfile({
@@ -9,8 +9,8 @@ const projectId = 'cinerino';
9
9
  const profile = {
10
10
  email: <string>process.env.TEST_PROFILE_EMAIL,
11
11
  givenName: 'Taro',
12
- familyName: 'Motion',
13
- name: 'Taro ☆ Motion',
12
+ familyName: 'SDK',
13
+ name: 'Taro ☆ SDK',
14
14
  telephone: '+819012345678'
15
15
  };
16
16
 
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
9
9
  const profile = {
10
10
  email: <string>process.env.TEST_PROFILE_EMAIL,
11
11
  givenName: 'Taro',
12
- familyName: 'Motion',
13
- name: 'Taro ☆ Motion',
12
+ familyName: 'SDK',
13
+ name: 'Taro ☆ SDK',
14
14
  telephone: '+819012345678'
15
15
  };
16
16
 
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
9
9
  const profile = {
10
10
  email: <string>process.env.TEST_PROFILE_EMAIL,
11
11
  givenName: 'Taro',
12
- familyName: 'Motion',
13
- name: 'Taro ☆ Motion',
12
+ familyName: 'SDK',
13
+ name: 'Taro ☆ SDK',
14
14
  telephone: '+819012345678'
15
15
  };
16
16
 
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
9
9
  const profile = {
10
10
  email: <string>process.env.TEST_PROFILE_EMAIL,
11
11
  givenName: 'Taro',
12
- familyName: 'Motion',
13
- name: 'Taro ☆ Motion',
12
+ familyName: 'SDK',
13
+ name: 'Taro ☆ SDK',
14
14
  telephone: '+819012345678'
15
15
  };
16
16
 
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
9
9
  const profile = {
10
10
  email: <string>process.env.TEST_PROFILE_EMAIL,
11
11
  givenName: 'Taro',
12
- familyName: 'Motion',
13
- name: 'Taro ☆ Motion',
12
+ familyName: 'SDK',
13
+ name: 'Taro ☆ SDK',
14
14
  telephone: '+819012345678'
15
15
  };
16
16
 
@@ -301,7 +301,7 @@ async function main() {
301
301
  id: transaction.id,
302
302
  agent: {
303
303
  givenName: 'Taro',
304
- familyName: 'Motion',
304
+ familyName: 'SDK',
305
305
  telephone: '+819012345678',
306
306
  email: profile.email
307
307
  }
@@ -15,8 +15,8 @@ const creditCard = {
15
15
  const profile = {
16
16
  email: <string>process.env.TEST_PROFILE_EMAIL,
17
17
  givenName: 'Taro',
18
- familyName: 'Motion',
19
- name: 'Taro ☆ Motion',
18
+ familyName: 'SDK',
19
+ name: 'Taro ☆ SDK',
20
20
  telephone: '+819012345678'
21
21
  };
22
22
 
@@ -432,7 +432,7 @@ async function main() {
432
432
  id: transaction.id,
433
433
  agent: {
434
434
  givenName: 'Taro',
435
- familyName: 'Motion',
435
+ familyName: 'SDK',
436
436
  telephone: '+819012345678',
437
437
  email: profile.email
438
438
  }
@@ -10,8 +10,8 @@ const project = { id: 'sskts-development' };
10
10
  const profile = {
11
11
  email: <string>process.env.TEST_PROFILE_EMAIL,
12
12
  givenName: 'Taro',
13
- familyName: 'Motion',
14
- name: 'Taro ☆ Motion',
13
+ familyName: 'SDK',
14
+ name: 'Taro ☆ SDK',
15
15
  telephone: '+819012345678'
16
16
  };
17
17
 
@@ -9,8 +9,8 @@ const projectId = 'cinerino';
9
9
  const profile = {
10
10
  email: <string>process.env.TEST_PROFILE_EMAIL,
11
11
  givenName: 'Taro',
12
- familyName: 'Motion',
13
- name: 'Taro ☆ Motion',
12
+ familyName: 'SDK',
13
+ name: 'Taro ☆ SDK',
14
14
  telephone: '+819012345678'
15
15
  };
16
16
 
package/lib/bundle.js CHANGED
@@ -3410,11 +3410,11 @@ var TaskName;
3410
3410
  /**
3411
3411
  * 決済
3412
3412
  */
3413
- TaskName["ConfirmPay"] = "confirmPay";
3413
+ // ConfirmPay = 'confirmPay',
3414
3414
  /**
3415
3415
  * 返金
3416
3416
  */
3417
- TaskName["ConfirmRefund"] = "confirmRefund";
3417
+ // ConfirmRefund = 'confirmRefund',
3418
3418
  /**
3419
3419
  * サービス登録
3420
3420
  */
@@ -7653,6 +7653,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
7653
7653
  Object.defineProperty(exports, "__esModule", { value: true });
7654
7654
  exports.OfferService = void 0;
7655
7655
  var http_status_1 = require("http-status");
7656
+ var factory = require("../factory");
7656
7657
  var service_1 = require("../service");
7657
7658
  /**
7658
7659
  * オファーサービス
@@ -7763,11 +7764,50 @@ var OfferService = /** @class */ (function (_super) {
7763
7764
  });
7764
7765
  });
7765
7766
  };
7767
+ /**
7768
+ * プロダクトオファー承認
7769
+ */
7770
+ OfferService.prototype.authorizeProduct = function (params) {
7771
+ return __awaiter(this, void 0, void 0, function () {
7772
+ var _this = this;
7773
+ return __generator(this, function (_a) {
7774
+ return [2 /*return*/, this.fetch({
7775
+ uri: "/offers/" + factory.product.ProductType.Product + "/authorize",
7776
+ method: 'POST',
7777
+ expectedStatusCodes: [http_status_1.CREATED],
7778
+ body: params
7779
+ })
7780
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
7781
+ return [2 /*return*/, response.json()];
7782
+ }); }); })];
7783
+ });
7784
+ });
7785
+ };
7786
+ /**
7787
+ * オファー承認取消
7788
+ */
7789
+ OfferService.prototype.voidAuthorization = function (params) {
7790
+ return __awaiter(this, void 0, void 0, function () {
7791
+ return __generator(this, function (_a) {
7792
+ switch (_a.label) {
7793
+ case 0: return [4 /*yield*/, this.fetch({
7794
+ uri: "/offers/" + params.object.itemOffered.typeOf + "/authorize/" + params.id + "/void",
7795
+ method: 'PUT',
7796
+ expectedStatusCodes: [http_status_1.NO_CONTENT],
7797
+ body: params
7798
+ })];
7799
+ case 1:
7800
+ _a.sent();
7801
+ return [2 /*return*/];
7802
+ }
7803
+ });
7804
+ });
7805
+ };
7766
7806
  return OfferService;
7767
7807
  }(service_1.Service));
7768
7808
  exports.OfferService = OfferService;
7769
7809
 
7770
- },{"../service":212,"http-status":275}],184:[function(require,module,exports){
7810
+ },{"../factory":205,"../service":212,"http-status":275}],184:[function(require,module,exports){
7771
7811
  "use strict";
7772
7812
  var __extends = (this && this.__extends) || (function () {
7773
7813
  var extendStatics = function (d, b) {
@@ -11002,7 +11042,7 @@ var PlaceOrderTransactionService = /** @class */ (function (_super) {
11002
11042
  case 0: return [4 /*yield*/, this.fetch({
11003
11043
  uri: "/transactions/" + this.typeOf + "/" + params.id + "/publishConfirmationNumberIfNotExist",
11004
11044
  method: 'POST',
11005
- expectedStatusCodes: [http_status_1.NO_CONTENT]
11045
+ expectedStatusCodes: [http_status_1.NO_CONTENT, http_status_1.OK]
11006
11046
  })];
11007
11047
  case 1:
11008
11048
  _a.sent();
@@ -11011,6 +11051,24 @@ var PlaceOrderTransactionService = /** @class */ (function (_super) {
11011
11051
  });
11012
11052
  });
11013
11053
  };
11054
+ /**
11055
+ * 注文番号発行
11056
+ */
11057
+ PlaceOrderTransactionService.prototype.publishOrderNumberIfNotExist = function (params) {
11058
+ return __awaiter(this, void 0, void 0, function () {
11059
+ var _this = this;
11060
+ return __generator(this, function (_a) {
11061
+ return [2 /*return*/, this.fetch({
11062
+ uri: "/transactions/" + this.typeOf + "/" + params.id + "/publishOrderNumberIfNotExist",
11063
+ method: 'POST',
11064
+ expectedStatusCodes: [http_status_1.OK]
11065
+ })
11066
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
11067
+ return [2 /*return*/, response.json()];
11068
+ }); }); })];
11069
+ });
11070
+ });
11071
+ };
11014
11072
  /**
11015
11073
  * 取引検索
11016
11074
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "3.104.0-alpha.2",
3
+ "version": "3.104.0-alpha.5",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {
@@ -97,7 +97,7 @@
97
97
  "watchify": "^3.11.1"
98
98
  },
99
99
  "dependencies": {
100
- "@cinerino/api-abstract-client": "3.104.0-alpha.2",
100
+ "@cinerino/api-abstract-client": "3.104.0-alpha.5",
101
101
  "debug": "^3.2.6",
102
102
  "http-status": "^1.4.2",
103
103
  "idtoken-verifier": "^2.0.3",