Skip to content

Commit 38c222b

Browse files
committed
Release 2.2.1
1 parent 38fe274 commit 38c222b

12 files changed

+805
-1
lines changed

index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ import { Role as RoleModelImport } from "./src/models/Role";
125125
import { SalesChannel as SalesChannelModelImport } from "./src/models/SalesChannel";
126126
import { Scope as ScopeModelImport } from "./src/models/Scope";
127127
import { ServerError as ServerErrorModelImport } from "./src/models/ServerError";
128+
import { ShopifyIntegration as ShopifyIntegrationModelImport } from "./src/models/ShopifyIntegration";
129+
import { ShopifyIntegrationAppVersion as ShopifyIntegrationAppVersionModelImport } from "./src/models/ShopifyIntegrationAppVersion";
130+
import { ShopifyTransactionState as ShopifyTransactionStateModelImport } from "./src/models/ShopifyTransactionState";
128131
import { Space as SpaceModelImport } from "./src/models/Space";
129132
import { SpaceAddress as SpaceAddressModelImport } from "./src/models/SpaceAddress";
130133
import { SpaceAddressCreate as SpaceAddressCreateModelImport } from "./src/models/SpaceAddressCreate";
@@ -183,8 +186,10 @@ import { CustomerCreate as CustomerCreateModelImport } from "./src/models/Custom
183186
import { DeliveryIndication as DeliveryIndicationModelImport } from "./src/models/DeliveryIndication";
184187
import { HumanUserCreate as HumanUserCreateModelImport } from "./src/models/HumanUserCreate";
185188
import { HumanUserUpdate as HumanUserUpdateModelImport } from "./src/models/HumanUserUpdate";
189+
import { PaymentTerminalContactAddress as PaymentTerminalContactAddressModelImport } from "./src/models/PaymentTerminalContactAddress";
186190
import { RefundCommentActive as RefundCommentActiveModelImport } from "./src/models/RefundCommentActive";
187191
import { RefundCommentCreate as RefundCommentCreateModelImport } from "./src/models/RefundCommentCreate";
192+
import { ShopifyTransaction as ShopifyTransactionModelImport } from "./src/models/ShopifyTransaction";
188193
import { SpaceCreate as SpaceCreateModelImport } from "./src/models/SpaceCreate";
189194
import { SpaceUpdate as SpaceUpdateModelImport } from "./src/models/SpaceUpdate";
190195
import { TransactionCommentActive as TransactionCommentActiveModelImport } from "./src/models/TransactionCommentActive";
@@ -233,6 +238,7 @@ import { PaymentProcessorService as PaymentProcessorServiceApiImport } from "./s
233238
import { PermissionService as PermissionServiceApiImport } from "./src/api/PermissionService";
234239
import { RefundCommentService as RefundCommentServiceApiImport } from "./src/api/RefundCommentService";
235240
import { RefundService as RefundServiceApiImport } from "./src/api/RefundService";
241+
import { ShopifyTransactionService as ShopifyTransactionServiceApiImport } from "./src/api/ShopifyTransactionService";
236242
import { SpaceService as SpaceServiceApiImport } from "./src/api/SpaceService";
237243
import { StaticValueService as StaticValueServiceApiImport } from "./src/api/StaticValueService";
238244
import { TransactionCommentService as TransactionCommentServiceApiImport } from "./src/api/TransactionCommentService";
@@ -507,6 +513,12 @@ export namespace PostFinanceCheckout {
507513
export const Scope = ScopeModelImport;
508514
export type ServerError = ServerErrorModelImport;
509515
export const ServerError = ServerErrorModelImport;
516+
export type ShopifyIntegration = ShopifyIntegrationModelImport;
517+
export const ShopifyIntegration = ShopifyIntegrationModelImport;
518+
export type ShopifyIntegrationAppVersion = ShopifyIntegrationAppVersionModelImport;
519+
export const ShopifyIntegrationAppVersion = ShopifyIntegrationAppVersionModelImport;
520+
export type ShopifyTransactionState = ShopifyTransactionStateModelImport;
521+
export const ShopifyTransactionState = ShopifyTransactionStateModelImport;
510522
export type Space = SpaceModelImport;
511523
export const Space = SpaceModelImport;
512524
export type SpaceAddress = SpaceAddressModelImport;
@@ -623,10 +635,14 @@ export namespace PostFinanceCheckout {
623635
export const HumanUserCreate = HumanUserCreateModelImport;
624636
export type HumanUserUpdate = HumanUserUpdateModelImport;
625637
export const HumanUserUpdate = HumanUserUpdateModelImport;
638+
export type PaymentTerminalContactAddress = PaymentTerminalContactAddressModelImport;
639+
export const PaymentTerminalContactAddress = PaymentTerminalContactAddressModelImport;
626640
export type RefundCommentActive = RefundCommentActiveModelImport;
627641
export const RefundCommentActive = RefundCommentActiveModelImport;
628642
export type RefundCommentCreate = RefundCommentCreateModelImport;
629643
export const RefundCommentCreate = RefundCommentCreateModelImport;
644+
export type ShopifyTransaction = ShopifyTransactionModelImport;
645+
export const ShopifyTransaction = ShopifyTransactionModelImport;
630646
export type SpaceCreate = SpaceCreateModelImport;
631647
export const SpaceCreate = SpaceCreateModelImport;
632648
export type SpaceUpdate = SpaceUpdateModelImport;
@@ -724,6 +740,8 @@ export namespace PostFinanceCheckout {
724740
export const RefundCommentService = RefundCommentServiceApiImport;
725741
export type RefundService = RefundServiceApiImport;
726742
export const RefundService = RefundServiceApiImport;
743+
export type ShopifyTransactionService = ShopifyTransactionServiceApiImport;
744+
export const ShopifyTransactionService = ShopifyTransactionServiceApiImport;
727745
export type SpaceService = SpaceServiceApiImport;
728746
export const SpaceService = SpaceServiceApiImport;
729747
export type StaticValueService = StaticValueServiceApiImport;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "postfinancecheckout",
33
"title": "PostFinance Checkout",
4-
"version": "2.2.0",
4+
"version": "2.2.1",
55
"description": "TypeScript/JavaScript client for PostFinance Checkout",
66
"homepage": "http://github.com/pfpayments/typescript-sdk",
77
"repository": {
Lines changed: 319 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,319 @@
1+
'use strict';
2+
3+
import localVarRequest = require("request");
4+
import http = require("http");
5+
import Promise = require("bluebird");
6+
7+
import { Authentication } from '../auth/Authentication';
8+
import { VoidAuth } from '../auth/VoidAuth';
9+
import { ObjectSerializer } from '../serializers/ObjectSerializer';
10+
11+
import { ClientError } from '../models/ClientError';
12+
import { EntityQuery } from '../models/EntityQuery';
13+
import { EntityQueryFilter } from '../models/EntityQueryFilter';
14+
import { ServerError } from '../models/ServerError';
15+
import { ShopifyTransaction } from '../models/ShopifyTransaction';
16+
17+
class ShopifyTransactionService {
18+
protected _basePath = 'https://checkout.postfinance.ch:443/api';
19+
protected defaultHeaders : any = {};
20+
protected _useQuerystring : boolean = false;
21+
22+
protected authentications = {
23+
'default': <Authentication>new VoidAuth({})
24+
};
25+
26+
constructor(configuration: any) {
27+
this.setDefaultAuthentication(new VoidAuth(configuration))
28+
}
29+
30+
set useQuerystring(value: boolean) {
31+
this._useQuerystring = value;
32+
}
33+
34+
set basePath(basePath: string) {
35+
this._basePath = basePath;
36+
}
37+
38+
get basePath() {
39+
return this._basePath;
40+
}
41+
42+
protected setDefaultAuthentication(auth: Authentication) {
43+
this.authentications.default = auth;
44+
}
45+
46+
/**
47+
* Counts the number of items in the database as restricted by the given filter.
48+
* @summary Count
49+
* @param spaceId
50+
* @param filter The filter which restricts the entities which are used to calculate the count.
51+
* @param {*} [options] Override http request options.
52+
*/
53+
public count (spaceId: number, filter?: EntityQueryFilter, options: any = {}) : Promise<{ response: http.IncomingMessage; body: number; }> {
54+
const localVarPath = this.basePath + '/shopify-transaction/count';
55+
let localVarQueryParameters: any = {};
56+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
57+
let localVarFormParams: any = {};
58+
59+
// verify required parameter 'spaceId' is not null or undefined
60+
if (spaceId === null || spaceId === undefined) {
61+
throw new Error('Required parameter spaceId was null or undefined when calling count.');
62+
}
63+
64+
if (spaceId !== undefined) {
65+
localVarQueryParameters['spaceId'] = ObjectSerializer.serialize(spaceId, "number");
66+
}
67+
68+
(<any>Object).assign(localVarHeaderParams, options.headers);
69+
70+
let localVarUseFormData = false;
71+
72+
let localVarRequestOptions: localVarRequest.Options = {
73+
method: 'POST',
74+
qs: localVarQueryParameters,
75+
headers: localVarHeaderParams,
76+
uri: localVarPath,
77+
useQuerystring: this._useQuerystring,
78+
json: true,
79+
body: ObjectSerializer.serialize(filter, "EntityQueryFilter")
80+
};
81+
82+
this.authentications.default.applyToRequest(localVarRequestOptions);
83+
84+
if (Object.keys(localVarFormParams).length) {
85+
if (localVarUseFormData) {
86+
(<any>localVarRequestOptions).formData = localVarFormParams;
87+
} else {
88+
localVarRequestOptions.form = localVarFormParams;
89+
}
90+
}
91+
return new Promise<{ response: http.IncomingMessage; body: number; }>((resolve, reject) => {
92+
localVarRequest(localVarRequestOptions, (error, response, body) => {
93+
if (error) {
94+
return reject(error);
95+
} else {
96+
if (response.statusCode){
97+
if (response.statusCode >= 200 && response.statusCode <= 299) {
98+
body = ObjectSerializer.deserialize(body, "number");
99+
return resolve({ response: response, body: body });
100+
} else {
101+
let errorObject: ClientError | ServerError;
102+
if (response.statusCode >= 400 && response.statusCode <= 499) {
103+
errorObject = new ClientError();
104+
} else if (response.statusCode >= 500 && response.statusCode <= 599){
105+
errorObject = new ServerError();
106+
} else {
107+
errorObject = new Object();
108+
}
109+
return reject({
110+
errorType: errorObject.constructor.name,
111+
date: (new Date()).toDateString(),
112+
statusCode: <string> <any> response.statusCode,
113+
statusMessage: response.statusMessage,
114+
body: body,
115+
response: response
116+
});
117+
}
118+
}
119+
return reject({
120+
errorType: "Unknown",
121+
date: (new Date()).toDateString(),
122+
statusCode: "Unknown",
123+
statusMessage: "Unknown",
124+
body: body,
125+
response: response
126+
});
127+
128+
}
129+
});
130+
});
131+
}
132+
/**
133+
* Reads the entity with the given 'id' and returns it.
134+
* @summary Read
135+
* @param spaceId
136+
* @param id The id of the Shopify transaction which should be returned.
137+
* @param {*} [options] Override http request options.
138+
*/
139+
public read (spaceId: number, id: number, options: any = {}) : Promise<{ response: http.IncomingMessage; body: ShopifyTransaction; }> {
140+
const localVarPath = this.basePath + '/shopify-transaction/read';
141+
let localVarQueryParameters: any = {};
142+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
143+
let localVarFormParams: any = {};
144+
145+
// verify required parameter 'spaceId' is not null or undefined
146+
if (spaceId === null || spaceId === undefined) {
147+
throw new Error('Required parameter spaceId was null or undefined when calling read.');
148+
}
149+
150+
// verify required parameter 'id' is not null or undefined
151+
if (id === null || id === undefined) {
152+
throw new Error('Required parameter id was null or undefined when calling read.');
153+
}
154+
155+
if (spaceId !== undefined) {
156+
localVarQueryParameters['spaceId'] = ObjectSerializer.serialize(spaceId, "number");
157+
}
158+
159+
if (id !== undefined) {
160+
localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "number");
161+
}
162+
163+
(<any>Object).assign(localVarHeaderParams, options.headers);
164+
165+
let localVarUseFormData = false;
166+
167+
let localVarRequestOptions: localVarRequest.Options = {
168+
method: 'GET',
169+
qs: localVarQueryParameters,
170+
headers: localVarHeaderParams,
171+
uri: localVarPath,
172+
useQuerystring: this._useQuerystring,
173+
json: true,
174+
};
175+
176+
this.authentications.default.applyToRequest(localVarRequestOptions);
177+
178+
if (Object.keys(localVarFormParams).length) {
179+
if (localVarUseFormData) {
180+
(<any>localVarRequestOptions).formData = localVarFormParams;
181+
} else {
182+
localVarRequestOptions.form = localVarFormParams;
183+
}
184+
}
185+
return new Promise<{ response: http.IncomingMessage; body: ShopifyTransaction; }>((resolve, reject) => {
186+
localVarRequest(localVarRequestOptions, (error, response, body) => {
187+
if (error) {
188+
return reject(error);
189+
} else {
190+
if (response.statusCode){
191+
if (response.statusCode >= 200 && response.statusCode <= 299) {
192+
body = ObjectSerializer.deserialize(body, "ShopifyTransaction");
193+
return resolve({ response: response, body: body });
194+
} else {
195+
let errorObject: ClientError | ServerError;
196+
if (response.statusCode >= 400 && response.statusCode <= 499) {
197+
errorObject = new ClientError();
198+
} else if (response.statusCode >= 500 && response.statusCode <= 599){
199+
errorObject = new ServerError();
200+
} else {
201+
errorObject = new Object();
202+
}
203+
return reject({
204+
errorType: errorObject.constructor.name,
205+
date: (new Date()).toDateString(),
206+
statusCode: <string> <any> response.statusCode,
207+
statusMessage: response.statusMessage,
208+
body: body,
209+
response: response
210+
});
211+
}
212+
}
213+
return reject({
214+
errorType: "Unknown",
215+
date: (new Date()).toDateString(),
216+
statusCode: "Unknown",
217+
statusMessage: "Unknown",
218+
body: body,
219+
response: response
220+
});
221+
222+
}
223+
});
224+
});
225+
}
226+
/**
227+
* Searches for the entities as specified by the given query.
228+
* @summary Search
229+
* @param spaceId
230+
* @param query The query restricts the Shopify transactions which are returned by the search.
231+
* @param {*} [options] Override http request options.
232+
*/
233+
public search (spaceId: number, query: EntityQuery, options: any = {}) : Promise<{ response: http.IncomingMessage; body: Array<ShopifyTransaction>; }> {
234+
const localVarPath = this.basePath + '/shopify-transaction/search';
235+
let localVarQueryParameters: any = {};
236+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
237+
let localVarFormParams: any = {};
238+
239+
// verify required parameter 'spaceId' is not null or undefined
240+
if (spaceId === null || spaceId === undefined) {
241+
throw new Error('Required parameter spaceId was null or undefined when calling search.');
242+
}
243+
244+
// verify required parameter 'query' is not null or undefined
245+
if (query === null || query === undefined) {
246+
throw new Error('Required parameter query was null or undefined when calling search.');
247+
}
248+
249+
if (spaceId !== undefined) {
250+
localVarQueryParameters['spaceId'] = ObjectSerializer.serialize(spaceId, "number");
251+
}
252+
253+
(<any>Object).assign(localVarHeaderParams, options.headers);
254+
255+
let localVarUseFormData = false;
256+
257+
let localVarRequestOptions: localVarRequest.Options = {
258+
method: 'POST',
259+
qs: localVarQueryParameters,
260+
headers: localVarHeaderParams,
261+
uri: localVarPath,
262+
useQuerystring: this._useQuerystring,
263+
json: true,
264+
body: ObjectSerializer.serialize(query, "EntityQuery")
265+
};
266+
267+
this.authentications.default.applyToRequest(localVarRequestOptions);
268+
269+
if (Object.keys(localVarFormParams).length) {
270+
if (localVarUseFormData) {
271+
(<any>localVarRequestOptions).formData = localVarFormParams;
272+
} else {
273+
localVarRequestOptions.form = localVarFormParams;
274+
}
275+
}
276+
return new Promise<{ response: http.IncomingMessage; body: Array<ShopifyTransaction>; }>((resolve, reject) => {
277+
localVarRequest(localVarRequestOptions, (error, response, body) => {
278+
if (error) {
279+
return reject(error);
280+
} else {
281+
if (response.statusCode){
282+
if (response.statusCode >= 200 && response.statusCode <= 299) {
283+
body = ObjectSerializer.deserialize(body, "Array<ShopifyTransaction>");
284+
return resolve({ response: response, body: body });
285+
} else {
286+
let errorObject: ClientError | ServerError;
287+
if (response.statusCode >= 400 && response.statusCode <= 499) {
288+
errorObject = new ClientError();
289+
} else if (response.statusCode >= 500 && response.statusCode <= 599){
290+
errorObject = new ServerError();
291+
} else {
292+
errorObject = new Object();
293+
}
294+
return reject({
295+
errorType: errorObject.constructor.name,
296+
date: (new Date()).toDateString(),
297+
statusCode: <string> <any> response.statusCode,
298+
statusMessage: response.statusMessage,
299+
body: body,
300+
response: response
301+
});
302+
}
303+
}
304+
return reject({
305+
errorType: "Unknown",
306+
date: (new Date()).toDateString(),
307+
statusCode: "Unknown",
308+
statusMessage: "Unknown",
309+
body: body,
310+
response: response
311+
});
312+
313+
}
314+
});
315+
});
316+
}
317+
}
318+
319+
export { ShopifyTransactionService }

0 commit comments

Comments
 (0)