@cinerino/sdk 3.104.0-alpha.2 → 3.104.0-alpha.3
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 +19 -1
- package/example/src/chevre/assetTransaction/processReserve.ts +1 -1
- package/example/src/chevre/transaction/processPlaceOrder.ts +154 -0
- package/example/src/transaction/processMoneyTransfer.ts +2 -2
- package/example/src/transaction/processMoneyTransferFromOrder.ts +2 -2
- package/example/src/transaction/processOrderMembershipByCreditCard.ts +2 -2
- package/example/src/transaction/processOrderMoneyTransferByCash.ts +2 -2
- package/example/src/transaction/processOrderMoneyTransferByCreditCard.ts +2 -2
- package/example/src/transaction/processOrderPaymentCardByCreditCard.ts +2 -2
- package/example/src/transaction/processPlaceOrderByAnonymousCreditCard.ts +2 -2
- package/example/src/transaction/processPlaceOrderByAnonymousCreditCardAndMembership.ts +2 -2
- package/example/src/transaction/processPlaceOrderByAnonymousCreditCardAndMyMembership.ts +2 -2
- package/example/src/transaction/processPlaceOrderByCash.ts +3 -3
- package/example/src/transaction/processPlaceOrderByMovieTicket.ts +3 -3
- package/example/src/transaction/processPlaceOrderByMovieTicket4COA.ts +2 -2
- package/example/src/transaction/processPlaceOrderByPaymentCard.ts +2 -2
- package/lib/bundle.js +19 -1
- package/package.json +2 -2
|
@@ -11090,7 +11090,7 @@ var PlaceOrderTransactionService = /** @class */ (function (_super) {
|
|
|
11090
11090
|
case 0: return [4 /*yield*/, this.fetch({
|
|
11091
11091
|
uri: "/transactions/" + this.typeOf + "/" + params.id + "/publishConfirmationNumberIfNotExist",
|
|
11092
11092
|
method: 'POST',
|
|
11093
|
-
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
11093
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT, http_status_1.OK]
|
|
11094
11094
|
})];
|
|
11095
11095
|
case 1:
|
|
11096
11096
|
_a.sent();
|
|
@@ -11099,6 +11099,24 @@ var PlaceOrderTransactionService = /** @class */ (function (_super) {
|
|
|
11099
11099
|
});
|
|
11100
11100
|
});
|
|
11101
11101
|
};
|
|
11102
|
+
/**
|
|
11103
|
+
* 注文番号発行
|
|
11104
|
+
*/
|
|
11105
|
+
PlaceOrderTransactionService.prototype.publishOrderNumberIfNotExist = function (params) {
|
|
11106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11107
|
+
var _this = this;
|
|
11108
|
+
return __generator(this, function (_a) {
|
|
11109
|
+
return [2 /*return*/, this.fetch({
|
|
11110
|
+
uri: "/transactions/" + this.typeOf + "/" + params.id + "/publishOrderNumberIfNotExist",
|
|
11111
|
+
method: 'POST',
|
|
11112
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
11113
|
+
})
|
|
11114
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11115
|
+
return [2 /*return*/, response.json()];
|
|
11116
|
+
}); }); })];
|
|
11117
|
+
});
|
|
11118
|
+
});
|
|
11119
|
+
};
|
|
11102
11120
|
/**
|
|
11103
11121
|
* 取引検索
|
|
11104
11122
|
*/
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// tslint:disable:no-console no-implicit-dependencies no-magic-numbers
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as client from '../../../../lib/index';
|
|
4
|
+
import * as auth from '../../auth/authAsAdmin';
|
|
5
|
+
|
|
6
|
+
const project = { id: process.env.PROJECT_ID };
|
|
7
|
+
|
|
8
|
+
const profile = {
|
|
9
|
+
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
10
|
+
givenName: 'Taro',
|
|
11
|
+
familyName: 'SDK',
|
|
12
|
+
name: 'Taro ☆ SDK',
|
|
13
|
+
telephone: '+819012345678'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type IAuthorizeReservationAction
|
|
17
|
+
= client.factory.action.authorize.offer.seatReservation.IAction<client.factory.service.webAPI.Identifier.Chevre>;
|
|
18
|
+
|
|
19
|
+
// tslint:disable-next-line:max-func-body-length
|
|
20
|
+
async function main() {
|
|
21
|
+
const authClient = await auth.login();
|
|
22
|
+
await authClient.refreshAccessToken();
|
|
23
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
24
|
+
console.log('username is', loginTicket.getUsername());
|
|
25
|
+
|
|
26
|
+
const sellerService = new client.chevre.service.Seller({
|
|
27
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
28
|
+
auth: authClient,
|
|
29
|
+
project
|
|
30
|
+
});
|
|
31
|
+
const placeOrderService = new client.chevre.service.transaction.PlaceOrder({
|
|
32
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
33
|
+
auth: authClient,
|
|
34
|
+
project
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
console.log('finding profile...');
|
|
38
|
+
// const profile = await personService.getProfile({ personId: 'me' });
|
|
39
|
+
console.log('profile found');
|
|
40
|
+
|
|
41
|
+
// 販売劇場検索
|
|
42
|
+
const searchSellersResult = await sellerService.search({});
|
|
43
|
+
// tslint:disable-next-line:insecure-random
|
|
44
|
+
const seller = searchSellersResult.data[Math.floor(searchSellersResult.data.length * Math.random())];
|
|
45
|
+
if (seller === undefined) {
|
|
46
|
+
throw new Error('No seller');
|
|
47
|
+
}
|
|
48
|
+
console.log('ordering from seller...', (<client.factory.multilingualString>seller.name).ja);
|
|
49
|
+
|
|
50
|
+
console.log('starting transaction...');
|
|
51
|
+
const transaction = await placeOrderService.start({
|
|
52
|
+
expires: moment()
|
|
53
|
+
.add(10, 'minutes')
|
|
54
|
+
.toDate(),
|
|
55
|
+
agent: {
|
|
56
|
+
identifier: [
|
|
57
|
+
{
|
|
58
|
+
name: 'SampleName',
|
|
59
|
+
value: 'SampleValue'
|
|
60
|
+
},
|
|
61
|
+
...(typeof process.env.LINE_NOTIFY_URL === 'string' && process.env.LINE_NOTIFY_URL.length > 0)
|
|
62
|
+
? [
|
|
63
|
+
{
|
|
64
|
+
name: 'onOrderPlaced.recipient.url',
|
|
65
|
+
value: process.env.LINE_NOTIFY_URL
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'onOrderPlaced.object.customer.identifier',
|
|
69
|
+
value: 'onOrderPlaced.object.customer.identifier.value1'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'onOrderPlaced.object.customer.identifier',
|
|
73
|
+
value: 'onOrderPlaced.object.customer.identifier.value2'
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
]
|
|
77
|
+
: []
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
seller: {
|
|
81
|
+
typeOf: seller.typeOf,
|
|
82
|
+
id: String(seller.id)
|
|
83
|
+
},
|
|
84
|
+
object: {
|
|
85
|
+
// passport: { token: passportToken }
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
console.log('transaction started', transaction.id);
|
|
89
|
+
|
|
90
|
+
// 購入者情報入力時間
|
|
91
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
92
|
+
await wait(5000);
|
|
93
|
+
|
|
94
|
+
const settingProfile: client.factory.person.IProfile = {
|
|
95
|
+
givenName: 'Taro',
|
|
96
|
+
familyName: 'SDK',
|
|
97
|
+
telephone: '+819012345678',
|
|
98
|
+
email: profile.email
|
|
99
|
+
};
|
|
100
|
+
console.log('setting customer profile...');
|
|
101
|
+
await placeOrderService.setProfile({ id: transaction.id, agent: settingProfile });
|
|
102
|
+
console.log('customer profile set');
|
|
103
|
+
|
|
104
|
+
// let i = 0;
|
|
105
|
+
// setInterval(
|
|
106
|
+
// async () => {
|
|
107
|
+
// i += 1;
|
|
108
|
+
// try {
|
|
109
|
+
// console.log('setting customer profile...');
|
|
110
|
+
// await placeOrderService.setProfile({ id: transaction.id, agent: settingProfile });
|
|
111
|
+
// console.log('customer profile set');
|
|
112
|
+
|
|
113
|
+
// } catch (error) {
|
|
114
|
+
// console.error('setting profile failed.', error.message);
|
|
115
|
+
// }
|
|
116
|
+
// },
|
|
117
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
118
|
+
// 500
|
|
119
|
+
// );
|
|
120
|
+
|
|
121
|
+
// return;
|
|
122
|
+
|
|
123
|
+
// 購入情報確認時間
|
|
124
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
125
|
+
await wait(5000);
|
|
126
|
+
|
|
127
|
+
const publishOrderNumberReulst = await placeOrderService.publishOrderNumberIfNotExist({ id: transaction.id });
|
|
128
|
+
console.log(publishOrderNumberReulst.orderNumber);
|
|
129
|
+
|
|
130
|
+
// 取引を中止する場合はコチラ↓
|
|
131
|
+
// console.log('取引を中止します...');
|
|
132
|
+
// await placeOrderService.cancel({ id: transaction.id });
|
|
133
|
+
// console.log('取引を中止しました。');
|
|
134
|
+
|
|
135
|
+
console.log('confirming transaction...');
|
|
136
|
+
const confirmResult = await placeOrderService.confirm({
|
|
137
|
+
id: transaction.id,
|
|
138
|
+
sendEmailMessage: true
|
|
139
|
+
// expectsReservationIds: true
|
|
140
|
+
});
|
|
141
|
+
const order = confirmResult.order;
|
|
142
|
+
console.log('transaction confirmed', confirmResult);
|
|
143
|
+
console.log('transaction confirmed', order.orderNumber);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async function wait(waitInMilliseconds: number) {
|
|
147
|
+
return new Promise((resolve) => setTimeout(resolve, waitInMilliseconds));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
main()
|
|
151
|
+
.then(() => {
|
|
152
|
+
console.log('success!');
|
|
153
|
+
})
|
|
154
|
+
.catch(console.error);
|
|
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
|
|
|
9
9
|
const profile = {
|
|
10
10
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
11
|
givenName: 'Taro',
|
|
12
|
-
familyName: '
|
|
13
|
-
name: 'Taro ☆
|
|
12
|
+
familyName: 'SDK',
|
|
13
|
+
name: 'Taro ☆ SDK',
|
|
14
14
|
telephone: '+819012345678'
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
|
|
|
9
9
|
const profile = {
|
|
10
10
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
11
|
givenName: 'Taro',
|
|
12
|
-
familyName: '
|
|
13
|
-
name: 'Taro ☆
|
|
12
|
+
familyName: 'SDK',
|
|
13
|
+
name: 'Taro ☆ SDK',
|
|
14
14
|
telephone: '+819012345678'
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
|
|
|
9
9
|
const profile = {
|
|
10
10
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
11
|
givenName: 'Taro',
|
|
12
|
-
familyName: '
|
|
13
|
-
name: 'Taro ☆
|
|
12
|
+
familyName: 'SDK',
|
|
13
|
+
name: 'Taro ☆ SDK',
|
|
14
14
|
telephone: '+819012345678'
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -124,8 +124,8 @@ async function main() {
|
|
|
124
124
|
const profile = {
|
|
125
125
|
email: '',
|
|
126
126
|
givenName: 'Taro',
|
|
127
|
-
familyName: '
|
|
128
|
-
name: 'Taro ☆
|
|
127
|
+
familyName: 'SDK',
|
|
128
|
+
name: 'Taro ☆ SDK',
|
|
129
129
|
telephone: '+819012345678'
|
|
130
130
|
};
|
|
131
131
|
await placeOrderService.setProfile({
|
|
@@ -132,8 +132,8 @@ async function main() {
|
|
|
132
132
|
const profile = {
|
|
133
133
|
email: '',
|
|
134
134
|
givenName: 'Taro',
|
|
135
|
-
familyName: '
|
|
136
|
-
name: 'Taro ☆
|
|
135
|
+
familyName: 'SDK',
|
|
136
|
+
name: 'Taro ☆ SDK',
|
|
137
137
|
telephone: '+819012345678'
|
|
138
138
|
};
|
|
139
139
|
await placeOrderService.setProfile({
|
|
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
|
|
|
9
9
|
const profile = {
|
|
10
10
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
11
|
givenName: 'Taro',
|
|
12
|
-
familyName: '
|
|
13
|
-
name: 'Taro ☆
|
|
12
|
+
familyName: 'SDK',
|
|
13
|
+
name: 'Taro ☆ SDK',
|
|
14
14
|
telephone: '+819012345678'
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
|
|
|
9
9
|
const profile = {
|
|
10
10
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
11
|
givenName: 'Taro',
|
|
12
|
-
familyName: '
|
|
13
|
-
name: 'Taro ☆
|
|
12
|
+
familyName: 'SDK',
|
|
13
|
+
name: 'Taro ☆ SDK',
|
|
14
14
|
telephone: '+819012345678'
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
|
|
|
9
9
|
const profile = {
|
|
10
10
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
11
|
givenName: 'Taro',
|
|
12
|
-
familyName: '
|
|
13
|
-
name: 'Taro ☆
|
|
12
|
+
familyName: 'SDK',
|
|
13
|
+
name: 'Taro ☆ SDK',
|
|
14
14
|
telephone: '+819012345678'
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -9,8 +9,8 @@ const project = { id: 'cinerino' };
|
|
|
9
9
|
const profile = {
|
|
10
10
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
11
|
givenName: 'Taro',
|
|
12
|
-
familyName: '
|
|
13
|
-
name: 'Taro ☆
|
|
12
|
+
familyName: 'SDK',
|
|
13
|
+
name: 'Taro ☆ SDK',
|
|
14
14
|
telephone: '+819012345678'
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -301,7 +301,7 @@ async function main() {
|
|
|
301
301
|
id: transaction.id,
|
|
302
302
|
agent: {
|
|
303
303
|
givenName: 'Taro',
|
|
304
|
-
familyName: '
|
|
304
|
+
familyName: 'SDK',
|
|
305
305
|
telephone: '+819012345678',
|
|
306
306
|
email: profile.email
|
|
307
307
|
}
|
|
@@ -15,8 +15,8 @@ const creditCard = {
|
|
|
15
15
|
const profile = {
|
|
16
16
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
17
17
|
givenName: 'Taro',
|
|
18
|
-
familyName: '
|
|
19
|
-
name: 'Taro ☆
|
|
18
|
+
familyName: 'SDK',
|
|
19
|
+
name: 'Taro ☆ SDK',
|
|
20
20
|
telephone: '+819012345678'
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -432,7 +432,7 @@ async function main() {
|
|
|
432
432
|
id: transaction.id,
|
|
433
433
|
agent: {
|
|
434
434
|
givenName: 'Taro',
|
|
435
|
-
familyName: '
|
|
435
|
+
familyName: 'SDK',
|
|
436
436
|
telephone: '+819012345678',
|
|
437
437
|
email: profile.email
|
|
438
438
|
}
|
|
@@ -10,8 +10,8 @@ const project = { id: 'sskts-development' };
|
|
|
10
10
|
const profile = {
|
|
11
11
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
12
12
|
givenName: 'Taro',
|
|
13
|
-
familyName: '
|
|
14
|
-
name: 'Taro ☆
|
|
13
|
+
familyName: 'SDK',
|
|
14
|
+
name: 'Taro ☆ SDK',
|
|
15
15
|
telephone: '+819012345678'
|
|
16
16
|
};
|
|
17
17
|
|
package/lib/bundle.js
CHANGED
|
@@ -11002,7 +11002,7 @@ var PlaceOrderTransactionService = /** @class */ (function (_super) {
|
|
|
11002
11002
|
case 0: return [4 /*yield*/, this.fetch({
|
|
11003
11003
|
uri: "/transactions/" + this.typeOf + "/" + params.id + "/publishConfirmationNumberIfNotExist",
|
|
11004
11004
|
method: 'POST',
|
|
11005
|
-
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
11005
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT, http_status_1.OK]
|
|
11006
11006
|
})];
|
|
11007
11007
|
case 1:
|
|
11008
11008
|
_a.sent();
|
|
@@ -11011,6 +11011,24 @@ var PlaceOrderTransactionService = /** @class */ (function (_super) {
|
|
|
11011
11011
|
});
|
|
11012
11012
|
});
|
|
11013
11013
|
};
|
|
11014
|
+
/**
|
|
11015
|
+
* 注文番号発行
|
|
11016
|
+
*/
|
|
11017
|
+
PlaceOrderTransactionService.prototype.publishOrderNumberIfNotExist = function (params) {
|
|
11018
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11019
|
+
var _this = this;
|
|
11020
|
+
return __generator(this, function (_a) {
|
|
11021
|
+
return [2 /*return*/, this.fetch({
|
|
11022
|
+
uri: "/transactions/" + this.typeOf + "/" + params.id + "/publishOrderNumberIfNotExist",
|
|
11023
|
+
method: 'POST',
|
|
11024
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
11025
|
+
})
|
|
11026
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11027
|
+
return [2 /*return*/, response.json()];
|
|
11028
|
+
}); }); })];
|
|
11029
|
+
});
|
|
11030
|
+
});
|
|
11031
|
+
};
|
|
11014
11032
|
/**
|
|
11015
11033
|
* 取引検索
|
|
11016
11034
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cinerino/sdk",
|
|
3
|
-
"version": "3.104.0-alpha.
|
|
3
|
+
"version": "3.104.0-alpha.3",
|
|
4
4
|
"description": "Cinerino SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"watchify": "^3.11.1"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@cinerino/api-abstract-client": "3.104.0-alpha.
|
|
100
|
+
"@cinerino/api-abstract-client": "3.104.0-alpha.3",
|
|
101
101
|
"debug": "^3.2.6",
|
|
102
102
|
"http-status": "^1.4.2",
|
|
103
103
|
"idtoken-verifier": "^2.0.3",
|