Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smartbase-js/raiaccept-api-client",
"version": "0.9.2",
"version": "0.9.3",
"description": "TypeScript SDK for RaiAccept payment gateway API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
32 changes: 28 additions & 4 deletions src/api/RaiAcceptAPIApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class RaiAcceptAPIApi {
/**
* Create a new RaiAcceptAPIApi instance
* @param client - HTTP client instance (optional)
* @param cert - Client certificate for mTLS (optional, required for API_URL endpoints: createOrderEntry, createPaymentSession, getOrderDetails, getOrderTransactions, getTransactionDetails, refund)
* @param key - Client private key for mTLS (optional, required for API_URL endpoints)
* @param cert - Client certificate for mTLS
* @param key - Client private key for mTLS
*/
constructor(client: HttpClient | null = null, cert?: string | Buffer, key?: string | Buffer) {
this.client = client || new HttpClient();
Expand Down Expand Up @@ -129,6 +129,12 @@ export class RaiAcceptAPIApi {
if (!password) {
throw new InvalidArgumentException('Missing the required parameter $password when calling tokenRequest');
}
if (!this.cert) {
throw new InvalidArgumentException('Missing the required parameter $cert when calling token (provide in constructor)');
}
if (!this.key) {
throw new InvalidArgumentException('Missing the required parameter $key when calling token (provide in constructor)');
}

const loginInput = new AuthApiLoginInput();
loginInput.username = username;
Expand All @@ -144,6 +150,8 @@ export class RaiAcceptAPIApi {
url: `${RaiAcceptAPIApi.AUTH_URL}/auth/api/login`,
headers: headers,
body: httpBody,
cert: this.cert,
key: this.key,
} as HttpRequest;
}

Expand All @@ -166,6 +174,12 @@ export class RaiAcceptAPIApi {
if (!refreshToken) {
throw new InvalidArgumentException('Missing the required parameter $refreshToken when calling tokenRefreshRequest');
}
if (!this.cert) {
throw new InvalidArgumentException('Missing the required parameter $cert when calling tokenRefresh (provide in constructor)');
}
if (!this.key) {
throw new InvalidArgumentException('Missing the required parameter $key when calling tokenRefresh (provide in constructor)');
}

const refreshInput = new AuthApiRefreshInput();
refreshInput.refreshToken = refreshToken;
Expand All @@ -180,7 +194,9 @@ export class RaiAcceptAPIApi {
url: `${RaiAcceptAPIApi.AUTH_URL}/auth/api/refresh`,
headers: headers,
body: httpBody,
};
cert: this.cert,
key: this.key,
} as HttpRequest;
}

/**
Expand Down Expand Up @@ -209,6 +225,12 @@ export class RaiAcceptAPIApi {
if (!token) {
throw new InvalidArgumentException('Missing the required parameter $token when calling tokenLogoutRequest');
}
if (!this.cert) {
throw new InvalidArgumentException('Missing the required parameter $cert when calling tokenLogout (provide in constructor)');
}
if (!this.key) {
throw new InvalidArgumentException('Missing the required parameter $key when calling tokenLogout (provide in constructor)');
}

const logoutInput = new AuthApiLogoutInput();
logoutInput.refreshToken = token;
Expand All @@ -223,7 +245,9 @@ export class RaiAcceptAPIApi {
url: `${RaiAcceptAPIApi.AUTH_URL}/auth/api/logout`,
headers: headers,
body: httpBody,
};
cert: this.cert,
key: this.key,
} as HttpRequest;
}

/**
Expand Down