@cinerino/sdk 3.103.0 → 3.104.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/playground/public/lib/bundle.js +60 -1
- package/example/src/chevre/{transaction → assetTransaction}/processCancelReservation.ts +0 -0
- package/example/src/chevre/{transaction → assetTransaction}/processMoneyTransfer.ts +0 -0
- package/example/src/chevre/{transaction → assetTransaction}/processPayCreditCard.ts +0 -0
- package/example/src/chevre/{transaction → assetTransaction}/processPayMGTicket.ts +0 -0
- package/example/src/chevre/{transaction → assetTransaction}/processPayMovieTicket.ts +0 -0
- package/example/src/chevre/{transaction → assetTransaction}/processPublishPaymentUrl.ts +0 -0
- package/example/src/chevre/{transaction → assetTransaction}/processRefundCreditCard.ts +0 -0
- package/example/src/chevre/{transaction → assetTransaction}/processRegisterService.ts +0 -0
- package/example/src/chevre/{transaction → assetTransaction}/processReserve.ts +0 -0
- package/example/src/chevre/transaction/processReturnOrder.ts +113 -0
- package/lib/bundle.js +60 -1
- package/package.json +2 -2
|
@@ -11092,7 +11092,7 @@ var http_status_1 = require("http-status");
|
|
|
11092
11092
|
var factory = require("../../factory");
|
|
11093
11093
|
var service_1 = require("../../service");
|
|
11094
11094
|
/**
|
|
11095
|
-
*
|
|
11095
|
+
* 返品取引サービス
|
|
11096
11096
|
*/
|
|
11097
11097
|
var ReturnOrderTransactionService = /** @class */ (function (_super) {
|
|
11098
11098
|
__extends(ReturnOrderTransactionService, _super);
|
|
@@ -11129,6 +11129,65 @@ var ReturnOrderTransactionService = /** @class */ (function (_super) {
|
|
|
11129
11129
|
});
|
|
11130
11130
|
});
|
|
11131
11131
|
};
|
|
11132
|
+
/**
|
|
11133
|
+
* 取引を開始する
|
|
11134
|
+
*/
|
|
11135
|
+
ReturnOrderTransactionService.prototype.start = function (params) {
|
|
11136
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11137
|
+
var _this = this;
|
|
11138
|
+
return __generator(this, function (_a) {
|
|
11139
|
+
return [2 /*return*/, this.fetch({
|
|
11140
|
+
uri: "/transactions/" + this.typeOf + "/start",
|
|
11141
|
+
method: 'POST',
|
|
11142
|
+
body: params,
|
|
11143
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
11144
|
+
})
|
|
11145
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11146
|
+
return [2 /*return*/, response.json()];
|
|
11147
|
+
}); }); })];
|
|
11148
|
+
});
|
|
11149
|
+
});
|
|
11150
|
+
};
|
|
11151
|
+
/**
|
|
11152
|
+
* 取引人プロフィール変更
|
|
11153
|
+
*/
|
|
11154
|
+
ReturnOrderTransactionService.prototype.setProfile = function (params) {
|
|
11155
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11156
|
+
return __generator(this, function (_a) {
|
|
11157
|
+
switch (_a.label) {
|
|
11158
|
+
case 0: return [4 /*yield*/, this.fetch({
|
|
11159
|
+
uri: "/transactions/" + this.typeOf + "/" + params.id + "/agent",
|
|
11160
|
+
method: 'PUT',
|
|
11161
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT],
|
|
11162
|
+
body: params.agent
|
|
11163
|
+
})];
|
|
11164
|
+
case 1:
|
|
11165
|
+
_a.sent();
|
|
11166
|
+
return [2 /*return*/];
|
|
11167
|
+
}
|
|
11168
|
+
});
|
|
11169
|
+
});
|
|
11170
|
+
};
|
|
11171
|
+
/**
|
|
11172
|
+
* 取引確定
|
|
11173
|
+
*/
|
|
11174
|
+
ReturnOrderTransactionService.prototype.confirm = function (params) {
|
|
11175
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11176
|
+
return __generator(this, function (_a) {
|
|
11177
|
+
switch (_a.label) {
|
|
11178
|
+
case 0: return [4 /*yield*/, this.fetch({
|
|
11179
|
+
uri: "/transactions/" + this.typeOf + "/" + params.id + "/confirm",
|
|
11180
|
+
method: 'PUT',
|
|
11181
|
+
body: params,
|
|
11182
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
11183
|
+
})];
|
|
11184
|
+
case 1:
|
|
11185
|
+
_a.sent();
|
|
11186
|
+
return [2 /*return*/];
|
|
11187
|
+
}
|
|
11188
|
+
});
|
|
11189
|
+
});
|
|
11190
|
+
};
|
|
11132
11191
|
return ReturnOrderTransactionService;
|
|
11133
11192
|
}(service_1.Service));
|
|
11134
11193
|
exports.ReturnOrderTransactionService = ReturnOrderTransactionService;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
+
/**
|
|
3
|
+
* 返品プロセス
|
|
4
|
+
*/
|
|
5
|
+
import * as moment from 'moment';
|
|
6
|
+
|
|
7
|
+
import * as client from '../../../../lib/index';
|
|
8
|
+
import * as auth from '../../auth/authAsAdmin';
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
// 管理者として操作する場合はこちら
|
|
12
|
+
const authClient = await auth.login();
|
|
13
|
+
await authClient.refreshAccessToken();
|
|
14
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
15
|
+
console.log('username is', loginTicket.getUsername());
|
|
16
|
+
|
|
17
|
+
const returnOrderService = new client.chevre.service.transaction.ReturnOrder({
|
|
18
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
19
|
+
auth: authClient,
|
|
20
|
+
project: { id: 'cinerino' }
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const transaction = await returnOrderService.start({
|
|
24
|
+
expires: moment()
|
|
25
|
+
.add(1, 'minute')
|
|
26
|
+
.toDate(),
|
|
27
|
+
object: {
|
|
28
|
+
order: [{
|
|
29
|
+
confirmationNumber: 'xxx',
|
|
30
|
+
orderNumber: 'xxx'
|
|
31
|
+
// customer: { telephone: '+8190xxxxxxxx' }
|
|
32
|
+
}]
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
console.log('transaction started', transaction.id);
|
|
36
|
+
|
|
37
|
+
// tslint:disable-next-line:prefer-array-literal
|
|
38
|
+
// await Promise.all([...Array(10)].map(async () => {
|
|
39
|
+
// try {
|
|
40
|
+
// await returnOrderService.setProfile({
|
|
41
|
+
// id: transaction.id,
|
|
42
|
+
// agent: {
|
|
43
|
+
// telephone: '+819012345678'
|
|
44
|
+
// }
|
|
45
|
+
// });
|
|
46
|
+
// console.log('profile set', transaction.id);
|
|
47
|
+
// } catch (error) {
|
|
48
|
+
// console.error('setting profile failed.', error.message);
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
// }));
|
|
52
|
+
|
|
53
|
+
// return;
|
|
54
|
+
|
|
55
|
+
// let i = 0;
|
|
56
|
+
// setInterval(
|
|
57
|
+
// async () => {
|
|
58
|
+
// i += 1;
|
|
59
|
+
// try {
|
|
60
|
+
// await returnOrderService.setProfile({
|
|
61
|
+
// id: transaction.id,
|
|
62
|
+
// agent: {
|
|
63
|
+
// telephone: '+819012345678'
|
|
64
|
+
// }
|
|
65
|
+
// });
|
|
66
|
+
// console.log('profile set', transaction.id);
|
|
67
|
+
// } catch (error) {
|
|
68
|
+
// console.error('setting profile failed.', error.message);
|
|
69
|
+
// }
|
|
70
|
+
// },
|
|
71
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
72
|
+
// 500
|
|
73
|
+
// );
|
|
74
|
+
|
|
75
|
+
// return;
|
|
76
|
+
|
|
77
|
+
console.log('confirming transaction...');
|
|
78
|
+
await returnOrderService.confirm({
|
|
79
|
+
id: transaction.id,
|
|
80
|
+
potentialActions: {
|
|
81
|
+
returnOrder: {
|
|
82
|
+
potentialActions: {
|
|
83
|
+
/**
|
|
84
|
+
* クレジットカード返金アクションについてカスタマイズする場合に指定
|
|
85
|
+
*/
|
|
86
|
+
refundCreditCard: [{
|
|
87
|
+
object: {
|
|
88
|
+
object: [{
|
|
89
|
+
paymentMethod: { paymentMethodId: 'xxx' }
|
|
90
|
+
}]
|
|
91
|
+
},
|
|
92
|
+
potentialActions: {
|
|
93
|
+
sendEmailMessage: {
|
|
94
|
+
object: {
|
|
95
|
+
toRecipient: { email: 'noreply@example.com' },
|
|
96
|
+
sender: { email: 'noreply@example.com' },
|
|
97
|
+
template: '| Sample emailTemplate #{order.orderNumber}'
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
console.log('transaction confirmed');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
main()
|
|
110
|
+
.then(() => {
|
|
111
|
+
console.log('success!');
|
|
112
|
+
})
|
|
113
|
+
.catch(console.error);
|
package/lib/bundle.js
CHANGED
|
@@ -11004,7 +11004,7 @@ var http_status_1 = require("http-status");
|
|
|
11004
11004
|
var factory = require("../../factory");
|
|
11005
11005
|
var service_1 = require("../../service");
|
|
11006
11006
|
/**
|
|
11007
|
-
*
|
|
11007
|
+
* 返品取引サービス
|
|
11008
11008
|
*/
|
|
11009
11009
|
var ReturnOrderTransactionService = /** @class */ (function (_super) {
|
|
11010
11010
|
__extends(ReturnOrderTransactionService, _super);
|
|
@@ -11041,6 +11041,65 @@ var ReturnOrderTransactionService = /** @class */ (function (_super) {
|
|
|
11041
11041
|
});
|
|
11042
11042
|
});
|
|
11043
11043
|
};
|
|
11044
|
+
/**
|
|
11045
|
+
* 取引を開始する
|
|
11046
|
+
*/
|
|
11047
|
+
ReturnOrderTransactionService.prototype.start = function (params) {
|
|
11048
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11049
|
+
var _this = this;
|
|
11050
|
+
return __generator(this, function (_a) {
|
|
11051
|
+
return [2 /*return*/, this.fetch({
|
|
11052
|
+
uri: "/transactions/" + this.typeOf + "/start",
|
|
11053
|
+
method: 'POST',
|
|
11054
|
+
body: params,
|
|
11055
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
11056
|
+
})
|
|
11057
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11058
|
+
return [2 /*return*/, response.json()];
|
|
11059
|
+
}); }); })];
|
|
11060
|
+
});
|
|
11061
|
+
});
|
|
11062
|
+
};
|
|
11063
|
+
/**
|
|
11064
|
+
* 取引人プロフィール変更
|
|
11065
|
+
*/
|
|
11066
|
+
ReturnOrderTransactionService.prototype.setProfile = function (params) {
|
|
11067
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11068
|
+
return __generator(this, function (_a) {
|
|
11069
|
+
switch (_a.label) {
|
|
11070
|
+
case 0: return [4 /*yield*/, this.fetch({
|
|
11071
|
+
uri: "/transactions/" + this.typeOf + "/" + params.id + "/agent",
|
|
11072
|
+
method: 'PUT',
|
|
11073
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT],
|
|
11074
|
+
body: params.agent
|
|
11075
|
+
})];
|
|
11076
|
+
case 1:
|
|
11077
|
+
_a.sent();
|
|
11078
|
+
return [2 /*return*/];
|
|
11079
|
+
}
|
|
11080
|
+
});
|
|
11081
|
+
});
|
|
11082
|
+
};
|
|
11083
|
+
/**
|
|
11084
|
+
* 取引確定
|
|
11085
|
+
*/
|
|
11086
|
+
ReturnOrderTransactionService.prototype.confirm = function (params) {
|
|
11087
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11088
|
+
return __generator(this, function (_a) {
|
|
11089
|
+
switch (_a.label) {
|
|
11090
|
+
case 0: return [4 /*yield*/, this.fetch({
|
|
11091
|
+
uri: "/transactions/" + this.typeOf + "/" + params.id + "/confirm",
|
|
11092
|
+
method: 'PUT',
|
|
11093
|
+
body: params,
|
|
11094
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
11095
|
+
})];
|
|
11096
|
+
case 1:
|
|
11097
|
+
_a.sent();
|
|
11098
|
+
return [2 /*return*/];
|
|
11099
|
+
}
|
|
11100
|
+
});
|
|
11101
|
+
});
|
|
11102
|
+
};
|
|
11044
11103
|
return ReturnOrderTransactionService;
|
|
11045
11104
|
}(service_1.Service));
|
|
11046
11105
|
exports.ReturnOrderTransactionService = ReturnOrderTransactionService;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cinerino/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.104.0-alpha.0",
|
|
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.
|
|
100
|
+
"@cinerino/api-abstract-client": "3.104.0-alpha.0",
|
|
101
101
|
"debug": "^3.2.6",
|
|
102
102
|
"http-status": "^1.4.2",
|
|
103
103
|
"idtoken-verifier": "^2.0.3",
|