@cinerino/sdk 8.0.0-alpha.4 → 8.0.0-alpha.5

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.
@@ -1,61 +0,0 @@
1
- import { IConfirmResult4tttsPOS, IMinimalConfirmResult, IStartParams, IStartPlaceOrderResult } from '../../../chevreTxn/transaction/placeOrder/factory';
2
- import * as factory from '../../../factory';
3
- import { IAdditionalOptions, IOptions, Service } from '../../../service';
4
- import { ISetProfileParams, TransactionService } from '../transaction';
5
- /**
6
- * 注文取引サービス
7
- */
8
- export declare class PlaceOrderTransactionService extends Service implements TransactionService {
9
- typeOf: factory.transactionType.PlaceOrder;
10
- constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath'> & IAdditionalOptions);
11
- /**
12
- * 取引開始
13
- */
14
- start(params: IStartParams): Promise<IStartPlaceOrderResult>;
15
- /**
16
- * 取引人プロフィール変更
17
- */
18
- setProfile(params: ISetProfileParams): Promise<void>;
19
- /**
20
- * 取引期限変更
21
- */
22
- changeExpiringDate(params: {
23
- /**
24
- * 取引ID
25
- */
26
- id: string;
27
- expires: Date;
28
- }): Promise<void>;
29
- /**
30
- * 取引確定(tttsPOS専用)
31
- */
32
- confirm4tttsPOS(params: Pick<factory.transaction.placeOrder.IConfirmParams, 'id'>): Promise<IConfirmResult4tttsPOS>;
33
- /**
34
- * 取引確定(レスポンス最小化)
35
- */
36
- confirmWithMiminalResponse(params: factory.transaction.placeOrder.IConfirmParams & {
37
- /**
38
- * 注文配送メールを送信するかどうか
39
- */
40
- sendEmailMessage?: boolean;
41
- /**
42
- * 注文配送メールカスタマイズ
43
- * メール本文をカスタマイズしたい場合、PUGテンプレートを指定
44
- * 挿入変数として`order`を使用できます
45
- * 参考 -> https://pugjs.org/api/getting-started.html
46
- */
47
- email?: Omit<factory.creativeWork.message.email.ICustomization, 'sender'> & {
48
- sender?: Pick<factory.creativeWork.message.email.ICustomizedParticipant, 'name'>;
49
- };
50
- }): Promise<IMinimalConfirmResult>;
51
- /**
52
- * 明示的に取引を中止する
53
- * 既に確定済、あるいは、期限切れの取引に対して実行するとArgumentエラーが返されます。
54
- */
55
- cancel(params: {
56
- /**
57
- * 取引ID
58
- */
59
- id: string;
60
- }): Promise<void>;
61
- }
@@ -1,209 +0,0 @@
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.PlaceOrderTransactionService = void 0;
66
- var http_status_1 = require("http-status");
67
- var factory = require("../../../factory");
68
- var service_1 = require("../../../service");
69
- /**
70
- * 注文取引サービス
71
- */
72
- var PlaceOrderTransactionService = /** @class */ (function (_super) {
73
- __extends(PlaceOrderTransactionService, _super);
74
- function PlaceOrderTransactionService(options) {
75
- var _this = _super.call(this, __assign(__assign({}, options), { defaultPath: '/txn', retryableStatusCodes: [http_status_1.BAD_GATEWAY, http_status_1.FORBIDDEN, http_status_1.UNAUTHORIZED] })) || this;
76
- _this.typeOf = factory.transactionType.PlaceOrder;
77
- return _this;
78
- }
79
- /**
80
- * 取引開始
81
- */
82
- PlaceOrderTransactionService.prototype.start = function (params) {
83
- return __awaiter(this, void 0, void 0, function () {
84
- var _this = this;
85
- return __generator(this, function (_a) {
86
- return [2 /*return*/, this.fetch({
87
- uri: "/transactions/" + this.typeOf + "/start",
88
- method: 'POST',
89
- body: params,
90
- expectedStatusCodes: [http_status_1.OK]
91
- })
92
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
93
- return [2 /*return*/, response.json()];
94
- }); }); })];
95
- });
96
- });
97
- };
98
- /**
99
- * 取引人プロフィール変更
100
- */
101
- PlaceOrderTransactionService.prototype.setProfile = function (params) {
102
- return __awaiter(this, void 0, void 0, function () {
103
- return __generator(this, function (_a) {
104
- switch (_a.label) {
105
- case 0: return [4 /*yield*/, this.fetch({
106
- uri: "/transactions/" + this.typeOf + "/" + params.id + "/agent",
107
- method: 'PUT',
108
- expectedStatusCodes: [http_status_1.NO_CONTENT],
109
- body: params.agent
110
- })];
111
- case 1:
112
- _a.sent();
113
- return [2 /*return*/];
114
- }
115
- });
116
- });
117
- };
118
- /**
119
- * 取引期限変更
120
- */
121
- PlaceOrderTransactionService.prototype.changeExpiringDate = function (params) {
122
- return __awaiter(this, void 0, void 0, function () {
123
- return __generator(this, function (_a) {
124
- switch (_a.label) {
125
- case 0: return [4 /*yield*/, this.fetch({
126
- uri: "/transactions/" + this.typeOf + "/" + params.id + "/expires",
127
- method: 'PUT',
128
- expectedStatusCodes: [http_status_1.NO_CONTENT],
129
- body: params
130
- })];
131
- case 1:
132
- _a.sent();
133
- return [2 /*return*/];
134
- }
135
- });
136
- });
137
- };
138
- /**
139
- * 取引確定(tttsPOS専用)
140
- */
141
- PlaceOrderTransactionService.prototype.confirm4tttsPOS = function (params) {
142
- return __awaiter(this, void 0, void 0, function () {
143
- var _this = this;
144
- return __generator(this, function (_a) {
145
- return [2 /*return*/, this.fetch({
146
- uri: "/transactions/" + this.typeOf + "/" + params.id + "/confirm",
147
- method: 'PUT',
148
- expectedStatusCodes: [http_status_1.OK],
149
- // retry 429(2024-04-01~)
150
- // retry 409(2024-04-01~)
151
- retryableStatusCodes: [http_status_1.CONFLICT, http_status_1.TOO_MANY_REQUESTS],
152
- body: {
153
- expectsReservationIds: true
154
- }
155
- })
156
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
157
- return [2 /*return*/, response.json()];
158
- }); }); })];
159
- });
160
- });
161
- };
162
- /**
163
- * 取引確定(レスポンス最小化)
164
- */
165
- PlaceOrderTransactionService.prototype.confirmWithMiminalResponse = function (params) {
166
- return __awaiter(this, void 0, void 0, function () {
167
- var _this = this;
168
- return __generator(this, function (_a) {
169
- return [2 /*return*/, this.fetch({
170
- uri: "/transactions/" + this.typeOf + "/" + params.id + "/confirm",
171
- method: 'PUT',
172
- expectedStatusCodes: [http_status_1.OK],
173
- // retry 429(2024-04-01~)
174
- // retry 409(2024-04-01~)
175
- retryableStatusCodes: [http_status_1.CONFLICT, http_status_1.TOO_MANY_REQUESTS],
176
- body: __assign(__assign({}, params), { expectsMinimalResponse: true })
177
- })
178
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
179
- return [2 /*return*/, response.json()];
180
- }); }); })];
181
- });
182
- });
183
- };
184
- /**
185
- * 明示的に取引を中止する
186
- * 既に確定済、あるいは、期限切れの取引に対して実行するとArgumentエラーが返されます。
187
- */
188
- PlaceOrderTransactionService.prototype.cancel = function (params) {
189
- return __awaiter(this, void 0, void 0, function () {
190
- return __generator(this, function (_a) {
191
- switch (_a.label) {
192
- case 0: return [4 /*yield*/, this.fetch({
193
- uri: "/transactions/" + this.typeOf + "/" + params.id + "/cancel",
194
- method: 'PUT',
195
- expectedStatusCodes: [http_status_1.NO_CONTENT],
196
- // retry 429(2024-04-01~)
197
- // retry 409(2024-04-01~)
198
- retryableStatusCodes: [http_status_1.CONFLICT, http_status_1.TOO_MANY_REQUESTS]
199
- })];
200
- case 1:
201
- _a.sent();
202
- return [2 /*return*/];
203
- }
204
- });
205
- });
206
- };
207
- return PlaceOrderTransactionService;
208
- }(service_1.Service));
209
- exports.PlaceOrderTransactionService = PlaceOrderTransactionService;
@@ -1,22 +0,0 @@
1
- import { IStartParams } from '../../../chevreTxn/transaction/returnOrder/factory';
2
- import * as factory from '../../../factory';
3
- import { IAdditionalOptions, IOptions, Service } from '../../../service';
4
- /**
5
- * 返品取引サービス
6
- */
7
- export declare class ReturnOrderTransactionService extends Service {
8
- typeOf: factory.transactionType.ReturnOrder;
9
- constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath'> & IAdditionalOptions);
10
- /**
11
- * 取引を開始する
12
- */
13
- start(params: IStartParams): Promise<Pick<factory.transaction.ITransaction<factory.transactionType.ReturnOrder>, 'expires' | 'id' | 'project' | 'startDate' | 'status' | 'typeOf'>>;
14
- /**
15
- * 返品取引を開始可能かどうか検証する
16
- */
17
- verifyReturnPolicy(params: Pick<IStartParams, 'object'>): Promise<void>;
18
- /**
19
- * 取引確定
20
- */
21
- confirm(params: factory.transaction.returnOrder.IConfirmParams): Promise<void>;
22
- }
@@ -1,141 +0,0 @@
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.ReturnOrderTransactionService = void 0;
66
- var http_status_1 = require("http-status");
67
- var factory = require("../../../factory");
68
- var service_1 = require("../../../service");
69
- /**
70
- * 返品取引サービス
71
- */
72
- var ReturnOrderTransactionService = /** @class */ (function (_super) {
73
- __extends(ReturnOrderTransactionService, _super);
74
- function ReturnOrderTransactionService(options) {
75
- var _this = _super.call(this, __assign(__assign({}, options), { defaultPath: '/txn', retryableStatusCodes: [http_status_1.BAD_GATEWAY, http_status_1.FORBIDDEN, http_status_1.UNAUTHORIZED] })) || this;
76
- _this.typeOf = factory.transactionType.ReturnOrder;
77
- return _this;
78
- }
79
- /**
80
- * 取引を開始する
81
- */
82
- ReturnOrderTransactionService.prototype.start = function (params) {
83
- return __awaiter(this, void 0, void 0, function () {
84
- var _this = this;
85
- return __generator(this, function (_a) {
86
- return [2 /*return*/, this.fetch({
87
- uri: "/transactions/" + this.typeOf + "/start",
88
- method: 'POST',
89
- body: params,
90
- expectedStatusCodes: [http_status_1.OK]
91
- })
92
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
93
- return [2 /*return*/, response.json()];
94
- }); }); })];
95
- });
96
- });
97
- };
98
- /**
99
- * 返品取引を開始可能かどうか検証する
100
- */
101
- ReturnOrderTransactionService.prototype.verifyReturnPolicy = function (params) {
102
- return __awaiter(this, void 0, void 0, function () {
103
- return __generator(this, function (_a) {
104
- switch (_a.label) {
105
- case 0: return [4 /*yield*/, this.fetch({
106
- uri: "/transactions/" + this.typeOf + "/start",
107
- method: 'POST',
108
- body: params,
109
- qs: { justVerify: true },
110
- expectedStatusCodes: [http_status_1.NO_CONTENT, http_status_1.OK]
111
- })];
112
- case 1:
113
- _a.sent();
114
- return [2 /*return*/];
115
- }
116
- });
117
- });
118
- };
119
- /**
120
- * 取引確定
121
- */
122
- ReturnOrderTransactionService.prototype.confirm = function (params) {
123
- return __awaiter(this, void 0, void 0, function () {
124
- return __generator(this, function (_a) {
125
- switch (_a.label) {
126
- case 0: return [4 /*yield*/, this.fetch({
127
- uri: "/transactions/" + this.typeOf + "/" + params.id + "/confirm",
128
- method: 'PUT',
129
- body: params,
130
- expectedStatusCodes: [http_status_1.NO_CONTENT]
131
- })];
132
- case 1:
133
- _a.sent();
134
- return [2 /*return*/];
135
- }
136
- });
137
- });
138
- };
139
- return ReturnOrderTransactionService;
140
- }(service_1.Service));
141
- exports.ReturnOrderTransactionService = ReturnOrderTransactionService;