@cinerino/sdk 13.1.0 → 13.2.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.
- package/example/src/chevre/default/findAcceptedPaymentMethods.ts +37 -0
- package/lib/abstract/chevre/acceptedPaymentMethod.d.ts +23 -0
- package/lib/abstract/chevre/acceptedPaymentMethod.js +88 -0
- package/lib/abstract/chevre.d.ts +9 -0
- package/lib/abstract/chevre.js +20 -0
- package/lib/abstract/cinerino/service/event.js +1 -4
- package/lib/bundle.js +777 -666
- package/package.json +2 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
+
import * as client from '../../../../lib/index';
|
|
3
|
+
|
|
4
|
+
const { PROJECT_ID } = process.env;
|
|
5
|
+
const SELLER_ID = '59d20831e53ebc2b4e774466';
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const authClient = await client.auth.ClientCredentials.createInstance({
|
|
9
|
+
domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
|
|
10
|
+
clientId: <string>process.env.CHEVRE_CLIENT_ID,
|
|
11
|
+
clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
|
|
12
|
+
scopes: [],
|
|
13
|
+
state: ''
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const acceptedPaymentMethodService = await (await client.loadChevre({
|
|
17
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
18
|
+
auth: authClient
|
|
19
|
+
})).createAcceptedPaymentMethodInstance({
|
|
20
|
+
project: { id: String(PROJECT_ID) },
|
|
21
|
+
seller: { id: SELLER_ID }
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const result = await acceptedPaymentMethodService.findAcceptedPaymentMethods({
|
|
25
|
+
page: 1,
|
|
26
|
+
limit: 10,
|
|
27
|
+
itemOfferedId: 'fmj6ojobe'
|
|
28
|
+
});
|
|
29
|
+
// tslint:disable-next-line:no-null-keyword
|
|
30
|
+
console.dir(result, { depth: null });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
main()
|
|
34
|
+
.then(() => {
|
|
35
|
+
console.log('success!');
|
|
36
|
+
})
|
|
37
|
+
.catch(console.error);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as factory from '../factory';
|
|
2
|
+
import { Service } from '../service';
|
|
3
|
+
export interface IFindParams {
|
|
4
|
+
/**
|
|
5
|
+
* max: 20
|
|
6
|
+
*/
|
|
7
|
+
limit: number;
|
|
8
|
+
page: number;
|
|
9
|
+
/**
|
|
10
|
+
* 提供リソースID
|
|
11
|
+
*/
|
|
12
|
+
itemOfferedId?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare type IAcceptedPaymentMethodAsFindResult = Pick<factory.acceptedPaymentMethodOffer.IAcceptedPaymentMethodOffer, 'id' | 'identifier' | 'itemOffered' | 'validFrom' | 'validThrough' | 'acceptedPaymentMethod'>;
|
|
15
|
+
/**
|
|
16
|
+
* 対応決済方法サービス
|
|
17
|
+
*/
|
|
18
|
+
export declare class AcceptedPaymentMethodService extends Service {
|
|
19
|
+
/**
|
|
20
|
+
* 対応決済方法検索
|
|
21
|
+
*/
|
|
22
|
+
findAcceptedPaymentMethods(params: IFindParams): Promise<IAcceptedPaymentMethodAsFindResult[]>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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.AcceptedPaymentMethodService = void 0;
|
|
55
|
+
var http_status_1 = require("http-status");
|
|
56
|
+
var service_1 = require("../service");
|
|
57
|
+
var BASE_URI = '/acceptedPaymentMethods';
|
|
58
|
+
/**
|
|
59
|
+
* 対応決済方法サービス
|
|
60
|
+
*/
|
|
61
|
+
var AcceptedPaymentMethodService = /** @class */ (function (_super) {
|
|
62
|
+
__extends(AcceptedPaymentMethodService, _super);
|
|
63
|
+
function AcceptedPaymentMethodService() {
|
|
64
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 対応決済方法検索
|
|
68
|
+
*/
|
|
69
|
+
AcceptedPaymentMethodService.prototype.findAcceptedPaymentMethods = function (params) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var _this = this;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
return [2 /*return*/, this.fetch({
|
|
74
|
+
uri: BASE_URI,
|
|
75
|
+
method: 'GET',
|
|
76
|
+
qs: params,
|
|
77
|
+
expectedStatusCodes: [http_status_1.OK],
|
|
78
|
+
stringifyOptions: { arrayFormat: 'repeat' }
|
|
79
|
+
})
|
|
80
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
81
|
+
return [2 /*return*/, response.json()];
|
|
82
|
+
}); }); })];
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
return AcceptedPaymentMethodService;
|
|
87
|
+
}(service_1.Service));
|
|
88
|
+
exports.AcceptedPaymentMethodService = AcceptedPaymentMethodService;
|
package/lib/abstract/chevre.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAdditionalOptions, IOptions, IUnset as IUnsetOnService } from './service';
|
|
2
|
+
import type { AcceptedPaymentMethodService } from './chevre/acceptedPaymentMethod';
|
|
2
3
|
import type { CategoryCodeService } from './chevre/categoryCode';
|
|
3
4
|
import type { CreativeWorkService } from './chevre/creativeWork';
|
|
4
5
|
import type { EmailMessageService } from './chevre/emailMessage';
|
|
@@ -16,6 +17,13 @@ import type { SellerService } from './chevre/seller';
|
|
|
16
17
|
import type { TripService } from './chevre/trip';
|
|
17
18
|
export declare namespace service {
|
|
18
19
|
type IUnset = IUnsetOnService;
|
|
20
|
+
/**
|
|
21
|
+
* 対応決済方法サービス
|
|
22
|
+
*/
|
|
23
|
+
type AcceptedPaymentMethod = AcceptedPaymentMethodService;
|
|
24
|
+
namespace AcceptedPaymentMethod {
|
|
25
|
+
let svc: typeof AcceptedPaymentMethodService | undefined;
|
|
26
|
+
}
|
|
19
27
|
/**
|
|
20
28
|
* 区分サービス
|
|
21
29
|
*/
|
|
@@ -130,6 +138,7 @@ export declare namespace service {
|
|
|
130
138
|
export declare class Chevre {
|
|
131
139
|
options: Pick<IOptions, 'auth' | 'endpoint'>;
|
|
132
140
|
constructor(options: Pick<IOptions, 'auth' | 'endpoint'>);
|
|
141
|
+
createAcceptedPaymentMethodInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<AcceptedPaymentMethodService>;
|
|
133
142
|
createCategoryCodeInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CategoryCodeService>;
|
|
134
143
|
createCreativeWorkInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CreativeWorkService>;
|
|
135
144
|
createEmailMessageInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EmailMessageService>;
|
package/lib/abstract/chevre.js
CHANGED
|
@@ -50,6 +50,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
50
50
|
exports.Chevre = exports.service = void 0;
|
|
51
51
|
var service;
|
|
52
52
|
(function (service) {
|
|
53
|
+
var AcceptedPaymentMethod;
|
|
54
|
+
(function (AcceptedPaymentMethod) {
|
|
55
|
+
})(AcceptedPaymentMethod = service.AcceptedPaymentMethod || (service.AcceptedPaymentMethod = {}));
|
|
53
56
|
var CategoryCode;
|
|
54
57
|
(function (CategoryCode) {
|
|
55
58
|
})(CategoryCode = service.CategoryCode || (service.CategoryCode = {}));
|
|
@@ -106,6 +109,23 @@ var Chevre = /** @class */ (function () {
|
|
|
106
109
|
function Chevre(options) {
|
|
107
110
|
this.options = options;
|
|
108
111
|
}
|
|
112
|
+
Chevre.prototype.createAcceptedPaymentMethodInstance = function (params) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
var _a;
|
|
115
|
+
return __generator(this, function (_b) {
|
|
116
|
+
switch (_b.label) {
|
|
117
|
+
case 0:
|
|
118
|
+
if (!(service.AcceptedPaymentMethod.svc === undefined)) return [3 /*break*/, 2];
|
|
119
|
+
_a = service.AcceptedPaymentMethod;
|
|
120
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevre/acceptedPaymentMethod'); })];
|
|
121
|
+
case 1:
|
|
122
|
+
_a.svc = (_b.sent()).AcceptedPaymentMethodService;
|
|
123
|
+
_b.label = 2;
|
|
124
|
+
case 2: return [2 /*return*/, new service.AcceptedPaymentMethod.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
};
|
|
109
129
|
Chevre.prototype.createCategoryCodeInstance = function (params) {
|
|
110
130
|
return __awaiter(this, void 0, void 0, function () {
|
|
111
131
|
var _a;
|
|
@@ -240,10 +240,7 @@ var EventService = /** @class */ (function (_super) {
|
|
|
240
240
|
case 0: return [4 /*yield*/, response.json()];
|
|
241
241
|
case 1:
|
|
242
242
|
seatOffers = _b.sent();
|
|
243
|
-
return [2 /*return*/, {
|
|
244
|
-
data: seatOffers,
|
|
245
|
-
sectionCode: (_a = seatOffers[0].containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode
|
|
246
|
-
}];
|
|
243
|
+
return [2 /*return*/, __assign({ data: seatOffers }, (seatOffers.length > 0) ? { sectionCode: (_a = seatOffers[0].containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode } : undefined)];
|
|
247
244
|
}
|
|
248
245
|
});
|
|
249
246
|
}); })];
|