@cinerino/sdk 13.0.0 → 13.1.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/cloud/admin/adminAcceptedPaymentMethods.ts +69 -0
- package/example/src/cloud/transaction/processPlaceOrderByCreditCard3DS.ts +32 -7
- 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/chevreConsole/creativeWork.d.ts +1 -8
- package/lib/abstract/chevreConsole/creativeWork.js +22 -33
- package/lib/abstract/chevrePay/payment.d.ts +6 -0
- package/lib/abstract/chevrePay/payment.js +5 -3
- package/lib/abstract/cinerino/service/event.d.ts +2 -2
- 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 +717 -471
- package/package.json +2 -2
|
@@ -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);
|
|
@@ -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 {};
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IUnset, Service } from '../service';
|
|
1
|
+
import { Service } from '../service';
|
|
3
2
|
/**
|
|
4
3
|
* コンテンツサービス
|
|
5
4
|
*/
|
|
6
5
|
export declare class CreativeWorkService extends Service {
|
|
7
|
-
createMovie(params: factory.creativeWork.movie.ICreateParams): Promise<{
|
|
8
|
-
id: string;
|
|
9
|
-
}>;
|
|
10
|
-
updateMovie(params: factory.creativeWork.movie.ICreateParams & {
|
|
11
|
-
id: string;
|
|
12
|
-
} & IUnset): Promise<void>;
|
|
13
6
|
deleteMovie(params: {
|
|
14
7
|
id: string;
|
|
15
8
|
}): Promise<void>;
|
|
@@ -53,6 +53,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
exports.CreativeWorkService = void 0;
|
|
55
55
|
var http_status_1 = require("http-status");
|
|
56
|
+
// import * as factory from '../factory';
|
|
56
57
|
var service_1 = require("../service");
|
|
57
58
|
/**
|
|
58
59
|
* コンテンツサービス
|
|
@@ -62,22 +63,18 @@ var CreativeWorkService = /** @class */ (function (_super) {
|
|
|
62
63
|
function CreativeWorkService() {
|
|
63
64
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}); }); })];
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
};
|
|
66
|
+
// discontinue(2026-02-13~)
|
|
67
|
+
// public async createMovie(
|
|
68
|
+
// params: factory.creativeWork.movie.ICreateParams
|
|
69
|
+
// ): Promise<{ id: string }> {
|
|
70
|
+
// return this.fetch({
|
|
71
|
+
// uri: '/creativeWorks/movie',
|
|
72
|
+
// method: 'POST',
|
|
73
|
+
// body: params,
|
|
74
|
+
// expectedStatusCodes: [CREATED]
|
|
75
|
+
// })
|
|
76
|
+
// .then(async (response) => response.json());
|
|
77
|
+
// }
|
|
81
78
|
// /**
|
|
82
79
|
// * @deprecated use chevreAdmin
|
|
83
80
|
// */
|
|
@@ -115,23 +112,15 @@ var CreativeWorkService = /** @class */ (function (_super) {
|
|
|
115
112
|
// })
|
|
116
113
|
// .then(async (response) => response.json());
|
|
117
114
|
// }
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})];
|
|
128
|
-
case 1:
|
|
129
|
-
_a.sent();
|
|
130
|
-
return [2 /*return*/];
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
};
|
|
115
|
+
// discontinue(2026-02-13~)
|
|
116
|
+
// public async updateMovie(params: factory.creativeWork.movie.ICreateParams & { id: string } & IUnset): Promise<void> {
|
|
117
|
+
// await this.fetch({
|
|
118
|
+
// uri: `/creativeWorks/movie/${encodeURIComponent(String(params.id))}`,
|
|
119
|
+
// method: 'PUT',
|
|
120
|
+
// body: params,
|
|
121
|
+
// expectedStatusCodes: [NO_CONTENT]
|
|
122
|
+
// });
|
|
123
|
+
// }
|
|
135
124
|
CreativeWorkService.prototype.deleteMovie = function (params) {
|
|
136
125
|
return __awaiter(this, void 0, void 0, function () {
|
|
137
126
|
return __generator(this, function (_a) {
|
|
@@ -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,
|
|
@@ -26,10 +26,10 @@ declare type IScreeningEventExtensibleOffer = Omit<factory.event.screeningEvent.
|
|
|
26
26
|
};
|
|
27
27
|
declare type IEvent = Omit<factory.event.screeningEvent.IEvent, 'offers' | 'superEvent'> & {
|
|
28
28
|
offers?: IScreeningEventOffer | IScreeningEventOffer4COA | IScreeningEventExtensibleOffer;
|
|
29
|
-
superEvent: Omit<factory.event.screeningEvent.ISuperEvent, '
|
|
29
|
+
superEvent: Omit<factory.event.screeningEvent.ISuperEvent, 'soundFormat'>;
|
|
30
30
|
};
|
|
31
31
|
declare type IMinimizedEvent = Pick<factory.event.screeningEvent.IEvent, 'additionalProperty' | 'doorTime' | 'endDate' | 'eventStatus' | 'id' | 'location' | 'maximumAttendeeCapacity' | 'remainingAttendeeCapacity' | 'startDate'> & {
|
|
32
|
-
superEvent: Omit<factory.event.screeningEvent.ISuperEvent, '
|
|
32
|
+
superEvent: Omit<factory.event.screeningEvent.ISuperEvent, 'soundFormat'>;
|
|
33
33
|
};
|
|
34
34
|
declare type IEventSeriesAsFindResult = Pick<factory.eventSeries.IEvent, 'additionalProperty' | 'alternativeHeadline' | 'coaInfo' | 'description' | 'dubLanguage' | 'duration' | 'endDate' | 'eventStatus' | 'headline' | 'identifier' | 'kanaName' | 'location' | 'name' | 'offers' | 'organizer' | 'project' | 'soundFormat' | 'startDate' | 'subtitleLanguage' | 'typeOf' | 'workPerformed' | 'subEvent' | 'id'>;
|
|
35
35
|
/**
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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.PaymentMethodService = void 0;
|
|
55
|
+
var index_1 = require("../../index");
|
|
56
|
+
var service_1 = require("../../service");
|
|
57
|
+
/**
|
|
58
|
+
* 決済方法サービス
|
|
59
|
+
*/
|
|
60
|
+
var PaymentMethodService = /** @class */ (function (_super) {
|
|
61
|
+
__extends(PaymentMethodService, _super);
|
|
62
|
+
function PaymentMethodService() {
|
|
63
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 決済方法検索
|
|
67
|
+
* 公開属性のみ
|
|
68
|
+
* 管理者の決済サービス読取権限で使用可能
|
|
69
|
+
*/
|
|
70
|
+
PaymentMethodService.prototype.findPaymentMethods = function (params) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var _a, auth, endpoint, project, seller, chevreAdmin, paymentMethodService;
|
|
73
|
+
return __generator(this, function (_b) {
|
|
74
|
+
switch (_b.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
_a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
|
|
77
|
+
return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
|
|
78
|
+
case 1:
|
|
79
|
+
chevreAdmin = _b.sent();
|
|
80
|
+
return [4 /*yield*/, chevreAdmin.createPaymentMethodInstance({
|
|
81
|
+
project: project,
|
|
82
|
+
seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
|
|
83
|
+
})];
|
|
84
|
+
case 2:
|
|
85
|
+
paymentMethodService = _b.sent();
|
|
86
|
+
return [2 /*return*/, paymentMethodService.findPaymentMethods(params)];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
return PaymentMethodService;
|
|
92
|
+
}(service_1.Service));
|
|
93
|
+
exports.PaymentMethodService = PaymentMethodService;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAdditionalOptions, IOptions, IUnset as IUnsetOnService } from '../service';
|
|
2
|
+
import type { AcceptedPaymentMethodService } from './admin/acceptedPaymentMethod';
|
|
2
3
|
import type { CreativeWorkService } from './admin/creativeWork';
|
|
3
4
|
import type { CustomerService } from './admin/customer';
|
|
4
5
|
import type { EventService } from './admin/event';
|
|
@@ -10,12 +11,20 @@ import type { OfferService } from './admin/offer';
|
|
|
10
11
|
import type { OfferCatalogService } from './admin/offerCatalog';
|
|
11
12
|
import type { OfferCatalogItemService } from './admin/offerCatalogItem';
|
|
12
13
|
import type { OrderService } from './admin/order';
|
|
14
|
+
import type { PaymentMethodService } from './admin/paymentMethod';
|
|
13
15
|
import type { ProductService } from './admin/product';
|
|
14
16
|
import type { ProductOfferService } from './admin/productOffer';
|
|
15
17
|
import type { ReservationService } from './admin/reservation';
|
|
16
18
|
import type { SellerService } from './admin/seller';
|
|
17
19
|
export declare namespace service {
|
|
18
20
|
type IUnset = IUnsetOnService;
|
|
21
|
+
/**
|
|
22
|
+
* 対応決済方法サービス
|
|
23
|
+
*/
|
|
24
|
+
type AcceptedPaymentMethod = AcceptedPaymentMethodService;
|
|
25
|
+
namespace AcceptedPaymentMethod {
|
|
26
|
+
let svc: typeof AcceptedPaymentMethodService | undefined;
|
|
27
|
+
}
|
|
19
28
|
/**
|
|
20
29
|
* コンテンツサービス
|
|
21
30
|
*/
|
|
@@ -93,6 +102,13 @@ export declare namespace service {
|
|
|
93
102
|
namespace Order {
|
|
94
103
|
let svc: typeof OrderService | undefined;
|
|
95
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* 決済方法サービス
|
|
107
|
+
*/
|
|
108
|
+
type PaymentMethod = PaymentMethodService;
|
|
109
|
+
namespace PaymentMethod {
|
|
110
|
+
let svc: typeof PaymentMethodService | undefined;
|
|
111
|
+
}
|
|
96
112
|
/**
|
|
97
113
|
* プロダクトサービス
|
|
98
114
|
*/
|
|
@@ -128,6 +144,7 @@ export declare namespace service {
|
|
|
128
144
|
export declare class CloudAdmin {
|
|
129
145
|
options: Pick<IOptions, 'auth' | 'endpoint' | 'disableAutoRetry'>;
|
|
130
146
|
constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'disableAutoRetry'>);
|
|
147
|
+
createAcceptedPaymentMethodInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<AcceptedPaymentMethodService>;
|
|
131
148
|
createCreativeWorkInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CreativeWorkService>;
|
|
132
149
|
createCustomerInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CustomerService>;
|
|
133
150
|
createEventInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventService>;
|
|
@@ -139,6 +156,7 @@ export declare class CloudAdmin {
|
|
|
139
156
|
createOfferCatalogInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferCatalogService>;
|
|
140
157
|
createOfferCatalogItemInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferCatalogItemService>;
|
|
141
158
|
createOrderInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OrderService>;
|
|
159
|
+
createPaymentMethodInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PaymentMethodService>;
|
|
142
160
|
createProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductService>;
|
|
143
161
|
createProductOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductOfferService>;
|
|
144
162
|
createReservationInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ReservationService>;
|