@cinerino/sdk 12.5.0-alpha.11 → 12.5.0-alpha.13

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,45 @@
1
+ // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
+ import * as client from '../../../../lib/';
3
+ import * as auth from '../../auth/authAsAdmin';
4
+
5
+ const PROJECT_ID = String(process.env.PROJECT_ID);
6
+ const SELLER_ID = '59d20831e53ebc2b4e774466';
7
+
8
+ async function main() {
9
+ const authClient = await auth.login();
10
+ await authClient.refreshAccessToken();
11
+ const loginTicket = authClient.verifyIdToken({});
12
+ console.log('username is', loginTicket.getUsername());
13
+
14
+ const paymentProductService = await (await client.loadChevreAdmin({
15
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
16
+ auth: authClient
17
+ })).createPaymentProductInstance({
18
+ project: { id: PROJECT_ID },
19
+ seller: { id: SELLER_ID }
20
+ });
21
+
22
+ const data = await paymentProductService.findPaymentServices({
23
+ limit: 10,
24
+ page: 1
25
+ // typeOf: client.factory.service.paymentService.PaymentServiceType.MovieTicket
26
+ // typeOfs: [
27
+ // client.factory.service.paymentService.PaymentServiceType.CreditCard,
28
+ // client.factory.service.paymentService.PaymentServiceType.MovieTicket
29
+ // ],
30
+ // sortByProductID: client.factory.sortType.Descending
31
+ // id: '5f9a52ca4f3709000abe6490'
32
+ // ids: ['5f9a52ca4f3709000abe6490', '5f9a52994f3709000abe6417'],
33
+ // nameRegex: 'Surf',
34
+ // productID: 'xxx',
35
+ // productIDRegex: 'Surf',
36
+ });
37
+ console.log(data);
38
+ console.log(data.length);
39
+ }
40
+
41
+ main()
42
+ .then(() => {
43
+ console.log('main processed.');
44
+ })
45
+ .catch(console.error);
@@ -0,0 +1,62 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ declare type IPaymentServiceAsFindResult = Pick<factory.service.paymentService.IService, 'additionalProperty' | 'description' | 'name' | 'productID' | 'serviceOutput' | 'serviceType' | 'typeOf'> & {
4
+ /**
5
+ * 決済サービスID
6
+ */
7
+ id: string;
8
+ project?: never;
9
+ };
10
+ export interface IFindParams {
11
+ /**
12
+ * max: 20
13
+ */
14
+ limit: number;
15
+ /**
16
+ * min: 1
17
+ */
18
+ page: number;
19
+ sortByProductID?: factory.sortType;
20
+ availableChannelId?: string;
21
+ id?: string;
22
+ ids?: string[];
23
+ nameRegex?: string;
24
+ productID?: string;
25
+ productIDs?: string[];
26
+ productIDRegex?: string;
27
+ /**
28
+ * プロバイダーに指定IDの販売者が含まれる
29
+ */
30
+ providerId?: string;
31
+ typeOf?: factory.service.paymentService.PaymentServiceType;
32
+ typeOfs?: factory.service.paymentService.PaymentServiceType[];
33
+ /**
34
+ * Invoice or Permit
35
+ */
36
+ serviceOutputTypeOf?: string;
37
+ /**
38
+ * 出力通貨区分コード
39
+ */
40
+ currencyType?: string;
41
+ /**
42
+ * 出力メンバーシップ区分コード
43
+ */
44
+ membershipType?: string;
45
+ /**
46
+ * 決済方法区分
47
+ */
48
+ paymentMethodType?: string;
49
+ }
50
+ /**
51
+ * 決済商品サービス
52
+ */
53
+ export declare class PaymentProductService extends Service {
54
+ /**
55
+ * 決済サービス検索
56
+ * 公開属性のみ
57
+ * 管理者の決済サービス読取権限で使用可能
58
+ * 2025-10-18~
59
+ */
60
+ findPaymentServices(params: IFindParams): Promise<IPaymentServiceAsFindResult[]>;
61
+ }
62
+ export {};
@@ -0,0 +1,90 @@
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.PaymentProductService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ var BASE_URI = '/paymentServices';
58
+ /**
59
+ * 決済商品サービス
60
+ */
61
+ var PaymentProductService = /** @class */ (function (_super) {
62
+ __extends(PaymentProductService, _super);
63
+ function PaymentProductService() {
64
+ return _super !== null && _super.apply(this, arguments) || this;
65
+ }
66
+ /**
67
+ * 決済サービス検索
68
+ * 公開属性のみ
69
+ * 管理者の決済サービス読取権限で使用可能
70
+ * 2025-10-18~
71
+ */
72
+ PaymentProductService.prototype.findPaymentServices = function (params) {
73
+ return __awaiter(this, void 0, void 0, function () {
74
+ var _this = this;
75
+ return __generator(this, function (_a) {
76
+ return [2 /*return*/, this.fetch({
77
+ uri: BASE_URI,
78
+ method: 'GET',
79
+ qs: params,
80
+ expectedStatusCodes: [http_status_1.OK]
81
+ })
82
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
83
+ return [2 /*return*/, response.json()];
84
+ }); }); })];
85
+ });
86
+ });
87
+ };
88
+ return PaymentProductService;
89
+ }(service_1.Service));
90
+ exports.PaymentProductService = PaymentProductService;
@@ -13,6 +13,7 @@ import type { OfferService } from './chevreAdmin/offer';
13
13
  import type { OfferCatalogService } from './chevreAdmin/offerCatalog';
