@ptkl/sdk 0.8.4 → 0.9.1

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
@@ -17862,6 +17862,7 @@ class PlatformBaseClient extends BaseClient {
17862
17862
  host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
17863
17863
  // @ts-ignore
17864
17864
  env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
17865
+ token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
17865
17866
  }
17866
17867
  if (token) {
17867
17868
  headers['Authorization'] = `Bearer ${token}`;
@@ -18361,14 +18362,14 @@ class Platform extends PlatformBaseClient {
18361
18362
 
18362
18363
  class Invoicing extends PlatformBaseClient {
18363
18364
  async getSalesInvoices(provider, page) {
18364
- return await this.request("GET", `/invoices/${provider}/sales`, {
18365
+ return await this.request("GET", `invoices/${provider}/sales`, {
18365
18366
  params: {
18366
18367
  page: page || 1
18367
18368
  }
18368
18369
  });
18369
18370
  }
18370
18371
  async acceptPurchaseInvoice(provider, id, comment) {
18371
- return await this.request('POST', `/invoices/${provider}/purchase/acceptReject/${id}`, {
18372
+ return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
18372
18373
  data: {
18373
18374
  accepted: true,
18374
18375
  comment: comment
@@ -18378,7 +18379,7 @@ class Invoicing extends PlatformBaseClient {
18378
18379
  async request(method, endpoint, params) {
18379
18380
  return await this.client.request({
18380
18381
  method: method,
18381
- url: `/v1/integrations/karadjordje/${endpoint}`,
18382
+ url: `/karadjordje/v1/${endpoint}`,
18382
18383
  ...params
18383
18384
  });
18384
18385
  }
@@ -18414,7 +18415,7 @@ class IntegrationsBaseClient extends BaseClient {
18414
18415
  headers['X-Project-Env'] = env;
18415
18416
  }
18416
18417
  const client = axios.create({
18417
- baseURL: host !== null && host !== undefined ? host : "https://orange.protokol.io",
18418
+ baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io/luma/integrations",
18418
18419
  timeout: 15000,
18419
18420
  headers: {
18420
18421
  ...headers,
@@ -18572,6 +18573,21 @@ class VPFR extends IntegrationsBaseClient {
18572
18573
  }
18573
18574
  }
18574
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, amount, description, user) {
18584
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
18585
+ totalAmount: amount.toString(),
18586
+ description,
18587
+ });
18588
+ }
18589
+ }
18590
+
18575
18591
  // import integrations
18576
18592
  class Integrations extends IntegrationsBaseClient {
18577
18593
  constructor(options) {
@@ -18581,6 +18597,7 @@ class Integrations extends IntegrationsBaseClient {
18581
18597
  'protokol-vpfr': new VPFR().setClient(this.client),
18582
18598
  'protokol-media': new Media().setClient(this.client),
18583
18599
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
18600
+ 'protokol-payments': new Payments().setClient(this.client),
18584
18601
  };
18585
18602
  }
18586
18603
  getSerbiaUtilities() {
@@ -18595,6 +18612,9 @@ class Integrations extends IntegrationsBaseClient {
18595
18612
  getInvoicing() {
18596
18613
  return this.getInterfaceOf('protokol-invoicing');
18597
18614
  }
18615
+ getPayments() {
18616
+ return this.getInterfaceOf('protokol-payments');
18617
+ }
18598
18618
  async isInstalled(id) {
18599
18619
  const { data } = await this.client.get("/v1/integrations");
18600
18620
  return data.find((i) => i.id == id) !== undefined;
package/dist/index.esm.js CHANGED
@@ -52,6 +52,7 @@ class PlatformBaseClient extends BaseClient {
52
52
  host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
53
53
  // @ts-ignore
54
54
  env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
55
+ token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
55
56
  }
56
57
  if (token) {
57
58
  headers['Authorization'] = `Bearer ${token}`;
@@ -551,14 +552,14 @@ class Platform extends PlatformBaseClient {
551
552
 
552
553
  class Invoicing extends PlatformBaseClient {
553
554
  async getSalesInvoices(provider, page) {
554
- return await this.request("GET", `/invoices/${provider}/sales`, {
555
+ return await this.request("GET", `invoices/${provider}/sales`, {
555
556
  params: {
556
557
  page: page || 1
557
558
  }
558
559
  });
559
560
  }
560
561
  async acceptPurchaseInvoice(provider, id, comment) {
561
- return await this.request('POST', `/invoices/${provider}/purchase/acceptReject/${id}`, {
562
+ return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
562
563
  data: {
563
564
  accepted: true,
564
565
  comment: comment
@@ -568,7 +569,7 @@ class Invoicing extends PlatformBaseClient {
568
569
  async request(method, endpoint, params) {
569
570
  return await this.client.request({
570
571
  method: method,
571
- url: `/v1/integrations/karadjordje/${endpoint}`,
572
+ url: `/karadjordje/v1/${endpoint}`,
572
573
  ...params
573
574
  });
574
575
  }
@@ -604,7 +605,7 @@ class IntegrationsBaseClient extends BaseClient {
604
605
  headers['X-Project-Env'] = env;
605
606
  }
606
607
  const client = axios.create({
607
- baseURL: host !== null && host !== undefined ? host : "https://orange.protokol.io",
608
+ baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io/luma/integrations",
608
609
  timeout: 15000,
609
610
  headers: {
610
611
  ...headers,
@@ -762,6 +763,21 @@ class VPFR extends IntegrationsBaseClient {
762
763
  }
763
764
  }
764
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, amount, description, user) {
774
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
775
+ totalAmount: amount.toString(),
776
+ description,
777
+ });
778
+ }
779
+ }
780
+
765
781
  // import integrations
766
782
  class Integrations extends IntegrationsBaseClient {
767
783
  constructor(options) {
@@ -771,6 +787,7 @@ class Integrations extends IntegrationsBaseClient {
771
787
  'protokol-vpfr': new VPFR().setClient(this.client),
772
788
  'protokol-media': new Media().setClient(this.client),
773
789
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
790
+ 'protokol-payments': new Payments().setClient(this.client),
774
791
  };
775
792
  }
776
793
  getSerbiaUtilities() {
@@ -785,6 +802,9 @@ class Integrations extends IntegrationsBaseClient {
785
802
  getInvoicing() {
786
803
  return this.getInterfaceOf('protokol-invoicing');
787
804
  }
805
+ getPayments() {
806
+ return this.getInterfaceOf('protokol-payments');
807
+ }
788
808
  async isInstalled(id) {
789
809
  const { data } = await this.client.get("/v1/integrations");
790
810
  return data.find((i) => i.id == id) !== undefined;
@@ -53,6 +53,7 @@ var ProtokolSDK = (function (exports, axios) {
53
53
  host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
54
54
  // @ts-ignore
55
55
  env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
56
+ token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
56
57
  }
57
58
  if (token) {
58
59
  headers['Authorization'] = `Bearer ${token}`;
@@ -552,14 +553,14 @@ var ProtokolSDK = (function (exports, axios) {
552
553
 
553
554
  class Invoicing extends PlatformBaseClient {
554
555
  async getSalesInvoices(provider, page) {
555
- return await this.request("GET", `/invoices/${provider}/sales`, {
556
+ return await this.request("GET", `invoices/${provider}/sales`, {
556
557
  params: {
557
558
  page: page || 1
558
559
  }
559
560
  });
560
561
  }
561
562
  async acceptPurchaseInvoice(provider, id, comment) {
562
- return await this.request('POST', `/invoices/${provider}/purchase/acceptReject/${id}`, {
563
+ return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
563
564
  data: {
564
565
  accepted: true,
565
566
  comment: comment
@@ -569,7 +570,7 @@ var ProtokolSDK = (function (exports, axios) {
569
570
  async request(method, endpoint, params) {
570
571
  return await this.client.request({
571
572
  method: method,
572
- url: `/v1/integrations/karadjordje/${endpoint}`,
573
+ url: `/karadjordje/v1/${endpoint}`,
573
574
  ...params
574
575
  });
575
576
  }
@@ -605,7 +606,7 @@ var ProtokolSDK = (function (exports, axios) {
605
606
  headers['X-Project-Env'] = env;
606
607
  }
607
608
  const client = axios.create({
608
- baseURL: host !== null && host !== undefined ? host : "https://orange.protokol.io",
609
+ baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io/luma/integrations",
609
610
  timeout: 15000,
610
611
  headers: {
611
612
  ...headers,
@@ -763,6 +764,21 @@ var ProtokolSDK = (function (exports, axios) {
763
764
  }
764
765
  }
765
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, amount, description, user) {
775
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
776
+ totalAmount: amount.toString(),
777
+ description,
778
+ });
779
+ }
780
+ }
781
+
766
782
  // import integrations
767
783
  class Integrations extends IntegrationsBaseClient {
768
784
  constructor(options) {
@@ -772,6 +788,7 @@ var ProtokolSDK = (function (exports, axios) {
772
788
  'protokol-vpfr': new VPFR().setClient(this.client),
773
789
  'protokol-media': new Media().setClient(this.client),
774
790
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
791
+ 'protokol-payments': new Payments().setClient(this.client),
775
792
  };
776
793
  }
777
794
  getSerbiaUtilities() {
@@ -786,6 +803,9 @@ var ProtokolSDK = (function (exports, axios) {
786
803
  getInvoicing() {
787
804
  return this.getInterfaceOf('protokol-invoicing');
788
805
  }
806
+ getPayments() {
807
+ return this.getInterfaceOf('protokol-payments');
808
+ }
789
809
  async isInstalled(id) {
790
810
  const { data } = await this.client.get("/v1/integrations");
791
811
  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.3",
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 } 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, amount: number, description: string, user: string): 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 @@
1
+ export type PaymentProvider = 'monri';
package/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"