From 280da0306eb491a4586b9c81105b90376c3b68d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Wi=C4=99cek?= Date: Mon, 5 Jun 2023 18:32:40 +0200 Subject: [PATCH] Update eslintignore, package.json, and models for DirectBilling and SMS services The commit updates the .eslintignore file to ignore the lib/ directory, updates the version number in package.json from 2.2.4 to 2.3.0, adds linting scripts to package.json, and modifies import statements in DirectBilling and SMS service models to use single quotes instead of double quotes. Additionally, it changes some number type parameters in DirectBilling and SMS service methods from `number` to `string`. --- .eslintignore | 1 + lib/index.d.ts | 42 +++++++++---------- .../transaction/db.notifications.request.d.ts | 2 +- lib/models/sms/service/sms.service.d.ts | 2 +- lib/payments/directbilling.d.ts | 12 +++--- lib/payments/sms.d.ts | 16 +++---- lib/tests/directbilling.js | 14 +++---- lib/tests/sms.js | 18 ++++---- package.json | 5 ++- src/index.ts | 42 +++++++++---------- .../transaction/db.notifications.request.ts | 2 +- src/models/sms/service/sms.service.ts | 2 +- src/payments/directbilling.ts | 12 +++--- src/payments/sms.ts | 16 +++---- src/tests/directbilling.ts | 14 +++---- src/tests/sms.ts | 20 ++++----- 16 files changed, 111 insertions(+), 109 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..f1ff06d --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +lib/ \ No newline at end of file diff --git a/lib/index.d.ts b/lib/index.d.ts index 5afd9b1..2ce63c8 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -1,21 +1,21 @@ -export { DbCalculation } from "./models/directbilling/service/db.calculation"; -export { DbProvider, DbProviderID } from "./models/directbilling/db.provider"; -export { DbService, DbServiceNotify } from "./models/directbilling/service/db.service"; -export { PartialDbService } from "./models/directbilling/service/partial.db.service"; -export { DbGenerationResponse } from "./models/directbilling/transaction/db.generation.response"; -export { DbTransactionRequest } from "./models/directbilling/transaction/db.transaction.request"; -export { DbTransactionStatus } from "./models/directbilling/transaction/db.transaction.status"; -export { DbTransaction } from "./models/directbilling/transaction/db.transaction"; -export { PartialDbTransaction } from "./models/directbilling/transaction/partial.db.transaction"; -export { DBServiceStatus } from "./models/directbilling/service/db.service.status"; -export { PaginatedResponse } from "./models/response/paginated.response"; -export { AmountType } from "./models/amount.type"; -export { SmsNumber } from "./models/sms/service/sms.number"; -export { SmsService } from "./models/sms/service/sms.service"; -export { SmsServiceType } from "./models/sms/service/sms.service.type"; -export { SmsTransaction } from "./models/sms/transaction/sms.transaction"; -export { VerificationResponse } from "./models/sms/verification.response"; -export { SMSServiceStatus } from "./models/sms/service/sms.service.status"; -export { DirectBilling } from "./payments/directbilling"; -export { Sms } from "./payments/sms"; -export { SmsXml } from "./payments/sms.xml"; +export { DbCalculation } from './models/directbilling/service/db.calculation'; +export { DbProvider, DbProviderID } from './models/directbilling/db.provider'; +export { DbService, DbServiceNotify } from './models/directbilling/service/db.service'; +export { PartialDbService } from './models/directbilling/service/partial.db.service'; +export { DbGenerationResponse } from './models/directbilling/transaction/db.generation.response'; +export { DbTransactionRequest } from './models/directbilling/transaction/db.transaction.request'; +export { DbTransactionStatus } from './models/directbilling/transaction/db.transaction.status'; +export { DbTransaction } from './models/directbilling/transaction/db.transaction'; +export { PartialDbTransaction } from './models/directbilling/transaction/partial.db.transaction'; +export { DBServiceStatus } from './models/directbilling/service/db.service.status'; +export { PaginatedResponse } from './models/response/paginated.response'; +export { AmountType } from './models/amount.type'; +export { SmsNumber } from './models/sms/service/sms.number'; +export { SmsService } from './models/sms/service/sms.service'; +export { SmsServiceType } from './models/sms/service/sms.service.type'; +export { SmsTransaction } from './models/sms/transaction/sms.transaction'; +export { VerificationResponse } from './models/sms/verification.response'; +export { SMSServiceStatus } from './models/sms/service/sms.service.status'; +export { DirectBilling } from './payments/directbilling'; +export { Sms } from './payments/sms'; +export { SmsXml } from './payments/sms.xml'; diff --git a/lib/models/directbilling/transaction/db.notifications.request.d.ts b/lib/models/directbilling/transaction/db.notifications.request.d.ts index acb719c..9e87508 100644 --- a/lib/models/directbilling/transaction/db.notifications.request.d.ts +++ b/lib/models/directbilling/transaction/db.notifications.request.d.ts @@ -3,7 +3,7 @@ import { DbTransactionStatus } from '../transaction/db.transaction.status'; import { DbProviderID } from '../db.provider'; export interface DbNotificationRequest { id: string; - service_id: number; + service_id: string; status: DbTransactionStatus; values?: { net?: number; diff --git a/lib/models/sms/service/sms.service.d.ts b/lib/models/sms/service/sms.service.d.ts index d1f8b63..79cf0f2 100644 --- a/lib/models/sms/service/sms.service.d.ts +++ b/lib/models/sms/service/sms.service.d.ts @@ -1,7 +1,7 @@ import { SmsServiceType } from './sms.service.type'; import { SMSServiceStatus } from './sms.service.status'; export interface SmsService { - id: number; + id: string; type: SmsServiceType; status: SMSServiceStatus; name: string; diff --git a/lib/payments/directbilling.d.ts b/lib/payments/directbilling.d.ts index 4bedd86..8f768fe 100644 --- a/lib/payments/directbilling.d.ts +++ b/lib/payments/directbilling.d.ts @@ -14,12 +14,12 @@ export declare class DirectBilling { constructor(key: string, password: string); getServices(): Promise; getServicesPaginated(page?: number, pageSize?: number): Promise>; - getService(id: number): Promise; - calculateCommission(serviceId: number, amount: number): Promise; - getTransactions(serviceId: number): Promise; - getTransactionsPaginated(serviceId: number, page?: number, pageSize?: number): Promise>; - getTransaction(serviceId: number, transactionId: string): Promise; - createTransaction(serviceId: number, key: string, request: DbTransactionRequest): Promise; + getService(id: string): Promise; + calculateCommission(serviceId: string, amount: number): Promise; + getTransactions(serviceId: string): Promise; + getTransactionsPaginated(serviceId: string, page?: number, pageSize?: number): Promise>; + getTransaction(serviceId: string, transactionId: string): Promise; + createTransaction(serviceId: string, key: string, request: DbTransactionRequest): Promise; checkNotification(key: string, body: any): DbNotificationRequest | undefined; generateSignature(key: string, request: DbTransactionRequest): string; generateSignatureNotification(key: string, request: DbNotificationRequest): string; diff --git a/lib/payments/sms.d.ts b/lib/payments/sms.d.ts index 7b08c97..6a401b1 100644 --- a/lib/payments/sms.d.ts +++ b/lib/payments/sms.d.ts @@ -10,15 +10,15 @@ export declare class Sms { constructor(key: string, password: string); getServices(): Promise; getServicesPaginated(page?: number, pageSize?: number): Promise>; - getService(id: number): Promise; - getTransactions(serviceId: number): Promise; - getTransactionsPaginated(serviceId: number, page?: number, pageSize?: number): Promise>; - getTransaction(serviceId: number, transactionId: number): Promise; - getServiceNumbers(serviceId: number): Promise; - getServiceNumbersPaginated(serviceId: number, page?: number, pageSize?: number): Promise>; - getServiceNumber(serviceId: number, number: number): Promise; + getService(id: string): Promise; + getTransactions(serviceId: string): Promise; + getTransactionsPaginated(serviceId: string, page?: number, pageSize?: number): Promise>; + getTransaction(serviceId: string, transactionId: number): Promise; + getServiceNumbers(serviceId: string): Promise; + getServiceNumbersPaginated(serviceId: string, page?: number, pageSize?: number): Promise>; + getServiceNumber(serviceId: string, number: number): Promise; getNumbers(): Promise; getNumbersPaginated(page?: number, pageSize?: number): Promise>; getNumber(number: number): Promise; - verifySmsCode(serviceId: number, code: string, number?: number): Promise; + verifySmsCode(serviceId: string, code: string, number?: number): Promise; } diff --git a/lib/tests/directbilling.js b/lib/tests/directbilling.js index 034b250..39ab240 100644 --- a/lib/tests/directbilling.js +++ b/lib/tests/directbilling.js @@ -17,22 +17,22 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () { console.log(yield db.getServices()); console.log(yield db.getServicesPaginated(1, 100)); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-pobieranie-informacji-o-usludze - console.log(yield db.getService(158)); + console.log(yield db.getService('19f3b33c')); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-kalkulacja-prowizji - console.log(yield db.calculateCommission(158, 10.00)); + console.log(yield db.calculateCommission('19f3b33c', 10.00)); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-pobieranie-listy-transakcji - const transactionsList = yield db.getTransactions(158); + const transactionsList = yield db.getTransactions('19f3b33c'); console.log(transactionsList); - console.log(yield db.getTransactionsPaginated(158, 1, 100)); + console.log(yield db.getTransactionsPaginated('19f3b33c', 1, 100)); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-pobieranie-informacji-o-transakcji - console.log(yield db.getTransaction(158, transactionsList === null || transactionsList === void 0 ? void 0 : transactionsList[0].id)); + console.log(yield db.getTransaction('19f3b33c', transactionsList === null || transactionsList === void 0 ? void 0 : transactionsList[0].id)); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-generowanie-transakcji - console.log(yield db.createTransaction(158, 'key', { + console.log(yield db.createTransaction('19f3b33c', 'key', { amount: 10.00, amountType: amount_type_1.AmountType.GROSS, control: 'test' })); - console.log(yield db.checkNotification('key', {})); + console.log(db.checkNotification('key', {})); }); // eslint-disable-next-line @typescript-eslint/no-empty-function void run(); diff --git a/lib/tests/sms.js b/lib/tests/sms.js index de1fea3..88d3ca6 100644 --- a/lib/tests/sms.js +++ b/lib/tests/sms.js @@ -16,25 +16,25 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () { console.log(yield sms.getServices()); console.log(yield sms.getServicesPaginated(1, 100)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-informacji-o-usludze - console.log(yield sms.getService(3549)); + console.log(yield sms.getService('d151e4f9')); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-listy-transakcji - console.log(yield sms.getTransactions(3549)); - console.log(yield sms.getTransactionsPaginated(3549, 1, 100)); + console.log(yield sms.getTransactions('d151e4f9')); + console.log(yield sms.getTransactionsPaginated('d151e4f9', 1, 100)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-informacji-o-transakcji - console.log(yield sms.getTransaction(3549, 2216609)); + console.log(yield sms.getTransaction('d151e4f9', 2216609)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-dostepnych-numerow-dla-uslugi - console.log(yield sms.getServiceNumbers(3549)); - console.log(yield sms.getServiceNumbersPaginated(3549, 1, 100)); + console.log(yield sms.getServiceNumbers('d151e4f9')); + console.log(yield sms.getServiceNumbersPaginated('d151e4f9', 1, 100)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-informacji-o-pojedynczym-numerze-uslugi - console.log(yield sms.getServiceNumber(3549, 7055)); + console.log(yield sms.getServiceNumber('d151e4f9', 7055)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-wszystkich-dostepnych-numerow console.log(yield sms.getNumbers()); console.log(yield sms.getNumbersPaginated(1, 100)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-pojedynczego-numeru-sms console.log(yield sms.getNumber(7055)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-weryfikacja-poprawnosci-kodu - console.log(yield sms.verifySmsCode(3549, '81FFC5', 7055)); - console.log(yield sms.verifySmsCode(3549, '81FFC5')); + console.log(yield sms.verifySmsCode('d151e4f9', '81FFC5', 7055)); + console.log(yield sms.verifySmsCode('d151e4f9', '81FFC5')); }); // eslint-disable-next-line @typescript-eslint/no-empty-function void run(); diff --git a/package.json b/package.json index c199fb4..5ab8498 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { "name": "simpay-typescript-api", "author": "Rafał Więcek", - "version": "2.2.4", + "version": "2.3.0", "description": "SimPay.pl API", "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build": "tsc", - "lint": "eslint", + "lint": "eslint .", + "lint:fix": "eslint --fix .", "dev": "tsc && node lib/test.js" }, "keywords": [ diff --git a/src/index.ts b/src/index.ts index b6bb515..fbc2f61 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,28 +1,28 @@ // DirectBilling - Models -export { DbCalculation } from "./models/directbilling/service/db.calculation"; -export { DbProvider, DbProviderID } from "./models/directbilling/db.provider"; -export { DbService, DbServiceNotify } from "./models/directbilling/service/db.service"; -export { PartialDbService } from "./models/directbilling/service/partial.db.service"; -export { DbGenerationResponse } from "./models/directbilling/transaction/db.generation.response"; -export { DbTransactionRequest } from "./models/directbilling/transaction/db.transaction.request"; -export { DbTransactionStatus } from "./models/directbilling/transaction/db.transaction.status"; -export { DbTransaction } from "./models/directbilling/transaction/db.transaction"; -export { PartialDbTransaction } from "./models/directbilling/transaction/partial.db.transaction"; -export { DBServiceStatus } from "./models/directbilling/service/db.service.status"; +export { DbCalculation } from './models/directbilling/service/db.calculation'; +export { DbProvider, DbProviderID } from './models/directbilling/db.provider'; +export { DbService, DbServiceNotify } from './models/directbilling/service/db.service'; +export { PartialDbService } from './models/directbilling/service/partial.db.service'; +export { DbGenerationResponse } from './models/directbilling/transaction/db.generation.response'; +export { DbTransactionRequest } from './models/directbilling/transaction/db.transaction.request'; +export { DbTransactionStatus } from './models/directbilling/transaction/db.transaction.status'; +export { DbTransaction } from './models/directbilling/transaction/db.transaction'; +export { PartialDbTransaction } from './models/directbilling/transaction/partial.db.transaction'; +export { DBServiceStatus } from './models/directbilling/service/db.service.status'; // Response -export { PaginatedResponse } from "./models/response/paginated.response"; -export { AmountType } from "./models/amount.type"; +export { PaginatedResponse } from './models/response/paginated.response'; +export { AmountType } from './models/amount.type'; // SMS - Models -export { SmsNumber } from "./models/sms/service/sms.number"; -export { SmsService } from "./models/sms/service/sms.service"; -export { SmsServiceType } from "./models/sms/service/sms.service.type"; -export { SmsTransaction } from "./models/sms/transaction/sms.transaction"; -export { VerificationResponse } from "./models/sms/verification.response"; -export { SMSServiceStatus } from "./models/sms/service/sms.service.status"; +export { SmsNumber } from './models/sms/service/sms.number'; +export { SmsService } from './models/sms/service/sms.service'; +export { SmsServiceType } from './models/sms/service/sms.service.type'; +export { SmsTransaction } from './models/sms/transaction/sms.transaction'; +export { VerificationResponse } from './models/sms/verification.response'; +export { SMSServiceStatus } from './models/sms/service/sms.service.status'; // Payments -export { DirectBilling } from "./payments/directbilling" -export { Sms } from "./payments/sms" -export { SmsXml } from "./payments/sms.xml" \ No newline at end of file +export { DirectBilling } from './payments/directbilling'; +export { Sms } from './payments/sms'; +export { SmsXml } from './payments/sms.xml'; \ No newline at end of file diff --git a/src/models/directbilling/transaction/db.notifications.request.ts b/src/models/directbilling/transaction/db.notifications.request.ts index 9297c11..f97d5eb 100644 --- a/src/models/directbilling/transaction/db.notifications.request.ts +++ b/src/models/directbilling/transaction/db.notifications.request.ts @@ -4,7 +4,7 @@ import {DbProviderID} from '../db.provider'; export interface DbNotificationRequest { id: string, - service_id: number, + service_id: string, status: DbTransactionStatus, values?: { net?: number, diff --git a/src/models/sms/service/sms.service.ts b/src/models/sms/service/sms.service.ts index 42b29d2..dde9346 100644 --- a/src/models/sms/service/sms.service.ts +++ b/src/models/sms/service/sms.service.ts @@ -2,7 +2,7 @@ import {SmsServiceType} from './sms.service.type'; import {SMSServiceStatus} from './sms.service.status'; export interface SmsService { - id: number; + id: string; type: SmsServiceType; diff --git a/src/payments/directbilling.ts b/src/payments/directbilling.ts index abe42fc..0f15faf 100644 --- a/src/payments/directbilling.ts +++ b/src/payments/directbilling.ts @@ -75,7 +75,7 @@ export class DirectBilling { /* https://docs.simpay.pl/pl/typescript/?typescript#directbilling-pobieranie-informacji-o-usludze */ - async getService(id: number): Promise { + async getService(id: string): Promise { try { const service = (await this.client.get(`/${id}`)).data.data; @@ -90,14 +90,14 @@ export class DirectBilling { /* https://docs.simpay.pl/pl/typescript/?typescript#directbilling-kalkulacja-prowizji */ - async calculateCommission(serviceId: number, amount: number): Promise { + async calculateCommission(serviceId: string, amount: number): Promise { return (await this.client.get(`/${serviceId}/calculate?amount=${amount}`)).data.data; } /* https://docs.simpay.pl/pl/typescript/?typescript#directbilling-pobieranie-listy-transakcji */ - async getTransactions(serviceId: number): Promise { + async getTransactions(serviceId: string): Promise { const result = []; let response = await this.client.get(`/${serviceId}/transactions`); @@ -118,7 +118,7 @@ export class DirectBilling { }); } - async getTransactionsPaginated(serviceId: number, page?: number, pageSize?: number): Promise> { + async getTransactionsPaginated(serviceId: string, page?: number, pageSize?: number): Promise> { const query: any = {}; if (page) query.page = `${page}`; @@ -141,7 +141,7 @@ export class DirectBilling { /* https://docs.simpay.pl/pl/typescript/?typescript#directbilling-pobieranie-informacji-o-transakcji */ - async getTransaction(serviceId: number, transactionId: string): Promise { + async getTransaction(serviceId: string, transactionId: string): Promise { const transaction = (await this.client.get(`/${serviceId}/transactions/${transactionId}`)).data.data; transaction.created_at = new Date(transaction.created_at.replace(' ', 'T')); @@ -153,7 +153,7 @@ export class DirectBilling { /* https://docs.simpay.pl/pl/typescript/?typescript#directbilling-generowanie-transakcji */ - async createTransaction(serviceId: number, key: string, request: DbTransactionRequest): Promise { + async createTransaction(serviceId: string, key: string, request: DbTransactionRequest): Promise { request.signature = this.generateSignature(key, request); return (await this.client.post(`/${serviceId}/transactions`, request)).data; diff --git a/src/payments/sms.ts b/src/payments/sms.ts index 19f25e1..3ee7551 100644 --- a/src/payments/sms.ts +++ b/src/payments/sms.ts @@ -70,7 +70,7 @@ export class Sms { /* https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-informacji-o-usludze */ - async getService(id: number): Promise { + async getService(id: string): Promise { const service = (await this.client.get(`/${id}`)).data.data; service.created_at = new Date(service.created_at.replace(' ', 'T')); @@ -81,7 +81,7 @@ export class Sms { /* https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-listy-transakcji */ - async getTransactions(serviceId: number): Promise { + async getTransactions(serviceId: string): Promise { const result = []; let response = await this.client.get(`/${serviceId}/transactions`); @@ -101,7 +101,7 @@ export class Sms { }); } - async getTransactionsPaginated(serviceId: number, page?: number, pageSize?: number): Promise> { + async getTransactionsPaginated(serviceId: string, page?: number, pageSize?: number): Promise> { const query: any = {}; if (page) query.page = `${page}`; @@ -123,7 +123,7 @@ export class Sms { /* https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-informacji-o-transakcji */ - async getTransaction(serviceId: number, transactionId: number): Promise { + async getTransaction(serviceId: string, transactionId: number): Promise { const transaction = (await this.client.get(`/${serviceId}/transactions/${transactionId}`)).data.data; transaction.send_at = new Date(transaction.send_at.replace(' ', 'T')); @@ -134,7 +134,7 @@ export class Sms { /* https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-dostepnych-numerow-dla-uslugi */ - async getServiceNumbers(serviceId: number): Promise { + async getServiceNumbers(serviceId: string): Promise { const result = []; let response = await this.client.get(`/${serviceId}/numbers`); @@ -150,7 +150,7 @@ export class Sms { return result; } - async getServiceNumbersPaginated(serviceId: number, page?: number, pageSize?: number): Promise> { + async getServiceNumbersPaginated(serviceId: string, page?: number, pageSize?: number): Promise> { const query: any = {}; if (page) query.page = `${page}`; @@ -164,7 +164,7 @@ export class Sms { /* https://docs.simpay.pl/pl/typescript/?typescript#sms-informacji-o-pojedynczym-numerze-uslugi */ - async getServiceNumber(serviceId: number, number: number): Promise { + async getServiceNumber(serviceId: string, number: number): Promise { return (await this.client.get(`/${serviceId}/numbers/${number}`)).data.data; } @@ -208,7 +208,7 @@ export class Sms { /* https://docs.simpay.pl/pl/typescript/?typescript#sms-weryfikacja-poprawnosci-kodu */ - async verifySmsCode(serviceId: number, code: string, number?: number): Promise { + async verifySmsCode(serviceId: string, code: string, number?: number): Promise { const response = (await this.client.post(`/${serviceId}`, { code, number })).data.data; if( response.used_at ) { diff --git a/src/tests/directbilling.ts b/src/tests/directbilling.ts index 84368bb..c66f264 100644 --- a/src/tests/directbilling.ts +++ b/src/tests/directbilling.ts @@ -9,29 +9,29 @@ const run = async () => { console.log( await db.getServicesPaginated(1, 100) ); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-pobieranie-informacji-o-usludze - console.log( await db.getService(158) ); + console.log( await db.getService('19f3b33c') ); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-kalkulacja-prowizji - console.log( await db.calculateCommission(158, 10.00) ); + console.log( await db.calculateCommission('19f3b33c', 10.00) ); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-pobieranie-listy-transakcji - const transactionsList = await db.getTransactions(158); + const transactionsList = await db.getTransactions('19f3b33c'); console.log( transactionsList ); - console.log( await db.getTransactionsPaginated(158, 1, 100) ); + console.log( await db.getTransactionsPaginated('19f3b33c', 1, 100) ); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-pobieranie-informacji-o-transakcji - console.log( await db.getTransaction(158, transactionsList?.[ 0 ].id) ); + console.log( await db.getTransaction('19f3b33c', transactionsList?.[ 0 ].id) ); // https://docs.simpay.pl/pl/typescript/?typescript#directbilling-generowanie-transakcji - console.log( await db.createTransaction(158, 'key', { + console.log( await db.createTransaction('19f3b33c', 'key', { amount: 10.00, amountType: AmountType.GROSS, control: 'test' })); - console.log( await db.checkNotification('key', {})); + console.log( db.checkNotification('key', {})); }; // eslint-disable-next-line @typescript-eslint/no-empty-function diff --git a/src/tests/sms.ts b/src/tests/sms.ts index b6b92ed..6bb1075 100644 --- a/src/tests/sms.ts +++ b/src/tests/sms.ts @@ -1,4 +1,4 @@ -import { Sms } from "../payments/sms"; +import { Sms } from '../payments/sms'; const run = async () => { const sms = new Sms('0b4dca15', '3eea38f407073ff0abff956b57d71783'); @@ -8,21 +8,21 @@ const run = async () => { console.log( await sms.getServicesPaginated(1, 100)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-informacji-o-usludze - console.log( await sms.getService(3549)); + console.log( await sms.getService('d151e4f9')); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-listy-transakcji - console.log( await sms.getTransactions(3549)); - console.log( await sms.getTransactionsPaginated(3549, 1, 100)); + console.log( await sms.getTransactions('d151e4f9')); + console.log( await sms.getTransactionsPaginated('d151e4f9', 1, 100)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-informacji-o-transakcji - console.log( await sms.getTransaction(3549, 2216609)); + console.log( await sms.getTransaction('d151e4f9', 2216609)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-dostepnych-numerow-dla-uslugi - console.log( await sms.getServiceNumbers(3549)); - console.log( await sms.getServiceNumbersPaginated(3549, 1, 100)); + console.log( await sms.getServiceNumbers('d151e4f9')); + console.log( await sms.getServiceNumbersPaginated('d151e4f9', 1, 100)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-informacji-o-pojedynczym-numerze-uslugi - console.log( await sms.getServiceNumber(3549, 7055)); + console.log( await sms.getServiceNumber('d151e4f9', 7055)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-pobieranie-wszystkich-dostepnych-numerow console.log( await sms.getNumbers()); @@ -32,8 +32,8 @@ const run = async () => { console.log( await sms.getNumber(7055)); // https://docs.simpay.pl/pl/typescript/?typescript#sms-weryfikacja-poprawnosci-kodu - console.log( await sms.verifySmsCode(3549, '81FFC5', 7055)); - console.log( await sms.verifySmsCode(3549, '81FFC5')); + console.log( await sms.verifySmsCode('d151e4f9', '81FFC5', 7055)); + console.log( await sms.verifySmsCode('d151e4f9', '81FFC5')); }; // eslint-disable-next-line @typescript-eslint/no-empty-function