@cinerino/sdk 12.12.0 → 12.13.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,44 @@
1
+ // tslint:disable:no-console
2
+ // tslint:disable-next-line:no-implicit-dependencies
3
+ import * as client from '../../../../lib/index';
4
+ import * as auth from '../../auth/authAsAdmin';
5
+
6
+ const PROJECT_ID = String(process.env.PROJECT_ID);
7
+ const SELLER_ID = '59d20831e53ebc2b4e774466';
8
+
9
+ // tslint:disable-next-line:max-func-body-length
10
+ async function main() {
11
+ const authClient = await auth.login();
12
+ await authClient.refreshAccessToken();
13
+ const loginTicket = authClient.verifyIdToken({});
14
+ console.log('username is', loginTicket.getUsername());
15
+
16
+ const syncService = await (await client.loadChevreAdmic({
17
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
18
+ auth: authClient
19
+ })).createSyncInstance({
20
+ project: { id: PROJECT_ID },
21
+ seller: { id: SELLER_ID }
22
+ });
23
+
24
+ const result = await syncService.syncEventSeries({
25
+ locationBranchCode: '120',
26
+ // locationBranchCode: 'xxx',
27
+ /**
28
+ * 指定するタイトルコード
29
+ */
30
+ titleCode: '80001',
31
+ // titleCode: 'xxx',
32
+ /**
33
+ * 指定するタイトル枝番
34
+ */
35
+ titleBranchNum: '0'
36
+ });
37
+ console.log(result);
38
+ }
39
+
40
+ main()
41
+ .then(() => {
42
+ console.log('success!');
43
+ })
44
+ .catch(console.error);
@@ -0,0 +1,46 @@
1
+ // tslint:disable:no-console
2
+ // tslint:disable-next-line:no-implicit-dependencies
3
+ import * as client from '../../../../lib/index';
4
+ import * as auth from '../../auth/authAsAdmin';
5
+
6
+ const PROJECT_ID = String(process.env.PROJECT_ID);
7
+ const SELLER_ID = '59d20831e53ebc2b4e774466';
8
+
9
+ // tslint:disable-next-line:max-func-body-length
10
+ async function main() {
11
+ const authClient = await auth.login();
12
+ await authClient.refreshAccessToken();
13
+ const loginTicket = authClient.verifyIdToken({});
14
+ console.log('username is', loginTicket.getUsername());
15
+
16
+ const syncService = await (await client.loadChevreAdmic({
17
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
18
+ auth: authClient
19
+ })).createSyncInstance({
20
+ project: { id: PROJECT_ID },
21
+ seller: { id: SELLER_ID }
22
+ });
23
+
24
+ const result = await syncService.syncEvents({
25
+ locationBranchCode: '120',
26
+ // locationBranchCode: 'xxx',
27
+ roomCode: '30',
28
+ /**
29
+ * 指定するタイトルコード
30
+ */
31
+ titleCode: '99100',
32
+ // titleCode: 'xxx',
33
+ /**
34
+ * 指定するタイトル枝番
35
+ */
36
+ titleBranchNum: '0',
37
+ startDate: new Date()
38
+ });
39
+ console.log(result);
40
+ }
41
+
42
+ main()
43
+ .then(() => {
44
+ console.log('success!');
45
+ })
46
+ .catch(console.error);
@@ -228,6 +228,10 @@ async function main() {
228
228
  name: 'samplePaymentMethodName',
229
229
  additionalProperty: [{ name: 'samplePropertyName', value: 'samplePropertyValue' }],
230
230
  eventIdsAsOrderedItem: eventIds
231
+ // eventIdsAsOrderedItem: []
232
+ // eventIdsAsOrderedItem: ['', '']
233
+ // eventIdsAsOrderedItem: ['xx', 'xx']
234
+ // eventIdsAsOrderedItem: ['xx', 'xxx']
231
235
  },
232
236
  purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
233
237
  })({ paymentService });