14
14
  import type { OfferCatalogItemService } from './chevreAdmin/offerCatalogItem';
15
15
  import type { OrderService } from './chevreAdmin/order';
16
+ import type { PaymentProductService } from './chevreAdmin/paymentService';
16
17
  import type { ProductService } from './chevreAdmin/product';
17
18
  import type { ProductOfferService } from './chevreAdmin/productOffer';
18
19
  import type { ReservationService } from './chevreAdmin/reservation';
@@ -89,6 +90,13 @@ export declare namespace service {
89
90
  namespace Order {
90
91
  let svc: typeof OrderService | undefined;
91
92
  }
93
+ /**
94
+ * 決済商品サービス
95
+ */
96
+ type PaymentProduct = PaymentProductService;
97
+ namespace PaymentProduct {
98
+ let svc: typeof PaymentProductService | undefined;
99
+ }
92
100
  /**
93
101
  * プロダクトサービス
94
102
  */
@@ -164,6 +172,7 @@ export declare class ChevreAdmin {
164
172
  createNoteInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<NoteService>;
165
173
  createNoteAboutOrderInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<NoteAboutOrderService>;
166
174
  createOrderInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OrderService>;
175
+ createPaymentProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PaymentProductService>;
167
176
  createProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductService>;
168
177
  createProductOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductOfferService>;
169
178
  createReservationInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ReservationService>;
@@ -80,6 +80,9 @@ var service;
80
80
  var Order;
81
81
  (function (Order) {
82
82
  })(Order = service.Order || (service.Order = {}));
83
+ var PaymentProduct;
84
+ (function (PaymentProduct) {
85
+ })(PaymentProduct = service.PaymentProduct || (service.PaymentProduct = {}));
83
86
  var Product;
84
87
  (function (Product) {
85
88
  })(Product = service.Product || (service.Product = {}));
@@ -285,6 +288,23 @@ var ChevreAdmin = /** @class */ (function () {
285
288
  });
286
289
  });
287
290
  };
