@cinerino/sdk 13.1.0-alpha.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/example/src/cloud/admin/adminAcceptedPaymentMethods.ts +69 -0
- package/example/src/cloud/transaction/processPlaceOrderByCreditCard3DS.ts +32 -7
- 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/chevreAdmin/acceptedPaymentMethod.d.ts +1 -1
- package/lib/abstract/chevreAdmin/acceptedPaymentMethod.js +1 -1
- package/lib/abstract/chevreAdmin/paymentMethod.d.ts +1 -2
- package/lib/abstract/chevrePay/payment.d.ts +6 -0
- package/lib/abstract/chevrePay/payment.js +5 -3
- package/lib/abstract/cinerino/service/event.js +1 -4
- package/lib/abstract/cloud/admin/acceptedPaymentMethod.d.ts +22 -0
- package/lib/abstract/cloud/admin/acceptedPaymentMethod.js +113 -0
- package/lib/abstract/cloud/admin/paymentMethod.d.ts +13 -0
- package/lib/abstract/cloud/admin/paymentMethod.js +93 -0
- package/lib/abstract/cloud/admin.d.ts +18 -0
- package/lib/abstract/cloud/admin.js +40 -0
- package/lib/abstract/cloud/pay/payment.d.ts +3 -0
- package/lib/abstract/cloud/pay/payment.js +13 -8
- package/lib/bundle.js +1053 -685
- 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,69 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
+
import * as moment from 'moment';
|
|
4
|
+
import * as client from '../../../../lib/index';
|
|
5
|
+
import * as auth from '../../auth/authAsAdmin';
|
|
6
|
+
|
|
7
|
+
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
8
|
+
const SELLER_ID = '59d20831e53ebc2b4e774466';
|
|
9
|
+
/**
|
|
10
|
+
* 対応決済方法利用に設定された施設コンテンツID
|
|
11
|
+
*/
|
|
12
|
+
const EVENT_SERIES_ID = 'fmj6ojobe';
|
|
13
|
+
|
|
14
|
+
async function main() {
|
|
15
|
+
const authClient = await auth.login();
|
|
16
|
+
await authClient.refreshAccessToken();
|
|
17
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
18
|
+
console.log('username is', loginTicket.getUsername());
|
|
19
|
+
|
|
20
|
+
const acceptedPaymentMethodService = await (await client.loadCloudAdmin({
|
|
21
|
+
endpoint: <string>process.env.API_ADMIN_ENDPOINT,
|
|
22
|
+
auth: authClient
|
|
23
|
+
})).createAcceptedPaymentMethodInstance({
|
|
24
|
+
project: { id: PROJECT_ID },
|
|
25
|
+
seller: { id: SELLER_ID }
|
|
26
|
+
});
|
|
27
|
+
const adminPaymentMethodService = await (await client.loadCloudAdmin({
|
|
28
|
+
endpoint: <string>process.env.API_ADMIN_ENDPOINT,
|
|
29
|
+
auth: authClient
|
|
30
|
+
})).createPaymentMethodInstance({
|
|
31
|
+
project: { id: PROJECT_ID },
|
|
32
|
+
seller: { id: SELLER_ID }
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// 対応させたい決済サービス検索
|
|
36
|
+
const paymentServices = await adminPaymentMethodService.findPaymentMethods({
|
|
37
|
+
limit: 20,
|
|
38
|
+
page: 1
|
|
39
|
+
});
|
|
40
|
+
console.log(paymentServices);
|
|
41
|
+
console.log(paymentServices.length, 'paymentServices found');
|
|
42
|
+
|
|
43
|
+
// 対応させたい決済サービス全てについて対応決済方法を作成
|
|
44
|
+
const now = new Date();
|
|
45
|
+
const validFrom = moment(now)
|
|
46
|
+
.toDate();
|
|
47
|
+
const validThrough = moment(validFrom)
|
|
48
|
+
.add(1, 'minutes')
|
|
49
|
+
.toDate();
|
|
50
|
+
await acceptedPaymentMethodService.addAcceptedPaymentMethodsByIdentifier(
|
|
51
|
+
paymentServices.map((paymentService) => ({
|
|
52
|
+
identifier: `Accept${paymentService.serviceType.codeValue}`, // 施設コンテンツ内でユニークなコードを指定
|
|
53
|
+
validFrom,
|
|
54
|
+
validThrough,
|
|
55
|
+
acceptedPaymentMethod: { id: paymentService.id }
|
|
56
|
+
})),
|
|
57
|
+
{
|
|
58
|
+
itemOfferedId: EVENT_SERIES_ID,
|
|
59
|
+
itemOfferedTypeOf: client.factory.eventType.ScreeningEventSeries
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
console.log('added.');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
main()
|
|
66
|
+
.then(() => {
|
|
67
|
+
console.log('success!');
|
|
68
|
+
})
|
|
69
|
+
.catch(console.error);
|
|
@@ -21,6 +21,9 @@ const profile: client.factory.person.IProfile = {
|
|
|
21
21
|
gender: 'some gendedr ##\n##\r##\n\n\n##'
|
|
22
22
|
};
|
|
23
23
|
const paymentMethodType = 'CreditCard3DS';
|
|
24
|
+
/**
|
|
25
|
+
* 決済サービスID
|
|
26
|
+
*/
|
|
24
27
|
const paymentServiceId = '664d98376fb87922bd6a4e52';
|
|
25
28
|
// 取引に使用するクレジットカード
|
|
26
29
|
const creditCard: client.factory.paymentMethod.paymentCard.creditCard.IUncheckedCardRaw = {
|
|
@@ -128,12 +131,36 @@ async function main() {
|
|
|
128
131
|
// tslint:disable-next-line:max-line-length
|
|
129
132
|
const authorizeSeatReservationResults: { price: number }[] = [];
|
|
130
133
|
const eventIds: string[] = [];
|
|
134
|
+
/**
|
|
135
|
+
* 施設コンテンツの対応決済方法オファーIDリスト
|
|
136
|
+
*/
|
|
137
|
+
const acceptedPaymentMethodOfferIds: string[] = [
|
|
138
|
+
'698eae442b3b10551e54fedf'
|
|
139
|
+
];
|
|
131
140
|
|
|
132
141
|
// tslint:disable-next-line:no-increment-decrement
|
|
133
142
|
for (let i = 0; i < numEvents; i++) {
|
|
134
143
|
// イベント決定
|
|
135
144
|
// tslint:disable-next-line:insecure-random
|
|
136
145
|
const screeningEvent: IEvent = availableEvents[Math.floor(availableEvents.length * Math.random())];
|
|
146
|
+
|
|
147
|
+
// 施設コンテンツ参照
|
|
148
|
+
const eventSeries = (await eventService.searchEventSeries({
|
|
149
|
+
limit: 1,
|
|
150
|
+
page: 1,
|
|
151
|
+
typeOf: client.factory.eventType.ScreeningEventSeries,
|
|
152
|
+
id: { $eq: screeningEvent.superEvent.id }
|
|
153
|
+
})).shift();
|
|
154
|
+
if (eventSeries === undefined) {
|
|
155
|
+
throw new Error('eventSeries not found');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
console.log('eventSeries.offers?.typeOf ', eventSeries.offers?.typeOf);
|
|
159
|
+
if (eventSeries.offers?.typeOf === client.factory.offerType.AggregateOffer) {
|
|
160
|
+
// 施設コンテンツが対応決済方法管理に依存している場合、対応決済方法オファーを参照
|
|
161
|
+
// TODO 対応決済方法参照
|
|
162
|
+
}
|
|
163
|
+
|
|
137
164
|
const authorizeSeatReservationResult = await authorizeSeatReservationByEvent({
|
|
138
165
|
event: screeningEvent,
|
|
139
166
|
transaction: transaction
|
|
@@ -180,9 +207,7 @@ async function main() {
|
|
|
180
207
|
},
|
|
181
208
|
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder },
|
|
182
209
|
instrumentOptions: {
|
|
183
|
-
acceptedPaymentMethodOfferIds
|
|
184
|
-
'693e43e6929e69df1e88b189'
|
|
185
|
-
] // TODO
|
|
210
|
+
acceptedPaymentMethodOfferIds
|
|
186
211
|
}
|
|
187
212
|
})({ paymentService });
|
|
188
213
|
console.log('paymentUrl published.', paymentMethodId, paymentUrl);
|
|
@@ -201,7 +226,9 @@ async function main() {
|
|
|
201
226
|
eventIdsAsOrderedItem: eventIds
|
|
202
227
|
},
|
|
203
228
|
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder },
|
|
204
|
-
instrumentOptions: {
|
|
229
|
+
instrumentOptions: {
|
|
230
|
+
acceptedPaymentMethodOfferIds
|
|
231
|
+
}
|
|
205
232
|
})({ paymentService });
|
|
206
233
|
console.log('paymentUrl published.', publishPaymentUrlAsyncForciblySecondResult);
|
|
207
234
|
} catch (error) {
|
|
@@ -244,9 +271,7 @@ async function main() {
|
|
|
244
271
|
},
|
|
245
272
|
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder },
|
|
246
273
|
instrumentOptions: {
|
|
247
|
-
acceptedPaymentMethodOfferIds
|
|
248
|
-
'693e43e6929e69df1e88b189'
|
|
249
|
-
] // TODO
|
|
274
|
+
acceptedPaymentMethodOfferIds
|
|
250
275
|
}
|
|
251
276
|
})({ paymentService });
|
|
252
277
|
console.log('credit card payment authorized', creditCardPaymentAuth.id);
|
|
@@ -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;
|
|
@@ -55,7 +55,7 @@ export declare type IAcceptedPaymentMethodAsFindResult = Pick<factory.acceptedPa
|
|
|
55
55
|
*/
|
|
56
56
|
export declare class AcceptedPaymentMethodService extends Service {
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* コードによる対応決済方法冪等追加
|
|
59
59
|
* プロジェクト+提供リソースID+コードでユニーク
|
|
60
60
|
* 有効期間を過ぎたオファーは自動的に削除されます
|
|
61
61
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
2
|
import { Service } from '../service';
|
|
3
|
-
declare type IPaymentMethodAsFindResult = Pick<factory.service.paymentService.IService, 'additionalProperty' | 'description' | 'name' | 'productID' | 'serviceOutput' | 'serviceType' | 'typeOf'> & {
|
|
3
|
+
export declare type IPaymentMethodAsFindResult = Pick<factory.service.paymentService.IService, 'additionalProperty' | 'description' | 'name' | 'productID' | 'serviceOutput' | 'serviceType' | 'typeOf'> & {
|
|
4
4
|
/**
|
|
5
5
|
* 決済サービスID
|
|
6
6
|
*/
|
|
@@ -58,4 +58,3 @@ export declare class PaymentMethodService extends Service {
|
|
|
58
58
|
*/
|
|
59
59
|
findPaymentMethods(params: IFindParams): Promise<IPaymentMethodAsFindResult[]>;
|
|
60
60
|
}
|
|
61
|
-
export {};
|
|
@@ -52,6 +52,12 @@ export declare class PaymentService extends Service {
|
|
|
52
52
|
ticketToken: string;
|
|
53
53
|
};
|
|
54
54
|
purpose: IPurpose;
|
|
55
|
+
instrumentOptions: {
|
|
56
|
+
/**
|
|
57
|
+
* 対応決済方法オファーIDリスト
|
|
58
|
+
*/
|
|
59
|
+
acceptedPaymentMethodOfferIds: string[];
|
|
60
|
+
};
|
|
55
61
|
}, options: {
|
|
56
62
|
/**
|
|
57
63
|
* 決済カード認証アクションID
|
|
@@ -200,11 +200,12 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
200
200
|
*/
|
|
201
201
|
PaymentService.prototype.authorizeMovieTicket = function (params, options) {
|
|
202
202
|
return __awaiter(this, void 0, void 0, function () {
|
|
203
|
-
var object, purpose, issuedThrough, paymentMethod, movieTickets, name, additionalProperty, ticketToken, checkedActionId;
|
|
203
|
+
var object, purpose, instrumentOptions, issuedThrough, paymentMethod, movieTickets, name, additionalProperty, ticketToken, acceptedPaymentMethodOfferIds, checkedActionId;
|
|
204
204
|
var _this = this;
|
|
205
205
|
return __generator(this, function (_a) {
|
|
206
|
-
object = params.object, purpose = params.purpose;
|
|
206
|
+
object = params.object, purpose = params.purpose, instrumentOptions = params.instrumentOptions;
|
|
207
207
|
issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, movieTickets = object.movieTickets, name = object.name, additionalProperty = object.additionalProperty, ticketToken = object.ticketToken;
|
|
208
|
+
acceptedPaymentMethodOfferIds = instrumentOptions.acceptedPaymentMethodOfferIds;
|
|
208
209
|
checkedActionId = options.checkedActionId;
|
|
209
210
|
return [2 /*return*/, this.fetch({
|
|
210
211
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/authorize",
|
|
@@ -212,7 +213,8 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
212
213
|
expectedStatusCodes: [http_status_1.ACCEPTED, http_status_1.CREATED],
|
|
213
214
|
body: {
|
|
214
215
|
object: __assign(__assign(__assign(__assign({ issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (Array.isArray(movieTickets)) ? { movieTickets: movieTickets } : undefined), (typeof name === 'string') ? { name: name } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
|
|
215
|
-
purpose: purpose
|
|
216
|
+
purpose: purpose,
|
|
217
|
+
instrumentOptions: { acceptedPaymentMethodOfferIds: acceptedPaymentMethodOfferIds }
|
|
216
218
|
},
|
|
217
219
|
qs: {
|
|
218
220
|
checkedActionId: checkedActionId,
|
|
@@ -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
|
}); })];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Service } from '../../service';
|
|
2
|
+
import { ICreateOptions, ICreatingAcceptedPaymentMethod } from '../../chevreAdmin/acceptedPaymentMethod';
|
|
3
|
+
/**
|
|
4
|
+
* 対応決済方法サービス
|
|
5
|
+
*/
|
|
6
|
+
export declare class AcceptedPaymentMethodService extends Service {
|
|
7
|
+
/**
|
|
8
|
+
* コードによる対応決済方法冪等追加
|
|
9
|
+
* プロジェクト+提供リソースID+コードでユニーク
|
|
10
|
+
* 有効期間を過ぎたオファーは自動的に削除されます
|
|
11
|
+
*
|
|
12
|
+
* 編集可能な属性は、
|
|
13
|
+
* - validFrom
|
|
14
|
+
* - validThrough
|
|
15
|
+
* - acceptedPaymentMethod.id
|
|
16
|
+
*/
|
|
17
|
+
addAcceptedPaymentMethodsByIdentifier(
|
|
18
|
+
/**
|
|
19
|
+
* max: 20
|
|
20
|
+
*/
|
|
21
|
+
params: ICreatingAcceptedPaymentMethod[], options: Pick<ICreateOptions, 'itemOfferedId' | 'itemOfferedTypeOf'>): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
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 __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
+
function step(op) {
|
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
+
while (_) try {
|
|
44
|
+
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;
|
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
+
switch (op[0]) {
|
|
47
|
+
case 0: case 1: t = op; break;
|
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
+
default:
|
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
+
if (t[2]) _.ops.pop();
|
|
57
|
+
_.trys.pop(); continue;
|
|
58
|
+
}
|
|
59
|
+
op = body.call(thisArg, _);
|
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.AcceptedPaymentMethodService = void 0;
|
|
66
|
+
var index_1 = require("../../index");
|
|
67
|
+
var service_1 = require("../../service");
|
|
68
|
+
/**
|
|
69
|
+
* 対応決済方法サービス
|
|
70
|
+
*/
|
|
71
|
+
var AcceptedPaymentMethodService = /** @class */ (function (_super) {
|
|
72
|
+
__extends(AcceptedPaymentMethodService, _super);
|
|
73
|
+
function AcceptedPaymentMethodService() {
|
|
74
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* コードによる対応決済方法冪等追加
|
|
78
|
+
* プロジェクト+提供リソースID+コードでユニーク
|
|
79
|
+
* 有効期間を過ぎたオファーは自動的に削除されます
|
|
80
|
+
*
|
|
81
|
+
* 編集可能な属性は、
|
|
82
|
+
* - validFrom
|
|
83
|
+
* - validThrough
|
|
84
|
+
* - acceptedPaymentMethod.id
|
|
85
|
+
*/
|
|
86
|
+
AcceptedPaymentMethodService.prototype.addAcceptedPaymentMethodsByIdentifier = function (
|
|
87
|
+
/**
|
|
88
|
+
* max: 20
|
|
89
|
+
*/
|
|
90
|
+
params, options) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var _a, auth, endpoint, project, seller, chevreAdmin, acceptedPaymentMethodService;
|
|
93
|
+
return __generator(this, function (_b) {
|
|
94
|
+
switch (_b.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
_a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
|
|
97
|
+
return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
|
|
98
|
+
case 1:
|
|
99
|
+
chevreAdmin = _b.sent();
|
|
100
|
+
return [4 /*yield*/, chevreAdmin.createAcceptedPaymentMethodInstance({
|
|
101
|
+
project: project,
|
|
102
|
+
seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
|
|
103
|
+
})];
|
|
104
|
+
case 2:
|
|
105
|
+
acceptedPaymentMethodService = _b.sent();
|
|
106
|
+
return [2 /*return*/, acceptedPaymentMethodService.addAcceptedPaymentMethodsByIdentifier(params, __assign(__assign({}, options), { upsert: true }))];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
return AcceptedPaymentMethodService;
|
|
112
|
+
}(service_1.Service));
|
|
113
|
+
exports.AcceptedPaymentMethodService = AcceptedPaymentMethodService;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Service } from '../../service';
|
|
2
|
+
import { IFindParams, IPaymentMethodAsFindResult } from '../../chevreAdmin/paymentMethod';
|
|
3
|
+
/**
|
|
4
|
+
* 決済方法サービス
|
|
5
|
+
*/
|
|
6
|
+
export declare class PaymentMethodService extends Service {
|
|
7
|
+
/**
|
|
8
|
+
* 決済方法検索
|
|
9
|
+
* 公開属性のみ
|
|
10
|
+
* 管理者の決済サービス読取権限で使用可能
|
|
11
|
+
*/
|
|
12
|
+
findPaymentMethods(params: IFindParams): Promise<IPaymentMethodAsFindResult[]>;
|
|
13
|
+
}
|