@@ -0,0 +1,22 @@
1
+ import { Service } from '../service';
2
+ /**
3
+ * 同期サービス
4
+ */
5
+ export declare class SyncService extends Service {
6
+ syncEventSeries(params: {
7
+ locationBranchCode: string;
8
+ titleCode: string;
9
+ titleBranchNum: string;
10
+ }): Promise<{
11
+ id: string;
12
+ }>;
13
+ syncEvents(params: {
14
+ locationBranchCode: string;
15
+ roomCode: string;
16
+ titleCode: string;
17
+ titleBranchNum: string;
18
+ startDate: Date;
19
+ }): Promise<{
20
+ id: string;
21
+ }>;
22
+ }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.SyncService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ // import * as factory from '../factory';
57
+ var service_1 = require("../service");
58
+ /**
59
+ * 同期サービス
60
+ */
61
+ var SyncService = /** @class */ (function (_super) {
62
+ __extends(SyncService, _super);
63
+ function SyncService() {
64
+ return _super !== null && _super.apply(this, arguments) || this;
65
+ }
66
+ SyncService.prototype.syncEventSeries = function (params) {
67
+ return __awaiter(this, void 0, void 0, function () {
68
+ var _this = this;
69
+ return __generator(this, function (_a) {
70
+ return [2 /*return*/, this.fetch({
71
+ uri: '/tasks/syncEventSeries',
72
+ method: 'POST',
73
+ body: params,
74
+ qs: {},
75
+ expectedStatusCodes: [http_status_1.ACCEPTED]
76
+ })
77
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
78
+ return [2 /*return*/, response.json()];
79
+ }); }); })];
80
+ });
81
+ });
82
+ };
83
+ SyncService.prototype.syncEvents = function (params) {
84
+ return __awaiter(this, void 0, void 0, function () {
85
+ var _this = this;
86
+ return __generator(this, function (_a) {
87
+ return [2 /*return*/, this.fetch({
88
+ uri: '/tasks/syncEvents',
89
+ method: 'POST',
90
+ body: params,
91
+ qs: {},
92
+ expectedStatusCodes: [http_status_1.ACCEPTED]
93
+ })
94
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
95
+ return [2 /*return*/, response.json()];
96
+ }); }); })];
97
+ });
98
+ });
99
+ };
100
+ return SyncService;
101
+ }(service_1.Service));
102
+ exports.SyncService = SyncService;
@@ -0,0 +1,17 @@
1
+ import { IAdditionalOptions, IOptions, IUnset as IUnsetOnService } from './service';
2
+ import type { SyncService } from './chevreAdmic/sync';
3
+ export declare namespace service {
4
+ type IUnset = IUnsetOnService;
5
+ type Sync = SyncService;
6
+ namespace Sync {
7
+ let svc: typeof SyncService | undefined;
8
+ }
9
+ }
10
+ /**
11
+ * COA管理サービス
12
+ */
13
+ export declare class ChevreAdmic {
14
+ options: Pick<IOptions, 'auth' | 'endpoint' | 'disableAutoRetry'>;
15
+ constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'disableAutoRetry'>);
16
+ createSyncInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<SyncService>;
17
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.ChevreAdmic = exports.service = void 0;
51
+ var service;
52
+ (function (service) {
53
+ var Sync;
54
+ (function (Sync) {
55
+ })(Sync = service.Sync || (service.Sync = {}));
56
+ })(service = exports.service || (exports.service = {}));
57
+ /**
58
+ * COA管理サービス
59
+ */
60
+ var ChevreAdmic = /** @class */ (function () {
61
+ function ChevreAdmic(options) {
62
+ this.options = options;
63
+ }
64
+ ChevreAdmic.prototype.createSyncInstance = function (params) {
65
+ return __awaiter(this, void 0, void 0, function () {
66
+ var _a;
67
+ return __generator(this, function (_b) {
68
+ switch (_b.label) {
69
+ case 0:
70
+ if (!(service.Sync.svc === undefined)) return [3 /*break*/, 2];
71
+ _a = service.Sync;
72
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevreAdmic/sync'); })];
73
+ case 1:
74
+ _a.svc = (_b.sent()).SyncService;
75
+ _b.label = 2;
76
+ case 2: return [2 /*return*/, new service.Sync.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
77
+ }
78
+ });
79
+ });
80
+ };
81
+ return ChevreAdmic;
82
+ }());
83
+ exports.ChevreAdmic = ChevreAdmic;
@@ -66,6 +66,7 @@ exports.PaymentService = void 0;
66
66
  var http_status_1 = require("http-status");
67
67
  var factory = require("../factory");
68
68
  var service_1 = require("../service");
69
+ var eventIdsAsOrderedItemRequiredExceptionProjects = ['awashimakisen-production', 'awashimakisen-test'];
69
70
  /**
70
71
  * 決済サービス
71
72
  */
@@ -156,7 +157,7 @@ var PaymentService = /** @class */ (function (_super) {
156
157
  */
157
158
  PaymentService.prototype.authorizeCreditCard = function (params, __) {
158
159
  return __awaiter(this, void 0, void 0, function () {
159
- var object, purpose, amount, issuedThrough, paymentMethod, creditCard, method, paymentMethodId, name, additionalProperty, ticketToken, eventIdsAsOrderedItem;
160
+ var object, purpose, amount, issuedThrough, paymentMethod, creditCard, method, paymentMethodId, name, additionalProperty, ticketToken, eventIdsAsOrderedItem, isException;
160
161
  var _this = this;
161
162
  return __generator(this, function (_a) {
162
163
  object = params.object, purpose = params.purpose;
@@ -166,9 +167,12 @@ var PaymentService = /** @class */ (function (_super) {
166
167
  && (typeof ticketToken !== 'string' || ticketToken === '')) {
167
168
  throw new factory.errors.ArgumentNull('object.paymentMethodId or object.ticketToken');
168
169
  }
169
- // イベントIDリスト必須化(2025-12-10~)
170
- if (!Array.isArray(eventIdsAsOrderedItem) || eventIdsAsOrderedItem.length === 0) {
171
- throw new factory.errors.ArgumentNull('object.eventIdsAsOrderedItem');
170
+ isException = eventIdsAsOrderedItemRequiredExceptionProjects.includes(this.options.project.id);
171
+ if (!isException) {
172
+ // イベントIDリスト必須化(2025-12-10~)
173
+ if (!Array.isArray(eventIdsAsOrderedItem) || eventIdsAsOrderedItem.length === 0) {
174
+ throw new factory.errors.ArgumentNull('object.eventIdsAsOrderedItem');
175
+ }
172
176
  }
173
177
  return [2 /*return*/, this.fetch({
174
178
  uri: "/payment/" + factory.service.paymentService.PaymentServiceType.CreditCard + "/authorize",
@@ -1,4 +1,5 @@
1
1
  import type * as Chevre from './chevre';
2
+ import type * as ChevreAdmic from './chevreAdmic';
2
3
  import type * as ChevreAdmin from './chevreAdmin';
3
4
  import type * as ChevreAsset from './chevreAsset';
4
5
  import type * as ChevreConsole from './chevreConsole';
@@ -18,6 +19,7 @@ import type * as WaiterAdmin from './waiterAdmin';
18
19
  import * as transporters from './transporters';
19
20
  export declare function loadChevre(...params: ConstructorParameters<typeof Chevre.Chevre>): Promise<Chevre.Chevre>;
20
21
  export declare function loadChevreAsset(...params: ConstructorParameters<typeof ChevreAsset.ChevreAsset>): Promise<ChevreAsset.ChevreAsset>;
22
+ export declare function loadChevreAdmic(...params: ConstructorParameters<typeof ChevreAdmic.ChevreAdmic>): Promise<ChevreAdmic.ChevreAdmic>;
21
23
  export declare function loadChevreAdmin(...params: ConstructorParameters<typeof ChevreAdmin.ChevreAdmin>): Promise<ChevreAdmin.ChevreAdmin>;
22
24
  export declare function loadChevreConsole(...params: ConstructorParameters<typeof ChevreConsole.ChevreConsole>): Promise<ChevreConsole.ChevreConsole>;
23
25
  export declare function loadChevrePay(...params: ConstructorParameters<typeof ChevrePay.ChevrePay>): Promise<ChevrePay.ChevrePay>;
@@ -50,5 +52,5 @@ export declare function loadCloudTxc(...params: ConstructorParameters<typeof Clo
50
52
  */
51
53
  export declare function loadCloudTxn(...params: ConstructorParameters<typeof CloudTxn.CloudTxn>): Promise<CloudTxn.CloudTxn>;
52
54
  export declare function loadWaiterAdmin(...params: ConstructorParameters<typeof ChevreAdmin.ChevreAdmin>): Promise<WaiterAdmin.WaiterAdmin>;
53
- export { factory, Chevre as chevre, ChevreAdmin as chevreAdmin, ChevreAsset as chevreAsset, ChevreConsole as chevreConsole, ChevrePay as chevrePay, ChevreTxc as chevreTxc, ChevreTxn as chevreTxn, CloudAdmin as cloudAdmin, CloudAsset as cloudAsset, CloudSearch as cloudSearch, CloudPay as cloudPay, CloudTxc as cloudTxc, CloudTxn as cloudTxn, Pecorino as pecorino, Service as service, WaiterAdmin as waiterAdmin };
55
+ export { factory, Chevre as chevre, ChevreAdmic as chevreAdmic, ChevreAdmin as chevreAdmin, ChevreAsset as chevreAsset, ChevreConsole as chevreConsole, ChevrePay as chevrePay, ChevreTxc as chevreTxc, ChevreTxn as chevreTxn, CloudAdmin as cloudAdmin, CloudAsset as cloudAsset, CloudSearch as cloudSearch, CloudPay as cloudPay, CloudTxc as cloudTxc, CloudTxn as cloudTxn, Pecorino as pecorino, Service as service, WaiterAdmin as waiterAdmin };
54
56
  export { transporters };
@@ -41,7 +41,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
41
41
  return to;
42
42
  };
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.transporters = exports.factory = exports.loadWaiterAdmin = exports.loadCloudTxn = exports.loadCloudTxc = exports.loadCloudPay = exports.loadCloudSearch = exports.loadCloudAsset = exports.loadCloudAdmin = exports.loadService = exports.loadPecorino = exports.loadChevreTxc = exports.loadChevreTxn = exports.loadChevrePay = exports.loadChevreConsole = exports.loadChevreAdmin = exports.loadChevreAsset = exports.loadChevre = void 0;
44
+ exports.transporters = exports.factory = exports.loadWaiterAdmin = exports.loadCloudTxn = exports.loadCloudTxc = exports.loadCloudPay = exports.loadCloudSearch = exports.loadCloudAsset = exports.loadCloudAdmin = exports.loadService = exports.loadPecorino = exports.loadChevreTxc = exports.loadChevreTxn = exports.loadChevrePay = exports.loadChevreConsole = exports.loadChevreAdmin = exports.loadChevreAdmic = exports.loadChevreAsset = exports.loadChevre = void 0;
45
45
  var factory = require("./factory");
46
46
  exports.factory = factory;
47
47
  var transporters = require("./transporters");
@@ -92,6 +92,29 @@ function loadChevreAsset() {
92
92
  });
93
93
  }
94
94
  exports.loadChevreAsset = loadChevreAsset;
95
+ var chevreAdmic;
96
+ // tslint:disable-next-line:no-single-line-block-comment
97
+ /* istanbul ignore next */
98
+ function loadChevreAdmic() {
99
+ var params = [];
100
+ for (var _i = 0; _i < arguments.length; _i++) {
101
+ params[_i] = arguments[_i];
102
+ }
103
+ return __awaiter(this, void 0, void 0, function () {
104
+ return __generator(this, function (_a) {
105
+ switch (_a.label) {
106
+ case 0:
107
+ if (!(chevreAdmic === undefined)) return [3 /*break*/, 2];
108
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevreAdmic'); })];
109
+ case 1:
110
+ chevreAdmic = (_a.sent()).ChevreAdmic;
111
+ _a.label = 2;
112
+ case 2: return [2 /*return*/, new (chevreAdmic.bind.apply(chevreAdmic, __spreadArray([void 0], params)))()];
113
+ }
114
+ });
115
+ });
116
+ }
117
+ exports.loadChevreAdmic = loadChevreAdmic;
95
118
  var chevreAdmin;
96
119
  // tslint:disable-next-line:no-single-line-block-comment
97
120
  /* istanbul ignore next */