291
+ ChevreAdmin.prototype.createPaymentProductInstance = function (params) {
292
+ return __awaiter(this, void 0, void 0, function () {
293
+ var _a;
294
+ return __generator(this, function (_b) {
295
+ switch (_b.label) {
296
+ case 0:
297
+ if (!(service.PaymentProduct.svc === undefined)) return [3 /*break*/, 2];
298
+ _a = service.PaymentProduct;
299
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevreAdmin/paymentService'); })];
300
+ case 1:
301
+ _a.svc = (_b.sent()).PaymentProductService;
302
+ _b.label = 2;
303
+ case 2: return [2 /*return*/, new service.PaymentProduct.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
304
+ }
305
+ });
306
+ });
307
+ };
288
308
  ChevreAdmin.prototype.createProductInstance = function (params) {
289
309
  return __awaiter(this, void 0, void 0, function () {
290
310
  var _a;
@@ -39,15 +39,16 @@ export declare class OfferCatalogService extends Service {
39
39
  id: string;
40
40
  }): Promise<void>;
41
41
  /**
42
- * カタログ複数編集
42
+ * IDリストでカタログ複数編集
43
+ * 要素のpush,pullを同時指定した場合400
43
44
  */
44
- updateMany(params: {
45
+ updateManyOfferCatalogsByIds(params: {
45
46
  id: {
46
47
  $in: string[];
47
48
  };
48
49
  $push: {
49
50
  itemListElement: {
50
- $each: factory.offerCatalog.IItemListElement[];
51
+ $each: factory.offerCatalog.IItemListElementAsAggregateOffer[];
51
52
  };
52
53
  };
53
54
  $pull: {
@@ -59,6 +60,8 @@ export declare class OfferCatalogService extends Service {
59
60
  };
60
61
  };
61
62
  };
63
+ }, options: {
64
+ itemOfferedTypeOf: factory.product.ProductType;
62
65
  }): Promise<void>;
63
66
  /**
64
67
  * カタログ削除
@@ -132,18 +132,23 @@ var OfferCatalogService = /** @class */ (function (_super) {
132
132
  });
133
133
  };
134
134
  /**
135
- * カタログ複数編集
135
+ * IDリストでカタログ複数編集
136
+ * 要素のpush,pullを同時指定した場合400
136
137
  */
137
- OfferCatalogService.prototype.updateMany = function (params) {
138
+ OfferCatalogService.prototype.updateManyOfferCatalogsByIds = function (params, options) {
138
139
  return __awaiter(this, void 0, void 0, function () {
140
+ var itemOfferedTypeOf;
139
141
  return __generator(this, function (_a) {
140
142
  switch (_a.label) {
141
- case 0: return [4 /*yield*/, this.fetch({
142
- uri: "/offerCatalogs",
143
- method: 'PATCH',
144
- body: params,
145
- expectedStatusCodes: [http_status_1.NO_CONTENT]
146
- })];
143
+ case 0:
144
+ itemOfferedTypeOf = options.itemOfferedTypeOf;
145
+ return [4 /*yield*/, this.fetch({
146
+ uri: "/offerCatalogs",
147
+ method: 'PATCH',
148
+ body: params,
149
+ qs: { itemOfferedTypeOf: itemOfferedTypeOf },
150
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
151
+ })];
147
152
  case 1:
148
153
  _a.sent();
149
154
  return [2 /*return*/];
@@ -6,13 +6,6 @@ declare type ISavingAvailableChannel = Pick<factory.service.paymentService.IAvai
6
6
  declare type ISavingPaymentService = Pick<factory.service.paymentService.IService, 'additionalProperty' | 'description' | 'name' | 'productID' | 'project' | 'serviceOutput' | 'serviceType' | 'typeOf' | 'potentialAction'> & {
7
7
  availableChannel: ISavingAvailableChannel;
8
8
  };
9
- export declare type IPaymentServiceWithoutCredentials = Omit<factory.service.paymentService.IService, 'availableChannel' | 'potentialAction'> & {
10
- id: string;
11
- };
12
- declare type IKeyOfProjection = Exclude<keyof factory.service.paymentService.IService, 'id' | 'availableChannel' | 'potentialAction'>;
13
- declare type IProjection = {
14
- [key in IKeyOfProjection]?: 1;
15
- };
16
9
  /**
17
10
  * 決済商品サービス
18
11
  */
@@ -23,12 +16,6 @@ export declare class PaymentProductService extends Service {
23
16
  createPaymentService(params: ISavingPaymentService): Promise<{
24
17
  id: string;
25
18
  }>;
26
- /**
27
- * 決済サービス検索
28
- */
29
- searchPaymentServices(params: Omit<factory.service.paymentService.ISearchConditions, 'project'> & {
30
- $projection?: IProjection;
31
- }): Promise<IPaymentServiceWithoutCredentials[]>;
32
19
  findPaymentServiceById(params: {
33
20
  id: string;
34
21
  }): Promise<Omit<factory.service.paymentService.IService, 'availableChannel' | 'typeOf'> & {
@@ -65,6 +65,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
65
65
  exports.PaymentProductService = void 0;
66
66
  var http_status_1 = require("http-status");
67
67
  var service_1 = require("../service");
68
+ // type IPaymentServiceWithoutCredentials = Omit<
69
+ // factory.service.paymentService.IService,
70
+ // 'availableChannel' | 'potentialAction'
71
+ // > & { id: string };
72
+ // type IKeyOfProjection = Exclude<keyof factory.service.paymentService.IService, 'id' | 'availableChannel' | 'potentialAction'>;
73
+ // type IProjection = {
74
+ // [key in IKeyOfProjection]?: 1;
75
+ // };
68
76
  /**
69
77
  * 決済商品サービス
70
78
  */
@@ -92,25 +100,21 @@ var PaymentProductService = /** @class */ (function (_super) {
92
100
  });
93
101
  });
94
102
  };
95
- /**
96
- * 決済サービス検索
97
- */
98
- PaymentProductService.prototype.searchPaymentServices = function (params) {
99
- return __awaiter(this, void 0, void 0, function () {
100
- var _this = this;
101
- return __generator(this, function (_a) {
102
- return [2 /*return*/, this.fetch({
103
- uri: '/paymentServices',
104
- method: 'GET',
105
- qs: params,
106
- expectedStatusCodes: [http_status_1.OK]
107
- })
108
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
109
- return [2 /*return*/, response.json()];
110
- }); }); })];
111
- });
112
- });
113
- };
103
+ // migrate to admin service(2025-10-18~)
104
+ // /**
105
+ // * 決済サービス検索
106
+ // */
107
+ // public async searchPaymentServices(params: Omit<factory.service.paymentService.ISearchConditions, 'project'> & {
108
+ // $projection?: IProjection;
109
+ // }): Promise<IPaymentServiceWithoutCredentials[]> {
110
+ // return this.fetch({
111
+ // uri: '/paymentServices',
112
+ // method: 'GET',
113
+ // qs: params,
114
+ // expectedStatusCodes: [OK]
115
+ // })
116
+ // .then(async (response) => response.json());
117
+ // }
114
118
  PaymentProductService.prototype.findPaymentServiceById = function (params) {
115
119
  return __awaiter(this, void 0, void 0, function () {
116
120
  var id, query;
@@ -36,12 +36,6 @@ export declare class ProductService extends Service {
36
36
  createIfNotExist(params: factory.product.ICreateParams): Promise<{
37
37
  id: string;
38
38
  }>;
39
- /**
40
- * プロダクト検索
41
- * 公開属性のみ
42
- * @deprecated use admin service
43
- */
44
- findProductsLegacy(params: IFindParams): Promise<IProductAsFindResult[]>;
45
39
  findProductById(params: {
46
40
  id: string;
47
41
  } & {
@@ -113,27 +113,21 @@ var ProductService = /** @class */ (function (_super) {
113
113
  });
114
114
  });
115
115
  };
116
- /**
117
- * プロダクト検索
118
- * 公開属性のみ
119
- * @deprecated use admin service
120
- */
121
- ProductService.prototype.findProductsLegacy = function (params) {
122
- return __awaiter(this, void 0, void 0, function () {
123
- var _this = this;
124
- return __generator(this, function (_a) {
125
- return [2 /*return*/, this.fetch({
126
- uri: BASE_URI,
127
- method: 'GET',
128
- qs: params,
129
- expectedStatusCodes: [http_status_1.OK]
130
- })
131
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
132
- return [2 /*return*/, response.json()];
133
- }); }); })];
134
- });
135
- });
136
- };
116
+ // migrate to admin service(2025-10-18~)
117
+ // /**
118
+ // * プロダクト検索
119
+ // * 公開属性のみ
120
+ // * @deprecated use admin service
121
+ // */
122
+ // public async findProductsLegacy(params: IFindParams): Promise<IProductAsFindResult[]> {
123
+ // return this.fetch({
124
+ // uri: BASE_URI,
125
+ // method: 'GET',
126
+ // qs: params,
127
+ // expectedStatusCodes: [OK]
128
+ // })
129
+ // .then(async (response) => response.json());
130
+ // }
137
131
  ProductService.prototype.findProductById = function (params) {
138
132
  return __awaiter(this, void 0, void 0, function () {
139
133
  var id, query;