@ptkl/sdk 0.9.0 → 0.9.2

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/dist/index.cjs.js CHANGED
@@ -18362,14 +18362,14 @@ class Platform extends PlatformBaseClient {
18362
18362
 
18363
18363
  class Invoicing extends PlatformBaseClient {
18364
18364
  async getSalesInvoices(provider, page) {
18365
- return await this.request("GET", `/invoices/${provider}/sales`, {
18365
+ return await this.request("GET", `invoices/${provider}/sales`, {
18366
18366
  params: {
18367
18367
  page: page || 1
18368
18368
  }
18369
18369
  });
18370
18370
  }
18371
18371
  async acceptPurchaseInvoice(provider, id, comment) {
18372
- return await this.request('POST', `/invoices/${provider}/purchase/acceptReject/${id}`, {
18372
+ return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
18373
18373
  data: {
18374
18374
  accepted: true,
18375
18375
  comment: comment
@@ -18379,7 +18379,7 @@ class Invoicing extends PlatformBaseClient {
18379
18379
  async request(method, endpoint, params) {
18380
18380
  return await this.client.request({
18381
18381
  method: method,
18382
- url: `/v1/integrations/karadjordje/${endpoint}`,
18382
+ url: `/karadjordje/v1/${endpoint}`,
18383
18383
  ...params
18384
18384
  });
18385
18385
  }
@@ -18415,7 +18415,7 @@ class IntegrationsBaseClient extends BaseClient {
18415
18415
  headers['X-Project-Env'] = env;
18416
18416
  }
18417
18417
  const client = axios.create({
18418
- baseURL: host !== null && host !== undefined ? host : "https://orange.protokol.io",
18418
+ baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io/luma/integrations",
18419
18419
  timeout: 15000,
18420
18420
  headers: {
18421
18421
  ...headers,
@@ -18573,6 +18573,23 @@ class VPFR extends IntegrationsBaseClient {
18573
18573
  }
18574
18574
  }
18575
18575
 
18576
+ class Payments extends IntegrationsBaseClient {
18577
+ async getTransactions(user) {
18578
+ return await this.client.get(`/karadjordje/v1/payment/${user}/list`);
18579
+ }
18580
+ async settings(provider) {
18581
+ return await this.client.get(`/karadjordje/v1/payment/${provider}/settings`);
18582
+ }
18583
+ async getPaymentLink(provider, user, options) {
18584
+ var _a;
18585
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
18586
+ totalAmount: options.totalAmount.toString(),
18587
+ description: options.description,
18588
+ redirectUrl: (_a = options.redirectUrl) !== null && _a !== undefined ? _a : null,
18589
+ });
18590
+ }
18591
+ }
18592
+
18576
18593
  // import integrations
18577
18594
  class Integrations extends IntegrationsBaseClient {
18578
18595
  constructor(options) {
@@ -18582,6 +18599,7 @@ class Integrations extends IntegrationsBaseClient {
18582
18599
  'protokol-vpfr': new VPFR().setClient(this.client),
18583
18600
  'protokol-media': new Media().setClient(this.client),
18584
18601
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
18602
+ 'protokol-payments': new Payments().setClient(this.client),
18585
18603
  };
18586
18604
  }
18587
18605
  getSerbiaUtilities() {
@@ -18596,6 +18614,9 @@ class Integrations extends IntegrationsBaseClient {
18596
18614
  getInvoicing() {
18597
18615
  return this.getInterfaceOf('protokol-invoicing');
18598
18616
  }
18617
+ getPayments() {
18618
+ return this.getInterfaceOf('protokol-payments');
18619
+ }
18599
18620
  async isInstalled(id) {
18600
18621
  const { data } = await this.client.get("/v1/integrations");
18601
18622
  return data.find((i) => i.id == id) !== undefined;
package/dist/index.esm.js CHANGED
@@ -552,14 +552,14 @@ class Platform extends PlatformBaseClient {
552
552
 
553
553
  class Invoicing extends PlatformBaseClient {
554
554
  async getSalesInvoices(provider, page) {
555
- return await this.request("GET", `/invoices/${provider}/sales`, {
555
+ return await this.request("GET", `invoices/${provider}/sales`, {
556
556
  params: {
557
557
  page: page || 1
558
558
  }
559
559
  });
560
560
  }
561
561
  async acceptPurchaseInvoice(provider, id, comment) {
562
- return await this.request('POST', `/invoices/${provider}/purchase/acceptReject/${id}`, {
562
+ return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
563
563
  data: {
564
564
  accepted: true,
565
565
  comment: comment
@@ -569,7 +569,7 @@ class Invoicing extends PlatformBaseClient {
569
569
  async request(method, endpoint, params) {
570
570
  return await this.client.request({
571
571
  method: method,
572
- url: `/v1/integrations/karadjordje/${endpoint}`,
572
+ url: `/karadjordje/v1/${endpoint}`,
573
573
  ...params
574
574
  });
575
575
  }
@@ -605,7 +605,7 @@ class IntegrationsBaseClient extends BaseClient {
605
605
  headers['X-Project-Env'] = env;
606
606
  }
607
607
  const client = axios.create({
608
- baseURL: host !== null && host !== undefined ? host : "https://orange.protokol.io",
608
+ baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io/luma/integrations",
609
609
  timeout: 15000,
610
610
  headers: {
611
611
  ...headers,
@@ -763,6 +763,23 @@ class VPFR extends IntegrationsBaseClient {
763
763
  }
764
764
  }
765
765
 
766
+ class Payments extends IntegrationsBaseClient {
767
+ async getTransactions(user) {
768
+ return await this.client.get(`/karadjordje/v1/payment/${user}/list`);
769
+ }
770
+ async settings(provider) {
771
+ return await this.client.get(`/karadjordje/v1/payment/${provider}/settings`);
772
+ }
773
+ async getPaymentLink(provider, user, options) {
774
+ var _a;
775
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
776
+ totalAmount: options.totalAmount.toString(),
777
+ description: options.description,
778
+ redirectUrl: (_a = options.redirectUrl) !== null && _a !== undefined ? _a : null,
779
+ });
780
+ }
781
+ }
782
+
766
783
  // import integrations
767
784
  class Integrations extends IntegrationsBaseClient {
768
785
  constructor(options) {
@@ -772,6 +789,7 @@ class Integrations extends IntegrationsBaseClient {
772
789
  'protokol-vpfr': new VPFR().setClient(this.client),
773
790
  'protokol-media': new Media().setClient(this.client),
774
791
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
792
+ 'protokol-payments': new Payments().setClient(this.client),
775
793
  };
776
794
  }
777
795
  getSerbiaUtilities() {
@@ -786,6 +804,9 @@ class Integrations extends IntegrationsBaseClient {
786
804
  getInvoicing() {
787
805
  return this.getInterfaceOf('protokol-invoicing');
788
806
  }
807
+ getPayments() {
808
+ return this.getInterfaceOf('protokol-payments');
809
+ }
789
810
  async isInstalled(id) {
790
811
  const { data } = await this.client.get("/v1/integrations");
791
812
  return data.find((i) => i.id == id) !== undefined;
@@ -553,14 +553,14 @@ var ProtokolSDK = (function (exports, axios) {
553
553
 
554
554
  class Invoicing extends PlatformBaseClient {
555
555
  async getSalesInvoices(provider, page) {
556
- return await this.request("GET", `/invoices/${provider}/sales`, {
556
+ return await this.request("GET", `invoices/${provider}/sales`, {
557
557
  params: {
558
558
  page: page || 1
559
559
  }
560
560
  });
561
561
  }
562
562
  async acceptPurchaseInvoice(provider, id, comment) {
563
- return await this.request('POST', `/invoices/${provider}/purchase/acceptReject/${id}`, {
563
+ return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
564
564
  data: {
565
565
  accepted: true,
566
566
  comment: comment
@@ -570,7 +570,7 @@ var ProtokolSDK = (function (exports, axios) {
570
570
  async request(method, endpoint, params) {
571
571
  return await this.client.request({
572
572
  method: method,
573
- url: `/v1/integrations/karadjordje/${endpoint}`,
573
+ url: `/karadjordje/v1/${endpoint}`,
574
574
  ...params
575
575
  });
576
576
  }
@@ -606,7 +606,7 @@ var ProtokolSDK = (function (exports, axios) {
606
606
  headers['X-Project-Env'] = env;
607
607
  }
608
608
  const client = axios.create({
609
- baseURL: host !== null && host !== undefined ? host : "https://orange.protokol.io",
609
+ baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io/luma/integrations",
610
610
  timeout: 15000,
611
611
  headers: {
612
612
  ...headers,
@@ -764,6 +764,23 @@ var ProtokolSDK = (function (exports, axios) {
764
764
  }
765
765
  }
766
766
 
767
+ class Payments extends IntegrationsBaseClient {
768
+ async getTransactions(user) {
769
+ return await this.client.get(`/karadjordje/v1/payment/${user}/list`);
770
+ }
771
+ async settings(provider) {
772
+ return await this.client.get(`/karadjordje/v1/payment/${provider}/settings`);
773
+ }
774
+ async getPaymentLink(provider, user, options) {
775
+ var _a;
776
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
777
+ totalAmount: options.totalAmount.toString(),
778
+ description: options.description,
779
+ redirectUrl: (_a = options.redirectUrl) !== null && _a !== undefined ? _a : null,
780
+ });
781
+ }
782
+ }
783
+
767
784
  // import integrations
768
785
  class Integrations extends IntegrationsBaseClient {
769
786
  constructor(options) {
@@ -773,6 +790,7 @@ var ProtokolSDK = (function (exports, axios) {
773
790
  'protokol-vpfr': new VPFR().setClient(this.client),
774
791
  'protokol-media': new Media().setClient(this.client),
775
792
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
793
+ 'protokol-payments': new Payments().setClient(this.client),
776
794
  };
777
795
  }
778
796
  getSerbiaUtilities() {
@@ -787,6 +805,9 @@ var ProtokolSDK = (function (exports, axios) {
787
805
  getInvoicing() {
788
806
  return this.getInterfaceOf('protokol-invoicing');
789
807
  }
808
+ getPayments() {
809
+ return this.getInterfaceOf('protokol-payments');
810
+ }
790
811
  async isInstalled(id) {
791
812
  const { data } = await this.client.get("/v1/integrations");
792
813
  return data.find((i) => i.id == id) !== undefined;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.8.4",
3
+ "version": "0.9.1",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"
@@ -0,0 +1,7 @@
1
+ import IntegrationsBaseClient from "../integrationsBaseClient";
2
+ import { PaymentProvider, GetPaymentLinkOptions } from "../../types/integrations";
3
+ export default class Payments extends IntegrationsBaseClient {
4
+ getTransactions(user: string): Promise<import("axios").AxiosResponse<any, any>>;
5
+ settings(provider: PaymentProvider): Promise<import("axios").AxiosResponse<any, any>>;
6
+ getPaymentLink(provider: PaymentProvider, user: string, options: GetPaymentLinkOptions): Promise<import("axios").AxiosResponse<any, any>>;
7
+ }
@@ -10,6 +10,7 @@ export default class Integrations extends IntegrationsBaseClient {
10
10
  getDMS(): any;
11
11
  getVPFR(): any;
12
12
  getInvoicing(): any;
13
+ getPayments(): any;
13
14
  isInstalled(id: string): Promise<boolean>;
14
15
  getInterfaceOf(id: string): any;
15
16
  }
@@ -0,0 +1,6 @@
1
+ export type PaymentProvider = 'monri';
2
+ export type GetPaymentLinkOptions = {
3
+ totalAmount: number;
4
+ description: string;
5
+ redirectUrl?: string | null;
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"