@cinerino/sdk 3.34.0-alpha.2 → 3.36.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/playground/public/lib/bundle.js +45 -53
- package/example/src/chevre/findPerson.ts +33 -0
- package/example/src/st/person/searchCreditCards.ts +59 -0
- package/example/src/st/person/searchMemberships.ts +7 -2
- package/example/src/st/person/searchPaymentCards.ts +24 -2
- package/example/src/st/person/searchReservations.ts +13 -0
- package/example/src/st/searchScreeningRooms.ts +45 -0
- package/example/src/st/searchSellers.ts +45 -0
- package/example/src/transaction/processReturnOrder.ts +0 -19
- package/lib/auth/implicitGrantClient.js +1 -0
- package/lib/auth/oAuth2client.js +12 -20
- package/lib/bundle.js +322 -330
- package/package.json +2 -2
- package/CHANGELOG.md +0 -847
- package/example/.gitignore +0 -1
- package/example/playground/.gitignore +0 -15
|
@@ -143,6 +143,7 @@ var ImplicitGrantClient = /** @class */ (function (_super) {
|
|
|
143
143
|
switch (_a.label) {
|
|
144
144
|
case 0:
|
|
145
145
|
if (!(this.credentials.accessToken === undefined)) return [3 /*break*/, 2];
|
|
146
|
+
if (!(typeof this.credentials.refreshToken === 'string' && this.credentials.refreshToken.length > 0)) return [3 /*break*/, 2];
|
|
146
147
|
return [4 /*yield*/, this.refreshAccessToken()];
|
|
147
148
|
case 1:
|
|
148
149
|
_a.sent();
|
|
@@ -1141,7 +1142,7 @@ var OAuth2client = /** @class */ (function () {
|
|
|
1141
1142
|
throw new Error('No access or refresh token is set.');
|
|
1142
1143
|
}
|
|
1143
1144
|
shouldRefresh = (this.credentials.access_token === undefined) || isTokenExpired;
|
|
1144
|
-
if (!(shouldRefresh && this.credentials.refresh_token
|
|
1145
|
+
if (!(shouldRefresh && typeof this.credentials.refresh_token === 'string' && this.credentials.refresh_token.length > 0)) return [3 /*break*/, 2];
|
|
1145
1146
|
return [4 /*yield*/, this.refreshAccessToken()];
|
|
1146
1147
|
case 1:
|
|
1147
1148
|
_a.sent();
|
|
@@ -1214,10 +1215,10 @@ var OAuth2client = /** @class */ (function () {
|
|
|
1214
1215
|
numberOfTry = 0;
|
|
1215
1216
|
_c.label = 1;
|
|
1216
1217
|
case 1:
|
|
1217
|
-
if (!(numberOfTry >= 0)) return [3 /*break*/,
|
|
1218
|
+
if (!(numberOfTry >= 0)) return [3 /*break*/, 10];
|
|
1218
1219
|
_c.label = 2;
|
|
1219
1220
|
case 2:
|
|
1220
|
-
_c.trys.push([2, 5, ,
|
|
1221
|
+
_c.trys.push([2, 5, , 9]);
|
|
1221
1222
|
numberOfTry += 1;
|
|
1222
1223
|
if (numberOfTry > 1) {
|
|
1223
1224
|
retry = false;
|
|
@@ -1230,29 +1231,21 @@ var OAuth2client = /** @class */ (function () {
|
|
|
1230
1231
|
return [4 /*yield*/, this.makeFetch(url, options, expectedStatusCodes)];
|
|
1231
1232
|
case 4:
|
|
1232
1233
|
result = _c.sent();
|
|
1233
|
-
return [3 /*break*/,
|
|
1234
|
+
return [3 /*break*/, 10];
|
|
1234
1235
|
case 5:
|
|
1235
1236
|
error_1 = _c.sent();
|
|
1236
|
-
if (!(error_1 instanceof Error)) return [3 /*break*/,
|
|
1237
|
+
if (!(error_1 instanceof Error)) return [3 /*break*/, 8];
|
|
1237
1238
|
statusCode = error_1.code;
|
|
1238
|
-
if (!(retry && (statusCode === http_status_1.UNAUTHORIZED || statusCode === http_status_1.FORBIDDEN))) return [3 /*break*/,
|
|
1239
|
-
|
|
1240
|
-
* to handle expiration-related failures. If refreshing the token
|
|
1241
|
-
* does not fix the failure, then refreshing again probably won't
|
|
1242
|
-
* help */
|
|
1243
|
-
// Force token refresh
|
|
1239
|
+
if (!(retry && (statusCode === http_status_1.UNAUTHORIZED || statusCode === http_status_1.FORBIDDEN))) return [3 /*break*/, 8];
|
|
1240
|
+
if (!(typeof this.credentials.refresh_token === 'string' && this.credentials.refresh_token.length > 0)) return [3 /*break*/, 7];
|
|
1244
1241
|
return [4 /*yield*/, this.refreshAccessToken()];
|
|
1245
1242
|
case 6:
|
|
1246
|
-
/* It only makes sense to retry once, because the retry is intended
|
|
1247
|
-
* to handle expiration-related failures. If refreshing the token
|
|
1248
|
-
* does not fix the failure, then refreshing again probably won't
|
|
1249
|
-
* help */
|
|
1250
|
-
// Force token refresh
|
|
1251
1243
|
_c.sent();
|
|
1252
|
-
|
|
1253
|
-
case 7:
|
|
1254
|
-
case 8:
|
|
1255
|
-
case 9: return [
|
|
1244
|
+
_c.label = 7;
|
|
1245
|
+
case 7: return [3 /*break*/, 1];
|
|
1246
|
+
case 8: throw error_1;
|
|
1247
|
+
case 9: return [3 /*break*/, 1];
|
|
1248
|
+
case 10: return [2 /*return*/, result];
|
|
1256
1249
|
}
|
|
1257
1250
|
});
|
|
1258
1251
|
});
|
|
@@ -8351,7 +8344,7 @@ var PersonService = /** @class */ (function (_super) {
|
|
|
8351
8344
|
uri: "/people/" + id,
|
|
8352
8345
|
method: 'GET',
|
|
8353
8346
|
expectedStatusCodes: [http_status_1.OK],
|
|
8354
|
-
qs: { iss: params.iss }
|
|
8347
|
+
qs: { iss: params.iss, replaceNewUserPool: params.replaceNewUserPool }
|
|
8355
8348
|
})
|
|
8356
8349
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
8357
8350
|
return [2 /*return*/, response.json()];
|
|
@@ -13711,37 +13704,7 @@ var PersonOwnershipInfoService = /** @class */ (function (_super) {
|
|
|
13711
13704
|
});
|
|
13712
13705
|
};
|
|
13713
13706
|
/**
|
|
13714
|
-
*
|
|
13715
|
-
*/
|
|
13716
|
-
// public async openAccount(params: {
|
|
13717
|
-
// /**
|
|
13718
|
-
// * 未指定の場合`me`がセットされます
|
|
13719
|
-
// */
|
|
13720
|
-
// id?: string;
|
|
13721
|
-
// /**
|
|
13722
|
-
// * 口座名義
|
|
13723
|
-
// */
|
|
13724
|
-
// name: string;
|
|
13725
|
-
// /**
|
|
13726
|
-
// * 口座タイプ
|
|
13727
|
-
// */
|
|
13728
|
-
// accountType: string;
|
|
13729
|
-
// }): Promise<factory.transaction.placeOrder.IResult> {
|
|
13730
|
-
// const id = (typeof params.id === 'string') ? params.id : 'me';
|
|
13731
|
-
// return this.fetch({
|
|
13732
|
-
// uri: `/people/${id}/ownershipInfos/accounts/${params.accountType}`,
|
|
13733
|
-
// method: 'POST',
|
|
13734
|
-
// body: {
|
|
13735
|
-
// name: params.name
|
|
13736
|
-
// },
|
|
13737
|
-
// expectedStatusCodes: [CREATED]
|
|
13738
|
-
// })
|
|
13739
|
-
// .then(async (response) => response.json());
|
|
13740
|
-
// }
|
|
13741
|
-
/**
|
|
13742
|
-
* 口座解約
|
|
13743
|
-
* 口座の状態を変更するだけで、ユーザーの所有する口座リストから削除はされません。
|
|
13744
|
-
* 解約された口座で取引を進行しようとすると400エラーとなります。
|
|
13707
|
+
* ペイメントカード所有権削除
|
|
13745
13708
|
*/
|
|
13746
13709
|
PersonOwnershipInfoService.prototype.closeAccount = function (params) {
|
|
13747
13710
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -13765,7 +13728,14 @@ var PersonOwnershipInfoService = /** @class */ (function (_super) {
|
|
|
13765
13728
|
/**
|
|
13766
13729
|
* 口座取引履歴検索
|
|
13767
13730
|
*/
|
|
13768
|
-
PersonOwnershipInfoService.prototype.searchAccountMoneyTransferActions = function (params
|
|
13731
|
+
PersonOwnershipInfoService.prototype.searchAccountMoneyTransferActions = function (params
|
|
13732
|
+
// params: factory.account.action.moneyTransfer.ISearchConditions & {
|
|
13733
|
+
// /**
|
|
13734
|
+
// * 未指定の場合`me`がセットされます
|
|
13735
|
+
// */
|
|
13736
|
+
// id?: string;
|
|
13737
|
+
// }
|
|
13738
|
+
) {
|
|
13769
13739
|
return __awaiter(this, void 0, void 0, function () {
|
|
13770
13740
|
var id;
|
|
13771
13741
|
var _this = this;
|
|
@@ -13939,6 +13909,28 @@ var PersonOwnershipInfoService = /** @class */ (function (_super) {
|
|
|
13939
13909
|
});
|
|
13940
13910
|
});
|
|
13941
13911
|
};
|
|
13912
|
+
/**
|
|
13913
|
+
* 会員所有権削除
|
|
13914
|
+
*/
|
|
13915
|
+
PersonOwnershipInfoService.prototype.deleteOwnershipInfoById = function (params) {
|
|
13916
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
13917
|
+
var id;
|
|
13918
|
+
return __generator(this, function (_a) {
|
|
13919
|
+
switch (_a.label) {
|
|
13920
|
+
case 0:
|
|
13921
|
+
id = (typeof params.id === 'string') ? params.id : 'me';
|
|
13922
|
+
return [4 /*yield*/, this.fetch({
|
|
13923
|
+
uri: "/people/" + id + "/ownershipInfos/" + String(params.ownershipInfoId),
|
|
13924
|
+
method: 'DELETE',
|
|
13925
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
13926
|
+
})];
|
|
13927
|
+
case 1:
|
|
13928
|
+
_a.sent();
|
|
13929
|
+
return [2 /*return*/];
|
|
13930
|
+
}
|
|
13931
|
+
});
|
|
13932
|
+
});
|
|
13933
|
+
};
|
|
13942
13934
|
return PersonOwnershipInfoService;
|
|
13943
13935
|
}(service_1.Service));
|
|
13944
13936
|
exports.PersonOwnershipInfoService = PersonOwnershipInfoService;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// tslint:disable:no-implicit-dependencies no-console no-magic-numbers
|
|
2
|
+
import * as client from '../../../lib/';
|
|
3
|
+
|
|
4
|
+
const project = { id: process.env.PROJECT_ID };
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
const authClient = new client.auth.ClientCredentials({
|
|
8
|
+
domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
|
|
9
|
+
clientId: <string>process.env.CHEVRE_CLIENT_ID,
|
|
10
|
+
clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
|
|
11
|
+
scopes: [],
|
|
12
|
+
state: ''
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const personService = new client.chevre.service.Person({
|
|
16
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
17
|
+
auth: authClient,
|
|
18
|
+
project
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const data = await personService.findById({
|
|
22
|
+
iss: '',
|
|
23
|
+
id: '708b007c-79e2-4a3f-8f7a-4bcfc56f4583',
|
|
24
|
+
replaceNewUserPool: '1'
|
|
25
|
+
});
|
|
26
|
+
console.log(data);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
main()
|
|
30
|
+
.then(() => {
|
|
31
|
+
console.log('main processed.');
|
|
32
|
+
})
|
|
33
|
+
.catch(console.error);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// tslint:disable:no-console no-implicit-dependencies no-magic-numbers
|
|
2
|
+
import * as httpStatus from 'http-status';
|
|
3
|
+
// import * as moment from 'moment';
|
|
4
|
+
|
|
5
|
+
import * as client from '../../../../lib/index';
|
|
6
|
+
import * as auth from '../../auth/auth';
|
|
7
|
+
|
|
8
|
+
// tslint:disable-next-line:max-func-body-length
|
|
9
|
+
async function main() {
|
|
10
|
+
const authClient = await auth.login();
|
|
11
|
+
await authClient.refreshAccessToken();
|
|
12
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
13
|
+
console.log('username is', loginTicket.getUsername());
|
|
14
|
+
|
|
15
|
+
const personService = new client.service.Person({
|
|
16
|
+
endpoint: <string>process.env.ST_API_ENDPOINT,
|
|
17
|
+
auth: authClient
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
console.log('searching...');
|
|
21
|
+
const result = await personService.fetch({
|
|
22
|
+
uri: '/people/me/ownershipInfos/creditCards',
|
|
23
|
+
method: 'GET',
|
|
24
|
+
qs: {},
|
|
25
|
+
expectedStatusCodes: [httpStatus.OK]
|
|
26
|
+
})
|
|
27
|
+
.then(async (response) => response.json());
|
|
28
|
+
console.log(result);
|
|
29
|
+
|
|
30
|
+
if (result.length > 0) {
|
|
31
|
+
// 削除
|
|
32
|
+
await personService.fetch({
|
|
33
|
+
uri: `/people/me/ownershipInfos/creditCards/${result[0].cardSeq}`,
|
|
34
|
+
method: 'DELETE',
|
|
35
|
+
expectedStatusCodes: [httpStatus.NO_CONTENT]
|
|
36
|
+
});
|
|
37
|
+
console.log('credit card deleted.');
|
|
38
|
+
|
|
39
|
+
// 追加
|
|
40
|
+
const addedCreditCard = await personService.fetch({
|
|
41
|
+
uri: `/people/me/ownershipInfos/creditCards`,
|
|
42
|
+
method: 'POST',
|
|
43
|
+
expectedStatusCodes: [httpStatus.CREATED],
|
|
44
|
+
body: {
|
|
45
|
+
token: 'xxx'
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
.then(async (response) => response.json());
|
|
49
|
+
console.log('credit card added.', addedCreditCard);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
main()
|
|
54
|
+
.then(() => {
|
|
55
|
+
console.log('main processed.');
|
|
56
|
+
})
|
|
57
|
+
.catch((err) => {
|
|
58
|
+
console.error(err);
|
|
59
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// tslint:disable:no-console no-implicit-dependencies no-magic-numbers
|
|
2
2
|
import * as httpStatus from 'http-status';
|
|
3
|
-
|
|
3
|
+
import * as moment from 'moment';
|
|
4
4
|
|
|
5
5
|
import * as client from '../../../../lib/index';
|
|
6
6
|
import * as auth from '../../auth/auth';
|
|
@@ -18,12 +18,17 @@ async function main() {
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
console.log('searching...');
|
|
21
|
+
const now = new Date();
|
|
21
22
|
const result = await personService.fetch({
|
|
22
23
|
uri: '/people/me/ownershipInfos/MembershipService',
|
|
23
24
|
method: 'GET',
|
|
24
25
|
qs: {
|
|
25
26
|
limit: 10,
|
|
26
|
-
page: 1
|
|
27
|
+
page: 1,
|
|
28
|
+
ownedFrom: moment(now)
|
|
29
|
+
.add(-1, 'seconds')
|
|
30
|
+
.toDate(),
|
|
31
|
+
ownedThrough: now
|
|
27
32
|
},
|
|
28
33
|
expectedStatusCodes: [httpStatus.OK]
|
|
29
34
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// tslint:disable:no-console no-implicit-dependencies no-magic-numbers
|
|
2
2
|
import * as httpStatus from 'http-status';
|
|
3
|
-
|
|
3
|
+
import * as moment from 'moment';
|
|
4
4
|
|
|
5
5
|
import * as client from '../../../../lib/index';
|
|
6
6
|
import * as auth from '../../auth/auth';
|
|
@@ -18,18 +18,40 @@ async function main() {
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
console.log('searching...');
|
|
21
|
+
const now = new Date();
|
|
21
22
|
const result = await personService.fetch({
|
|
22
23
|
uri: '/people/me/ownershipInfos/PaymentCard',
|
|
23
24
|
method: 'GET',
|
|
24
25
|
qs: {
|
|
25
26
|
limit: 10,
|
|
26
|
-
page: 1
|
|
27
|
+
page: 1,
|
|
28
|
+
ownedFrom: moment(now)
|
|
29
|
+
.add(-1, 'seconds')
|
|
30
|
+
.toDate(),
|
|
31
|
+
ownedThrough: now
|
|
27
32
|
},
|
|
28
33
|
expectedStatusCodes: [httpStatus.OK]
|
|
29
34
|
})
|
|
30
35
|
.then(async (response) => response.json());
|
|
31
36
|
console.log(result);
|
|
32
37
|
console.log(result.map((o: any) => o.typeOfGood));
|
|
38
|
+
|
|
39
|
+
if (result.length > 0) {
|
|
40
|
+
// カード取引履歴検索
|
|
41
|
+
const paymentCardOwnershipInfo = result[result.length - 1];
|
|
42
|
+
const actions = await personService.fetch({
|
|
43
|
+
uri: `/people/me/ownershipInfos/PaymentCard/${paymentCardOwnershipInfo.id}/actions/moneyTransfer`,
|
|
44
|
+
method: 'GET',
|
|
45
|
+
qs: {
|
|
46
|
+
limit: 1,
|
|
47
|
+
page: 1
|
|
48
|
+
},
|
|
49
|
+
expectedStatusCodes: [httpStatus.OK]
|
|
50
|
+
})
|
|
51
|
+
.then(async (response) => response.json());
|
|
52
|
+
console.log(actions);
|
|
53
|
+
|
|
54
|
+
}
|
|
33
55
|
}
|
|
34
56
|
|
|
35
57
|
main()
|
|
@@ -31,6 +31,19 @@ async function main() {
|
|
|
31
31
|
console.log(result);
|
|
32
32
|
console.log(result.map((o: any) => o.typeOfGood));
|
|
33
33
|
console.log(result.map((o: any) => o.typeOfGood.reservationFor.superEvent));
|
|
34
|
+
|
|
35
|
+
if (result.length > 0) {
|
|
36
|
+
// 所有権削除
|
|
37
|
+
// const reservationOwnershipInfo = result[result.length - 1];
|
|
38
|
+
// console.log('deleting...', reservationOwnershipInfo.id);
|
|
39
|
+
// await personService.fetch({
|
|
40
|
+
// uri: `/people/me/ownershipInfos/${reservationOwnershipInfo.id}`,
|
|
41
|
+
// method: 'DELETE',
|
|
42
|
+
// expectedStatusCodes: [httpStatus.NO_CONTENT]
|
|
43
|
+
// });
|
|
44
|
+
// console.log('deleted', reservationOwnershipInfo.id);
|
|
45
|
+
|
|
46
|
+
}
|
|
34
47
|
}
|
|
35
48
|
|
|
36
49
|
main()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// tslint:disable:no-console no-implicit-dependencies no-magic-numbers
|
|
2
|
+
import * as httpStatus from 'http-status';
|
|
3
|
+
|
|
4
|
+
import * as client from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const auth = new client.auth.ClientCredentials({
|
|
7
|
+
domain: <string>process.env.ST_AUTHORIZE_SERVER_DOMAIN,
|
|
8
|
+
clientId: <string>process.env.ST_CLIENT_ID,
|
|
9
|
+
clientSecret: <string>process.env.ST_CLIENT_SECRET,
|
|
10
|
+
scopes: [],
|
|
11
|
+
state: 'teststate'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const sellerService = new client.service.Seller({
|
|
15
|
+
endpoint: <string>process.env.ST_API_ENDPOINT,
|
|
16
|
+
auth: auth
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// tslint:disable-next-line:max-func-body-length
|
|
20
|
+
async function main() {
|
|
21
|
+
console.log('ルームを検索しています...');
|
|
22
|
+
const searchResult = await sellerService.fetch({
|
|
23
|
+
uri: '/places/ScreeningRoom',
|
|
24
|
+
method: 'GET',
|
|
25
|
+
qs: {
|
|
26
|
+
limit: 100
|
|
27
|
+
},
|
|
28
|
+
expectedStatusCodes: [httpStatus.OK]
|
|
29
|
+
})
|
|
30
|
+
.then(async (response) => {
|
|
31
|
+
return {
|
|
32
|
+
data: await response.json()
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
console.log(searchResult.data);
|
|
36
|
+
console.log(searchResult.data.length);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
main()
|
|
40
|
+
.then(() => {
|
|
41
|
+
console.log('main processed.');
|
|
42
|
+
})
|
|
43
|
+
.catch((err) => {
|
|
44
|
+
console.error(err);
|
|
45
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// tslint:disable:no-console no-implicit-dependencies no-magic-numbers
|
|
2
|
+
import * as httpStatus from 'http-status';
|
|
3
|
+
|
|
4
|
+
import * as client from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const auth = new client.auth.ClientCredentials({
|
|
7
|
+
domain: <string>process.env.ST_AUTHORIZE_SERVER_DOMAIN,
|
|
8
|
+
clientId: <string>process.env.ST_CLIENT_ID,
|
|
9
|
+
clientSecret: <string>process.env.ST_CLIENT_SECRET,
|
|
10
|
+
scopes: [],
|
|
11
|
+
state: 'teststate'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const sellerService = new client.service.Seller({
|
|
15
|
+
endpoint: <string>process.env.ST_API_ENDPOINT,
|
|
16
|
+
auth: auth
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// tslint:disable-next-line:max-func-body-length
|
|
20
|
+
async function main() {
|
|
21
|
+
console.log('searching sellers...');
|
|
22
|
+
const searchResult = await sellerService.fetch({
|
|
23
|
+
uri: '/sellers',
|
|
24
|
+
method: 'GET',
|
|
25
|
+
qs: {
|
|
26
|
+
limit: 100
|
|
27
|
+
},
|
|
28
|
+
expectedStatusCodes: [httpStatus.OK]
|
|
29
|
+
})
|
|
30
|
+
.then(async (response) => {
|
|
31
|
+
return {
|
|
32
|
+
data: await response.json()
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
console.log(searchResult.data);
|
|
36
|
+
console.log(searchResult.data.map((s: any) => s.additionalProperty));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
main()
|
|
40
|
+
.then(() => {
|
|
41
|
+
console.log('main processed.');
|
|
42
|
+
})
|
|
43
|
+
.catch((err) => {
|
|
44
|
+
console.error(err);
|
|
45
|
+
});
|
|
@@ -41,31 +41,12 @@ async function main() {
|
|
|
41
41
|
});
|
|
42
42
|
console.log('transaction started', transaction.id);
|
|
43
43
|
|
|
44
|
-
const informUrl = process.env.LINE_NOTIFY_URL;
|
|
45
|
-
|
|
46
44
|
console.log('confirming transaction...');
|
|
47
45
|
await returnOrderService.confirm({
|
|
48
46
|
id: transaction.id,
|
|
49
47
|
potentialActions: {
|
|
50
48
|
returnOrder: {
|
|
51
49
|
potentialActions: {
|
|
52
|
-
cancelReservation: [
|
|
53
|
-
{
|
|
54
|
-
object: {
|
|
55
|
-
typeOf: client.factory.assetTransactionType.Reserve,
|
|
56
|
-
id: '5d6e593c0470230012b80b53'
|
|
57
|
-
},
|
|
58
|
-
potentialActions: {
|
|
59
|
-
cancelReservation: {
|
|
60
|
-
potentialActions: {
|
|
61
|
-
informReservation: [
|
|
62
|
-
{ recipient: { url: informUrl } }
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
50
|
/**
|
|
70
51
|
* クレジットカード返金アクションについてカスタマイズする場合に指定
|
|
71
52
|
*/
|
|
@@ -122,6 +122,7 @@ var ImplicitGrantClient = /** @class */ (function (_super) {
|
|
|
122
122
|
switch (_a.label) {
|
|
123
123
|
case 0:
|
|
124
124
|
if (!(this.credentials.accessToken === undefined)) return [3 /*break*/, 2];
|
|
125
|
+
if (!(typeof this.credentials.refreshToken === 'string' && this.credentials.refreshToken.length > 0)) return [3 /*break*/, 2];
|
|
125
126
|
return [4 /*yield*/, this.refreshAccessToken()];
|
|
126
127
|
case 1:
|
|
127
128
|
_a.sent();
|
package/lib/auth/oAuth2client.js
CHANGED
|
@@ -199,7 +199,7 @@ var OAuth2client = /** @class */ (function () {
|
|
|
199
199
|
throw new Error('No access or refresh token is set.');
|
|
200
200
|
}
|
|
201
201
|
shouldRefresh = (this.credentials.access_token === undefined) || isTokenExpired;
|
|
202
|
-
if (!(shouldRefresh && this.credentials.refresh_token
|
|
202
|
+
if (!(shouldRefresh && typeof this.credentials.refresh_token === 'string' && this.credentials.refresh_token.length > 0)) return [3 /*break*/, 2];
|
|
203
203
|
return [4 /*yield*/, this.refreshAccessToken()];
|
|
204
204
|
case 1:
|
|
205
205
|
_a.sent();
|
|
@@ -272,10 +272,10 @@ var OAuth2client = /** @class */ (function () {
|
|
|
272
272
|
numberOfTry = 0;
|
|
273
273
|
_c.label = 1;
|
|
274
274
|
case 1:
|
|
275
|
-
if (!(numberOfTry >= 0)) return [3 /*break*/,
|
|
275
|
+
if (!(numberOfTry >= 0)) return [3 /*break*/, 10];
|
|
276
276
|
_c.label = 2;
|
|
277
277
|
case 2:
|
|
278
|
-
_c.trys.push([2, 5, ,
|
|
278
|
+
_c.trys.push([2, 5, , 9]);
|
|
279
279
|
numberOfTry += 1;
|
|
280
280
|
if (numberOfTry > 1) {
|
|
281
281
|
retry = false;
|
|
@@ -288,29 +288,21 @@ var OAuth2client = /** @class */ (function () {
|
|
|
288
288
|
return [4 /*yield*/, this.makeFetch(url, options, expectedStatusCodes)];
|
|
289
289
|
case 4:
|
|
290
290
|
result = _c.sent();
|
|
291
|
-
return [3 /*break*/,
|
|
291
|
+
return [3 /*break*/, 10];
|
|
292
292
|
case 5:
|
|
293
293
|
error_1 = _c.sent();
|
|
294
|
-
if (!(error_1 instanceof Error)) return [3 /*break*/,
|
|
294
|
+
if (!(error_1 instanceof Error)) return [3 /*break*/, 8];
|
|
295
295
|
statusCode = error_1.code;
|
|
296
|
-
if (!(retry && (statusCode === http_status_1.UNAUTHORIZED || statusCode === http_status_1.FORBIDDEN))) return [3 /*break*/,
|
|
297
|
-
|
|
298
|
-
* to handle expiration-related failures. If refreshing the token
|
|
299
|
-
* does not fix the failure, then refreshing again probably won't
|
|
300
|
-
* help */
|
|
301
|
-
// Force token refresh
|
|
296
|
+
if (!(retry && (statusCode === http_status_1.UNAUTHORIZED || statusCode === http_status_1.FORBIDDEN))) return [3 /*break*/, 8];
|
|
297
|
+
if (!(typeof this.credentials.refresh_token === 'string' && this.credentials.refresh_token.length > 0)) return [3 /*break*/, 7];
|
|
302
298
|
return [4 /*yield*/, this.refreshAccessToken()];
|
|
303
299
|
case 6:
|
|
304
|
-
/* It only makes sense to retry once, because the retry is intended
|
|
305
|
-
* to handle expiration-related failures. If refreshing the token
|
|
306
|
-
* does not fix the failure, then refreshing again probably won't
|
|
307
|
-
* help */
|
|
308
|
-
// Force token refresh
|
|
309
300
|
_c.sent();
|
|
310
|
-
|
|
311
|
-
case 7:
|
|
312
|
-
case 8:
|
|
313
|
-
case 9: return [
|
|
301
|
+
_c.label = 7;
|
|
302
|
+
case 7: return [3 /*break*/, 1];
|
|
303
|
+
case 8: throw error_1;
|
|
304
|
+
case 9: return [3 /*break*/, 1];
|
|
305
|
+
case 10: return [2 /*return*/, result];
|
|
314
306
|
}
|
|
315
307
|
});
|
|
316
308
|
});
|