@technance/technance-payment-sdk 1.0.3
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/CHANGELOG.md +13 -0
- package/dist/ApiClient-CWwFZrLg.d.ts +70 -0
- package/dist/ApiClient.d.ts +13 -0
- package/dist/ApiClient.js +1 -0
- package/dist/Client.d.ts +13 -0
- package/dist/Client.js +1 -0
- package/dist/endpoints/Backoffice/Client.d.ts +13 -0
- package/dist/endpoints/Backoffice/Client.js +1 -0
- package/dist/endpoints/Backoffice/index.d.ts +13 -0
- package/dist/endpoints/Backoffice/index.js +1 -0
- package/dist/endpoints/Backoffice/types.d.ts +25 -0
- package/dist/endpoints/Backoffice/types.js +1 -0
- package/dist/endpoints/Currencies/Client.d.ts +13 -0
- package/dist/endpoints/Currencies/Client.js +1 -0
- package/dist/endpoints/Currencies/index.d.ts +13 -0
- package/dist/endpoints/Currencies/index.js +1 -0
- package/dist/endpoints/Networks/Client.d.ts +13 -0
- package/dist/endpoints/Networks/Client.js +1 -0
- package/dist/endpoints/Networks/index.d.ts +13 -0
- package/dist/endpoints/Networks/index.js +1 -0
- package/dist/endpoints/Orders/Client.d.ts +13 -0
- package/dist/endpoints/Orders/Client.js +1 -0
- package/dist/endpoints/Orders/index.d.ts +13 -0
- package/dist/endpoints/Orders/index.js +1 -0
- package/dist/endpoints/Orders/types.d.ts +28 -0
- package/dist/endpoints/Orders/types.js +1 -0
- package/dist/endpoints/Partners/Client.d.ts +13 -0
- package/dist/endpoints/Partners/Client.js +1 -0
- package/dist/endpoints/Partners/index.d.ts +13 -0
- package/dist/endpoints/Partners/index.js +1 -0
- package/dist/endpoints/index.d.ts +18 -0
- package/dist/endpoints/index.js +1 -0
- package/dist/index-CO0zNEaF.d.ts +8 -0
- package/dist/index-CghKRuMZ.d.ts +11 -0
- package/dist/index-Dc3DD3A1.d.ts +8 -0
- package/dist/index-Ddpq6m3Y.d.ts +8 -0
- package/dist/index-FMX04nfE.d.ts +8 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1 -0
- package/dist/routing.d.ts +34 -0
- package/dist/routing.js +1 -0
- package/dist/types/Backoffice.d.ts +93 -0
- package/dist/types/Backoffice.js +1 -0
- package/dist/types/Balance.d.ts +6 -0
- package/dist/types/Balance.js +1 -0
- package/dist/types/Currency.d.ts +7 -0
- package/dist/types/Currency.js +1 -0
- package/dist/types/CurrencyRef.d.ts +7 -0
- package/dist/types/CurrencyRef.js +1 -0
- package/dist/types/Network.d.ts +7 -0
- package/dist/types/Network.js +1 -0
- package/dist/types/Order.d.ts +28 -0
- package/dist/types/Order.js +1 -0
- package/dist/types/OrderRef.d.ts +10 -0
- package/dist/types/OrderRef.js +1 -0
- package/dist/types/OrderResult.d.ts +17 -0
- package/dist/types/OrderResult.js +1 -0
- package/dist/types/Pagination.d.ts +15 -0
- package/dist/types/Pagination.js +1 -0
- package/dist/types/Partner.d.ts +15 -0
- package/dist/types/Partner.js +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +1 -0
- package/dist/webhooks/index.d.ts +4 -0
- package/dist/webhooks/index.js +1 -0
- package/dist/webhooks/types.d.ts +17 -0
- package/dist/webhooks/types.js +1 -0
- package/dist/webhooks/validator.d.ts +19 -0
- package/dist/webhooks/validator.js +1 -0
- package/package.json +58 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as axios from 'axios';
|
|
2
|
+
import { AxiosInstance } from 'axios';
|
|
3
|
+
import { Order } from './types/Order.js';
|
|
4
|
+
import { OrderRef } from './types/OrderRef.js';
|
|
5
|
+
import { Pagination } from './types/Pagination.js';
|
|
6
|
+
import { PlaceOrder, GetManyOrder } from './endpoints/Orders/types.js';
|
|
7
|
+
import { Balance } from './types/Balance.js';
|
|
8
|
+
import { Partner } from './types/Partner.js';
|
|
9
|
+
import { Currency } from './types/Currency.js';
|
|
10
|
+
import { Network } from './types/Network.js';
|
|
11
|
+
import { BackofficeWithdrawalOrder, BackofficeWithdrawalOrderDetail, VaultBalance, BackofficeWebhookDelivery } from './types/Backoffice.js';
|
|
12
|
+
import { GetManyWithdrawalOrders, GetManyWebhookDeliveries } from './endpoints/Backoffice/types.js';
|
|
13
|
+
|
|
14
|
+
declare class Client$4 {
|
|
15
|
+
private readonly apiClient;
|
|
16
|
+
constructor(apiClient: ApiClient);
|
|
17
|
+
placeOrder(payload: PlaceOrder.Payload): Promise<axios.AxiosResponse<OrderRef[], any, {}>>;
|
|
18
|
+
getMany(query?: GetManyOrder.Query): Promise<axios.AxiosResponse<Pagination<Order>, any, {}>>;
|
|
19
|
+
getOne(id: string | number): Promise<axios.AxiosResponse<Order, any, {}>>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare class Client$3 {
|
|
23
|
+
private readonly apiClient;
|
|
24
|
+
constructor(apiClient: ApiClient);
|
|
25
|
+
me(): Promise<axios.AxiosResponse<Partner, any, {}>>;
|
|
26
|
+
balance(): Promise<axios.AxiosResponse<Balance[], any, {}>>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class Client$2 {
|
|
30
|
+
private readonly apiClient;
|
|
31
|
+
constructor(apiClient: ApiClient);
|
|
32
|
+
getAll(): Promise<axios.AxiosResponse<Currency[], any, {}>>;
|
|
33
|
+
getOne(symbol: string): Promise<axios.AxiosResponse<Currency, any, {}>>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare class Client$1 {
|
|
37
|
+
private readonly apiClient;
|
|
38
|
+
constructor(apiClient: ApiClient);
|
|
39
|
+
getAll(): Promise<axios.AxiosResponse<Network[], any, {}>>;
|
|
40
|
+
getOne(symbol: string): Promise<axios.AxiosResponse<Network, any, {}>>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare class Client {
|
|
44
|
+
private readonly apiClient;
|
|
45
|
+
constructor(apiClient: ApiClient);
|
|
46
|
+
getWithdrawalOrders(query?: GetManyWithdrawalOrders.Query): Promise<axios.AxiosResponse<Pagination<BackofficeWithdrawalOrder>, any, {}>>;
|
|
47
|
+
getWithdrawalOrder(id: string | number): Promise<axios.AxiosResponse<BackofficeWithdrawalOrderDetail, any, {}>>;
|
|
48
|
+
getVaultBalances(): Promise<axios.AxiosResponse<VaultBalance[], any, {}>>;
|
|
49
|
+
getWebhookDeliveries(query?: GetManyWebhookDeliveries.Query): Promise<axios.AxiosResponse<Pagination<BackofficeWebhookDelivery>, any, {}>>;
|
|
50
|
+
retryWebhookDelivery(id: string): Promise<axios.AxiosResponse<BackofficeWebhookDelivery, any, {}>>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface ClientParams {
|
|
54
|
+
baseUrl: string;
|
|
55
|
+
apiKey: string | undefined;
|
|
56
|
+
backofficeApiKey?: string;
|
|
57
|
+
}
|
|
58
|
+
declare function createClient({ baseUrl, apiKey, backofficeApiKey }: ClientParams): {
|
|
59
|
+
api: axios.AxiosInstance;
|
|
60
|
+
orders: Client$4;
|
|
61
|
+
partners: Client$3;
|
|
62
|
+
currencies: Client$2;
|
|
63
|
+
networks: Client$1;
|
|
64
|
+
backoffice: Client;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type ApiClient = AxiosInstance;
|
|
68
|
+
declare function createApiClient({ baseUrl, apiKey, backofficeApiKey }: ClientParams): AxiosInstance;
|
|
69
|
+
|
|
70
|
+
export { type ApiClient as A, Client as C, Client$2 as a, Client$4 as b, Client$3 as c, Client$1 as d, type ClientParams as e, createApiClient as f, createClient as g };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'axios';
|
|
2
|
+
export { A as ApiClient, f as createApiClient } from './ApiClient-CWwFZrLg.js';
|
|
3
|
+
import './types/Order.js';
|
|
4
|
+
import './types/OrderRef.js';
|
|
5
|
+
import './types/Pagination.js';
|
|
6
|
+
import './endpoints/Orders/types.js';
|
|
7
|
+
import './types/Balance.js';
|
|
8
|
+
import './types/Partner.js';
|
|
9
|
+
import './types/Currency.js';
|
|
10
|
+
import './types/CurrencyRef.js';
|
|
11
|
+
import './types/Network.js';
|
|
12
|
+
import './types/Backoffice.js';
|
|
13
|
+
import './endpoints/Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var o=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);function a({baseUrl:i,apiKey:t,backofficeApiKey:n}){const e={"Content-Type":"application/json"};return t&&(e["x-api-key"]=t),n&&(e["x-backoffice-api-key"]=n),o__default.default.create({baseURL:i,headers:{common:e}})}exports.createApiClient=a;
|
package/dist/Client.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'axios';
|
|
2
|
+
export { e as ClientParams, g as createClient } from './ApiClient-CWwFZrLg.js';
|
|
3
|
+
import './types/Order.js';
|
|
4
|
+
import './types/OrderRef.js';
|
|
5
|
+
import './types/Pagination.js';
|
|
6
|
+
import './endpoints/Orders/types.js';
|
|
7
|
+
import './types/Balance.js';
|
|
8
|
+
import './types/Partner.js';
|
|
9
|
+
import './types/Currency.js';
|
|
10
|
+
import './types/CurrencyRef.js';
|
|
11
|
+
import './types/Network.js';
|
|
12
|
+
import './types/Backoffice.js';
|
|
13
|
+
import './endpoints/Backoffice/types.js';
|
package/dist/Client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var ApiClient=require('./ApiClient'),endpoints=require('./endpoints');var f=Object.defineProperty;var i=Object.getOwnPropertySymbols;var l=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var c=(r,e,n)=>e in r?f(r,e,{enumerable:true,configurable:true,writable:true,value:n}):r[e]=n,o=(r,e)=>{for(var n in e||(e={}))l.call(e,n)&&c(r,n,e[n]);if(i)for(var n of i(e))p.call(e,n)&&c(r,n,e[n]);return r};function x({baseUrl:r,apiKey:e,backofficeApiKey:n}){const t=ApiClient.createApiClient({baseUrl:r,apiKey:e}),a=ApiClient.createApiClient(o({baseUrl:r,apiKey:e},n?{backofficeApiKey:n}:{})),C=new endpoints.Backoffice.Client(a);return {api:t,orders:new endpoints.Orders.Client(t),partners:new endpoints.Partners.Client(t),currencies:new endpoints.Currencies.Client(t),networks:new endpoints.Networks.Client(t),backoffice:C}}exports.createClient=x;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'axios';
|
|
2
|
+
export { C as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
3
|
+
import '../../types/Backoffice.js';
|
|
4
|
+
import '../../types/Pagination.js';
|
|
5
|
+
import './types.js';
|
|
6
|
+
import '../../types/Order.js';
|
|
7
|
+
import '../../types/OrderRef.js';
|
|
8
|
+
import '../Orders/types.js';
|
|
9
|
+
import '../../types/Balance.js';
|
|
10
|
+
import '../../types/Partner.js';
|
|
11
|
+
import '../../types/Currency.js';
|
|
12
|
+
import '../../types/CurrencyRef.js';
|
|
13
|
+
import '../../types/Network.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var routing=require('../../routing');class o{constructor(e){this.apiClient=e;}getWithdrawalOrders(e){const t=routing.routing.backoffice.withdrawals.getMany;return this.apiClient.get(t,{params:e})}getWithdrawalOrder(e){const t=routing.routing.backoffice.withdrawals.getOne(e);return this.apiClient.get(t)}getVaultBalances(){const e=routing.routing.backoffice.vault.balances;return this.apiClient.get(e)}getWebhookDeliveries(e){const t=routing.routing.backoffice.webhooks.getMany;return this.apiClient.get(t,{params:e})}retryWebhookDelivery(e){const t=routing.routing.backoffice.webhooks.retry(e);return this.apiClient.post(t)}}exports.Client=o;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { C as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
2
|
+
export { GetManyWebhookDeliveries, GetManyWithdrawalOrders } from './types.js';
|
|
3
|
+
import 'axios';
|
|
4
|
+
import '../../types/Order.js';
|
|
5
|
+
import '../../types/OrderRef.js';
|
|
6
|
+
import '../../types/Pagination.js';
|
|
7
|
+
import '../Orders/types.js';
|
|
8
|
+
import '../../types/Balance.js';
|
|
9
|
+
import '../../types/Partner.js';
|
|
10
|
+
import '../../types/Currency.js';
|
|
11
|
+
import '../../types/CurrencyRef.js';
|
|
12
|
+
import '../../types/Network.js';
|
|
13
|
+
import '../../types/Backoffice.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var Client=require('./Client'),types=require('./types');Object.keys(Client).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Client[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BackofficeWebhookEvent, BackofficeWebhookDeliveryStatus } from '../../types/Backoffice.js';
|
|
2
|
+
import { Order } from '../../types/Order.js';
|
|
3
|
+
|
|
4
|
+
declare namespace GetManyWithdrawalOrders {
|
|
5
|
+
type Query = {
|
|
6
|
+
limit?: number;
|
|
7
|
+
page?: number;
|
|
8
|
+
all?: boolean;
|
|
9
|
+
status?: Order.Status;
|
|
10
|
+
refId?: string;
|
|
11
|
+
owner?: string;
|
|
12
|
+
partnerId?: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare namespace GetManyWebhookDeliveries {
|
|
16
|
+
type Query = {
|
|
17
|
+
limit?: number;
|
|
18
|
+
page?: number;
|
|
19
|
+
all?: boolean;
|
|
20
|
+
event?: BackofficeWebhookEvent;
|
|
21
|
+
status?: BackofficeWebhookDeliveryStatus;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { GetManyWebhookDeliveries, GetManyWithdrawalOrders };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'axios';
|
|
2
|
+
export { a as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
3
|
+
import '../../types/Currency.js';
|
|
4
|
+
import '../../types/Order.js';
|
|
5
|
+
import '../../types/OrderRef.js';
|
|
6
|
+
import '../../types/Pagination.js';
|
|
7
|
+
import '../Orders/types.js';
|
|
8
|
+
import '../../types/Balance.js';
|
|
9
|
+
import '../../types/Partner.js';
|
|
10
|
+
import '../../types/Network.js';
|
|
11
|
+
import '../../types/CurrencyRef.js';
|
|
12
|
+
import '../../types/Backoffice.js';
|
|
13
|
+
import '../Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var routing=require('../../routing');class o{constructor(t){this.apiClient=t;}getAll(){const t=routing.routing.currencies.getAll;return this.apiClient.get(t)}getOne(t){const r=routing.routing.currencies.getOne(t);return this.apiClient.get(r)}}exports.Client=o;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { a as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
2
|
+
import 'axios';
|
|
3
|
+
import '../../types/Order.js';
|
|
4
|
+
import '../../types/OrderRef.js';
|
|
5
|
+
import '../../types/Pagination.js';
|
|
6
|
+
import '../Orders/types.js';
|
|
7
|
+
import '../../types/Balance.js';
|
|
8
|
+
import '../../types/Partner.js';
|
|
9
|
+
import '../../types/Currency.js';
|
|
10
|
+
import '../../types/CurrencyRef.js';
|
|
11
|
+
import '../../types/Network.js';
|
|
12
|
+
import '../../types/Backoffice.js';
|
|
13
|
+
import '../Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var Client=require('./Client');Object.keys(Client).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Client[k]}})});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'axios';
|
|
2
|
+
export { d as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
3
|
+
import '../../types/Network.js';
|
|
4
|
+
import '../../types/Order.js';
|
|
5
|
+
import '../../types/OrderRef.js';
|
|
6
|
+
import '../../types/Pagination.js';
|
|
7
|
+
import '../Orders/types.js';
|
|
8
|
+
import '../../types/Balance.js';
|
|
9
|
+
import '../../types/Partner.js';
|
|
10
|
+
import '../../types/Currency.js';
|
|
11
|
+
import '../../types/CurrencyRef.js';
|
|
12
|
+
import '../../types/Backoffice.js';
|
|
13
|
+
import '../Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var routing=require('../../routing');class l{constructor(t){this.apiClient=t;}getAll(){const t=routing.routing.networks.getAll;return this.apiClient.get(t)}getOne(t){const i=routing.routing.networks.getOne(t);return this.apiClient.get(i)}}exports.Client=l;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { d as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
2
|
+
import 'axios';
|
|
3
|
+
import '../../types/Order.js';
|
|
4
|
+
import '../../types/OrderRef.js';
|
|
5
|
+
import '../../types/Pagination.js';
|
|
6
|
+
import '../Orders/types.js';
|
|
7
|
+
import '../../types/Balance.js';
|
|
8
|
+
import '../../types/Partner.js';
|
|
9
|
+
import '../../types/Currency.js';
|
|
10
|
+
import '../../types/CurrencyRef.js';
|
|
11
|
+
import '../../types/Network.js';
|
|
12
|
+
import '../../types/Backoffice.js';
|
|
13
|
+
import '../Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var Client=require('./Client');Object.keys(Client).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Client[k]}})});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'axios';
|
|
2
|
+
export { b as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
3
|
+
import '../../types/Order.js';
|
|
4
|
+
import '../../types/OrderRef.js';
|
|
5
|
+
import '../../types/Pagination.js';
|
|
6
|
+
import './types.js';
|
|
7
|
+
import '../../types/Balance.js';
|
|
8
|
+
import '../../types/Partner.js';
|
|
9
|
+
import '../../types/Currency.js';
|
|
10
|
+
import '../../types/CurrencyRef.js';
|
|
11
|
+
import '../../types/Network.js';
|
|
12
|
+
import '../../types/Backoffice.js';
|
|
13
|
+
import '../Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var routing=require('../../routing');class o{constructor(r){this.apiClient=r;}placeOrder(r){const e=routing.routing.orders.placeOrder;return this.apiClient.post(e,r)}getMany(r){const e=routing.routing.orders.getMany;return this.apiClient.get(e,{params:r})}getOne(r){const e=routing.routing.orders.getOne(r);return this.apiClient.get(e)}}exports.Client=o;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { b as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
2
|
+
import 'axios';
|
|
3
|
+
import '../../types/Order.js';
|
|
4
|
+
import '../../types/OrderRef.js';
|
|
5
|
+
import '../../types/Pagination.js';
|
|
6
|
+
import './types.js';
|
|
7
|
+
import '../../types/Balance.js';
|
|
8
|
+
import '../../types/Partner.js';
|
|
9
|
+
import '../../types/Currency.js';
|
|
10
|
+
import '../../types/CurrencyRef.js';
|
|
11
|
+
import '../../types/Network.js';
|
|
12
|
+
import '../../types/Backoffice.js';
|
|
13
|
+
import '../Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var Client=require('./Client');Object.keys(Client).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Client[k]}})});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Order } from '../../types/Order.js';
|
|
2
|
+
|
|
3
|
+
declare namespace PlaceOrder {
|
|
4
|
+
type Payload = {
|
|
5
|
+
description?: string;
|
|
6
|
+
orders: OrderPayload[];
|
|
7
|
+
};
|
|
8
|
+
type OrderPayload = {
|
|
9
|
+
address: string;
|
|
10
|
+
currency: string;
|
|
11
|
+
network: string;
|
|
12
|
+
amount: string;
|
|
13
|
+
usdAmount: string;
|
|
14
|
+
refId?: string;
|
|
15
|
+
owner?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
declare namespace GetManyOrder {
|
|
19
|
+
type Query = {
|
|
20
|
+
limit?: number;
|
|
21
|
+
page?: number;
|
|
22
|
+
all?: boolean;
|
|
23
|
+
status?: Order.Status;
|
|
24
|
+
refId?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { GetManyOrder, PlaceOrder };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'axios';
|
|
2
|
+
export { c as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
3
|
+
import '../../types/Balance.js';
|
|
4
|
+
import '../../types/Partner.js';
|
|
5
|
+
import '../../types/Order.js';
|
|
6
|
+
import '../../types/OrderRef.js';
|
|
7
|
+
import '../../types/Pagination.js';
|
|
8
|
+
import '../Orders/types.js';
|
|
9
|
+
import '../../types/Currency.js';
|
|
10
|
+
import '../../types/CurrencyRef.js';
|
|
11
|
+
import '../../types/Network.js';
|
|
12
|
+
import '../../types/Backoffice.js';
|
|
13
|
+
import '../Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var routing=require('../../routing');class a{constructor(t){this.apiClient=t;}me(){const t=routing.routing.partners.me;return this.apiClient.get(t)}balance(){const t=routing.routing.partners.balances;return this.apiClient.get(t)}}exports.Client=a;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { c as Client } from '../../ApiClient-CWwFZrLg.js';
|
|
2
|
+
import 'axios';
|
|
3
|
+
import '../../types/Order.js';
|
|
4
|
+
import '../../types/OrderRef.js';
|
|
5
|
+
import '../../types/Pagination.js';
|
|
6
|
+
import '../Orders/types.js';
|
|
7
|
+
import '../../types/Balance.js';
|
|
8
|
+
import '../../types/Partner.js';
|
|
9
|
+
import '../../types/Currency.js';
|
|
10
|
+
import '../../types/CurrencyRef.js';
|
|
11
|
+
import '../../types/Network.js';
|
|
12
|
+
import '../../types/Backoffice.js';
|
|
13
|
+
import '../Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var Client=require('./Client');Object.keys(Client).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Client[k]}})});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { i as Orders } from '../index-CO0zNEaF.js';
|
|
2
|
+
export { i as Partners } from '../index-FMX04nfE.js';
|
|
3
|
+
export { i as Currencies } from '../index-Ddpq6m3Y.js';
|
|
4
|
+
export { i as Networks } from '../index-Dc3DD3A1.js';
|
|
5
|
+
export { i as Backoffice } from '../index-CghKRuMZ.js';
|
|
6
|
+
import '../ApiClient-CWwFZrLg.js';
|
|
7
|
+
import 'axios';
|
|
8
|
+
import '../types/Order.js';
|
|
9
|
+
import '../types/OrderRef.js';
|
|
10
|
+
import '../types/Pagination.js';
|
|
11
|
+
import './Orders/types.js';
|
|
12
|
+
import '../types/Balance.js';
|
|
13
|
+
import '../types/Partner.js';
|
|
14
|
+
import '../types/Currency.js';
|
|
15
|
+
import '../types/CurrencyRef.js';
|
|
16
|
+
import '../types/Network.js';
|
|
17
|
+
import '../types/Backoffice.js';
|
|
18
|
+
import './Backoffice/types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var Orders=require('./Orders'),Partners=require('./Partners'),Currencies=require('./Currencies'),Networks=require('./Networks'),Backoffice=require('./Backoffice');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Orders__namespace=/*#__PURE__*/_interopNamespace(Orders);var Partners__namespace=/*#__PURE__*/_interopNamespace(Partners);var Currencies__namespace=/*#__PURE__*/_interopNamespace(Currencies);var Networks__namespace=/*#__PURE__*/_interopNamespace(Networks);var Backoffice__namespace=/*#__PURE__*/_interopNamespace(Backoffice);exports.Orders=Orders__namespace;exports.Partners=Partners__namespace;exports.Currencies=Currencies__namespace;exports.Networks=Networks__namespace;exports.Backoffice=Backoffice__namespace;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { C as Client } from './ApiClient-CWwFZrLg.js';
|
|
2
|
+
import { GetManyWebhookDeliveries, GetManyWithdrawalOrders } from './endpoints/Backoffice/types.js';
|
|
3
|
+
|
|
4
|
+
declare const index_Client: typeof Client;
|
|
5
|
+
declare const index_GetManyWebhookDeliveries: typeof GetManyWebhookDeliveries;
|
|
6
|
+
declare const index_GetManyWithdrawalOrders: typeof GetManyWithdrawalOrders;
|
|
7
|
+
declare namespace index {
|
|
8
|
+
export { index_Client as Client, index_GetManyWebhookDeliveries as GetManyWebhookDeliveries, index_GetManyWithdrawalOrders as GetManyWithdrawalOrders };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { index as i };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { A as ApiClient, e as ClientParams, g as createClient } from './ApiClient-CWwFZrLg.js';
|
|
2
|
+
export { TechnancePaymentWebhookValidationFailure, TechnancePaymentWebhookValidationFailureResult, TechnancePaymentWebhookValidationOutcome, TechnancePaymentWebhookValidationResult, ValidateTechnancePaymentWebhookParams, validateTechnancePaymentWebhook } from './webhooks/validator.js';
|
|
3
|
+
export { i as Orders } from './index-CO0zNEaF.js';
|
|
4
|
+
export { i as Partners } from './index-FMX04nfE.js';
|
|
5
|
+
export { i as Currencies } from './index-Ddpq6m3Y.js';
|
|
6
|
+
export { i as Networks } from './index-Dc3DD3A1.js';
|
|
7
|
+
export { i as Backoffice } from './index-CghKRuMZ.js';
|
|
8
|
+
export { Balance } from './types/Balance.js';
|
|
9
|
+
export { BackofficePaymentProvider, BackofficeWebhookDelivery, BackofficeWebhookDeliveryStatus, BackofficeWebhookEvent, BackofficeWithdrawal, BackofficeWithdrawalOrder, BackofficeWithdrawalOrderDetail, BackofficeWithdrawalStatus, VaultBalance } from './types/Backoffice.js';
|
|
10
|
+
export { Currency } from './types/Currency.js';
|
|
11
|
+
export { CurrencyRef } from './types/CurrencyRef.js';
|
|
12
|
+
export { Network } from './types/Network.js';
|
|
13
|
+
export { Order } from './types/Order.js';
|
|
14
|
+
export { OrderRef } from './types/OrderRef.js';
|
|
15
|
+
export { Pagination } from './types/Pagination.js';
|
|
16
|
+
export { Partner } from './types/Partner.js';
|
|
17
|
+
export { OrderResult } from './types/OrderResult.js';
|
|
18
|
+
export { TechnancePaymentWebhookEvent, TechnancePaymentWebhookEventBase, TechnancePaymentWebhookEventByType, TechnancePaymentWebhookEventType } from './webhooks/types.js';
|
|
19
|
+
import 'axios';
|
|
20
|
+
import './endpoints/Orders/types.js';
|
|
21
|
+
import './endpoints/Backoffice/types.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var Client=require('./Client'),validator=require('./webhooks/validator'),endpoints=require('./endpoints'),types=require('./types'),types$1=require('./webhooks/types');Object.defineProperty(exports,"createClient",{enumerable:true,get:function(){return Client.createClient}});Object.defineProperty(exports,"validateTechnancePaymentWebhook",{enumerable:true,get:function(){return validator.validateTechnancePaymentWebhook}});Object.keys(endpoints).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return endpoints[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});Object.keys(types$1).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types$1[k]}})});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare const routing: {
|
|
2
|
+
partners: {
|
|
3
|
+
me: string;
|
|
4
|
+
balances: string;
|
|
5
|
+
};
|
|
6
|
+
orders: {
|
|
7
|
+
placeOrder: string;
|
|
8
|
+
getMany: string;
|
|
9
|
+
getOne: (orderId: string | number) => string;
|
|
10
|
+
};
|
|
11
|
+
currencies: {
|
|
12
|
+
getAll: string;
|
|
13
|
+
getOne: (symbol: string) => string;
|
|
14
|
+
};
|
|
15
|
+
networks: {
|
|
16
|
+
getAll: string;
|
|
17
|
+
getOne: (symbol: string) => string;
|
|
18
|
+
};
|
|
19
|
+
backoffice: {
|
|
20
|
+
withdrawals: {
|
|
21
|
+
getMany: string;
|
|
22
|
+
getOne: (id: string | number) => string;
|
|
23
|
+
};
|
|
24
|
+
vault: {
|
|
25
|
+
balances: string;
|
|
26
|
+
};
|
|
27
|
+
webhooks: {
|
|
28
|
+
getMany: string;
|
|
29
|
+
retry: (id: string) => string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { routing };
|
package/dist/routing.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';const a={partners:{me:"/api/v1/partners",balances:"/api/v1/partner/balances"},orders:{placeOrder:"/api/v1/payment/withdrawals",getMany:"/api/v1/payment/withdrawals",getOne:e=>`/api/v1/payment/withdrawals/${encodeURIComponent(String(e))}`},currencies:{getAll:"/api/v1/currencies",getOne:e=>`/api/v1/currencies/${encodeURIComponent(String(e))}`},networks:{getAll:"/api/v1/networks",getOne:e=>`/api/v1/networks/${encodeURIComponent(String(e))}`},backoffice:{withdrawals:{getMany:"/api/v1/backoffice/withdrawals",getOne:e=>`/api/v1/backoffice/withdrawals/${encodeURIComponent(String(e))}`},vault:{balances:"/api/v1/backoffice/vault/balances"},webhooks:{getMany:"/api/v1/backoffice/webhooks",retry:e=>`/api/v1/backoffice/webhooks/${encodeURIComponent(String(e))}/retry`}}};exports.routing=a;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Order } from './Order.js';
|
|
2
|
+
|
|
3
|
+
declare enum BackofficePaymentProvider {
|
|
4
|
+
SELF_HOSTED = "self-hosted",
|
|
5
|
+
STRIDGE_UDA = "stridge-uda"
|
|
6
|
+
}
|
|
7
|
+
declare enum BackofficeWithdrawalStatus {
|
|
8
|
+
CREATED = "created",
|
|
9
|
+
PROCESSING = "processing",
|
|
10
|
+
RETRY = "retry",
|
|
11
|
+
FINISHED = "finished",
|
|
12
|
+
FAILED = "failed",
|
|
13
|
+
REJECTED = "rejected"
|
|
14
|
+
}
|
|
15
|
+
declare enum BackofficeWebhookDeliveryStatus {
|
|
16
|
+
PENDING = "pending",
|
|
17
|
+
SUCCESS = "success",
|
|
18
|
+
FAILED = "failed",
|
|
19
|
+
FAILED_PERMANENT = "failed-permanent"
|
|
20
|
+
}
|
|
21
|
+
declare enum BackofficeWebhookEvent {
|
|
22
|
+
WITHDRAWAL_COMPLETED = "withdrawal.completed"
|
|
23
|
+
}
|
|
24
|
+
type BackofficeWithdrawalOrder = {
|
|
25
|
+
id: number;
|
|
26
|
+
partnerId: number;
|
|
27
|
+
partnerName: string | null;
|
|
28
|
+
status: Order.Status;
|
|
29
|
+
destinationAddress: string;
|
|
30
|
+
owner: string | null;
|
|
31
|
+
amount: string;
|
|
32
|
+
usdAmount: string;
|
|
33
|
+
currency: string;
|
|
34
|
+
network: string;
|
|
35
|
+
isBatched: boolean;
|
|
36
|
+
description: string | null;
|
|
37
|
+
transactionHash: string | null;
|
|
38
|
+
refId: string | null;
|
|
39
|
+
verifiedAt: Date | null;
|
|
40
|
+
createdAt: Date;
|
|
41
|
+
updatedAt: Date;
|
|
42
|
+
};
|
|
43
|
+
type BackofficeWithdrawal = {
|
|
44
|
+
id: number;
|
|
45
|
+
status: BackofficeWithdrawalStatus;
|
|
46
|
+
paymentProvider: BackofficePaymentProvider;
|
|
47
|
+
amount: string;
|
|
48
|
+
usdAmount: string;
|
|
49
|
+
fee: string;
|
|
50
|
+
totalAmount: string;
|
|
51
|
+
fromAddress: string | null;
|
|
52
|
+
initialToAddress: string | null;
|
|
53
|
+
initialTransactionHash: string | null;
|
|
54
|
+
finalToAddress: string | null;
|
|
55
|
+
finalTransactionHash: string | null;
|
|
56
|
+
verifiedAt: Date | null;
|
|
57
|
+
retryCount: number;
|
|
58
|
+
nextRetryAt: Date | null;
|
|
59
|
+
lastError: string | null;
|
|
60
|
+
meta: Record<string, unknown> | null;
|
|
61
|
+
createdAt: Date;
|
|
62
|
+
updatedAt: Date;
|
|
63
|
+
};
|
|
64
|
+
type BackofficeWithdrawalOrderDetail = BackofficeWithdrawalOrder & {
|
|
65
|
+
withdrawals: BackofficeWithdrawal[];
|
|
66
|
+
};
|
|
67
|
+
type BackofficeWebhookDelivery = {
|
|
68
|
+
id: string;
|
|
69
|
+
webhookId: string;
|
|
70
|
+
partnerId: number;
|
|
71
|
+
url: string;
|
|
72
|
+
event: BackofficeWebhookEvent;
|
|
73
|
+
status: BackofficeWebhookDeliveryStatus;
|
|
74
|
+
retryCount: number;
|
|
75
|
+
lastAttemptAt: Date | null;
|
|
76
|
+
nextRetryAt: Date | null;
|
|
77
|
+
completedAt: Date | null;
|
|
78
|
+
lastError: string | null;
|
|
79
|
+
payload: Record<string, unknown>;
|
|
80
|
+
createdAt: Date;
|
|
81
|
+
updatedAt: Date;
|
|
82
|
+
};
|
|
83
|
+
type VaultBalance = {
|
|
84
|
+
network: string;
|
|
85
|
+
currency: string;
|
|
86
|
+
tokenAddress: string | null;
|
|
87
|
+
bankAddress: string | null;
|
|
88
|
+
balance: string;
|
|
89
|
+
decimal: number;
|
|
90
|
+
lastUpdateBalanceAt: Date | null;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export { BackofficePaymentProvider, type BackofficeWebhookDelivery, BackofficeWebhookDeliveryStatus, BackofficeWebhookEvent, type BackofficeWithdrawal, type BackofficeWithdrawalOrder, type BackofficeWithdrawalOrderDetail, BackofficeWithdrawalStatus, type VaultBalance };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var l=(n=>(n.SELF_HOSTED="self-hosted",n.STRIDGE_UDA="stridge-uda",n))(l||{}),s=(t=>(t.CREATED="created",t.PROCESSING="processing",t.RETRY="retry",t.FINISHED="finished",t.FAILED="failed",t.REJECTED="rejected",t))(s||{}),a=(e=>(e.PENDING="pending",e.SUCCESS="success",e.FAILED="failed",e.FAILED_PERMANENT="failed-permanent",e))(a||{}),i=(r=>(r.WITHDRAWAL_COMPLETED="withdrawal.completed",r))(i||{});exports.BackofficePaymentProvider=l;exports.BackofficeWebhookDeliveryStatus=a;exports.BackofficeWebhookEvent=i;exports.BackofficeWithdrawalStatus=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type Order = {
|
|
2
|
+
id: number;
|
|
3
|
+
status: Order.Status;
|
|
4
|
+
destinationAddress: string;
|
|
5
|
+
owner: string | null;
|
|
6
|
+
amount: string;
|
|
7
|
+
usdAmount: string;
|
|
8
|
+
currency: string;
|
|
9
|
+
network: string;
|
|
10
|
+
isBatched: boolean;
|
|
11
|
+
description: string;
|
|
12
|
+
transactionHash: string | null;
|
|
13
|
+
refId: string | null;
|
|
14
|
+
verifiedAt: Date | null;
|
|
15
|
+
};
|
|
16
|
+
declare namespace Order {
|
|
17
|
+
enum Status {
|
|
18
|
+
CREATED = "created",
|
|
19
|
+
PENDING = "pending",
|
|
20
|
+
PROCESSING = "processing",
|
|
21
|
+
SENDING = "sending",
|
|
22
|
+
FINISHED = "finished",
|
|
23
|
+
FAILED = "failed",
|
|
24
|
+
REJECTED = "rejected"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Order };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';exports.Order=void 0;(e=>{(n=>(n.CREATED="created",n.PENDING="pending",n.PROCESSING="processing",n.SENDING="sending",n.FINISHED="finished",n.FAILED="failed",n.REJECTED="rejected"))(e.Status||(e.Status={}));})(exports.Order||(exports.Order={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Order } from './Order.js';
|
|
2
|
+
|
|
3
|
+
type OrderResult = {
|
|
4
|
+
id: number;
|
|
5
|
+
status: Order.Status;
|
|
6
|
+
destinationAddress: string;
|
|
7
|
+
amount: string;
|
|
8
|
+
usdAmount: string;
|
|
9
|
+
currency: string;
|
|
10
|
+
network: string;
|
|
11
|
+
txHash: string | null;
|
|
12
|
+
refId: string | null;
|
|
13
|
+
owner: string | null;
|
|
14
|
+
verifiedAt: Date | null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type { OrderResult };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Pagination<T> = {
|
|
2
|
+
items: T[];
|
|
3
|
+
meta: Pagination.Meta;
|
|
4
|
+
};
|
|
5
|
+
declare namespace Pagination {
|
|
6
|
+
type Meta = {
|
|
7
|
+
itemCount: number;
|
|
8
|
+
itemsPerPage: number;
|
|
9
|
+
currentPage: number;
|
|
10
|
+
totalItems?: number;
|
|
11
|
+
totalPages?: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { Pagination };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';exports.Partner=void 0;(e=>{(t=>(t.ACTIVE="active",t.INACTIVE="inactive"))(e.Status||(e.Status={}));})(exports.Partner||(exports.Partner={}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Balance } from './Balance.js';
|
|
2
|
+
export { BackofficePaymentProvider, BackofficeWebhookDelivery, BackofficeWebhookDeliveryStatus, BackofficeWebhookEvent, BackofficeWithdrawal, BackofficeWithdrawalOrder, BackofficeWithdrawalOrderDetail, BackofficeWithdrawalStatus, VaultBalance } from './Backoffice.js';
|
|
3
|
+
export { Currency } from './Currency.js';
|
|
4
|
+
export { CurrencyRef } from './CurrencyRef.js';
|
|
5
|
+
export { Network } from './Network.js';
|
|
6
|
+
export { Order } from './Order.js';
|
|
7
|
+
export { OrderRef } from './OrderRef.js';
|
|
8
|
+
export { Pagination } from './Pagination.js';
|
|
9
|
+
export { Partner } from './Partner.js';
|
|
10
|
+
export { OrderResult } from './OrderResult.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var Balance=require('./Balance'),Backoffice=require('./Backoffice'),Currency=require('./Currency'),CurrencyRef=require('./CurrencyRef'),Network=require('./Network'),Order=require('./Order'),OrderRef=require('./OrderRef'),Pagination=require('./Pagination'),Partner=require('./Partner'),OrderResult=require('./OrderResult');Object.keys(Balance).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Balance[k]}})});Object.keys(Backoffice).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Backoffice[k]}})});Object.keys(Currency).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Currency[k]}})});Object.keys(CurrencyRef).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return CurrencyRef[k]}})});Object.keys(Network).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Network[k]}})});Object.keys(Order).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Order[k]}})});Object.keys(OrderRef).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return OrderRef[k]}})});Object.keys(Pagination).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Pagination[k]}})});Object.keys(Partner).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Partner[k]}})});Object.keys(OrderResult).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return OrderResult[k]}})});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { TechnancePaymentWebhookEvent, TechnancePaymentWebhookEventBase, TechnancePaymentWebhookEventByType, TechnancePaymentWebhookEventType } from './types.js';
|
|
2
|
+
export { TechnancePaymentWebhookValidationFailure, TechnancePaymentWebhookValidationFailureResult, TechnancePaymentWebhookValidationOutcome, TechnancePaymentWebhookValidationResult, ValidateTechnancePaymentWebhookParams, validateTechnancePaymentWebhook } from './validator.js';
|
|
3
|
+
import '../types/OrderResult.js';
|
|
4
|
+
import '../types/Order.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var types=require('./types'),validator=require('./validator');Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});Object.keys(validator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return validator[k]}})});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OrderResult } from '../types/OrderResult.js';
|
|
2
|
+
import '../types/Order.js';
|
|
3
|
+
|
|
4
|
+
type TechnancePaymentWebhookEventType = "withdrawal.completed";
|
|
5
|
+
interface TechnancePaymentWebhookEventBase<TPayload, TType extends string> {
|
|
6
|
+
id: string;
|
|
7
|
+
version: string;
|
|
8
|
+
type: TType;
|
|
9
|
+
time: string;
|
|
10
|
+
payload: TPayload;
|
|
11
|
+
}
|
|
12
|
+
interface TechnancePaymentWebhookEventByType {
|
|
13
|
+
"withdrawal.completed": TechnancePaymentWebhookEventBase<OrderResult, "withdrawal.completed">;
|
|
14
|
+
}
|
|
15
|
+
type TechnancePaymentWebhookEvent = TechnancePaymentWebhookEventByType[TechnancePaymentWebhookEventType];
|
|
16
|
+
|
|
17
|
+
export type { TechnancePaymentWebhookEvent, TechnancePaymentWebhookEventBase, TechnancePaymentWebhookEventByType, TechnancePaymentWebhookEventType };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type TechnancePaymentWebhookValidationFailure = "missing_timestamp" | "invalid_timestamp_format" | "timestamp_outside_window" | "invalid_signature_format" | "missing_secret" | "invalid_signature";
|
|
2
|
+
interface TechnancePaymentWebhookValidationResult {
|
|
3
|
+
valid: true;
|
|
4
|
+
}
|
|
5
|
+
interface TechnancePaymentWebhookValidationFailureResult {
|
|
6
|
+
valid: false;
|
|
7
|
+
reason: TechnancePaymentWebhookValidationFailure;
|
|
8
|
+
}
|
|
9
|
+
type TechnancePaymentWebhookValidationOutcome = TechnancePaymentWebhookValidationResult | TechnancePaymentWebhookValidationFailureResult;
|
|
10
|
+
interface ValidateTechnancePaymentWebhookParams {
|
|
11
|
+
rawBody: string;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
signature: string;
|
|
14
|
+
secret: string;
|
|
15
|
+
timestampToleranceMs?: number;
|
|
16
|
+
}
|
|
17
|
+
declare function validateTechnancePaymentWebhook(params: ValidateTechnancePaymentWebhookParams): TechnancePaymentWebhookValidationOutcome;
|
|
18
|
+
|
|
19
|
+
export { type TechnancePaymentWebhookValidationFailure, type TechnancePaymentWebhookValidationFailureResult, type TechnancePaymentWebhookValidationOutcome, type TechnancePaymentWebhookValidationResult, type ValidateTechnancePaymentWebhookParams, validateTechnancePaymentWebhook };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var node_crypto=require('node:crypto');const d=3e5;function f(e,t){return node_crypto.createHmac("sha256",t).update(e).digest("hex")}function g(e){const t=`${e.timestamp}.${e.rawBody}`,a=f(t,e.secret);return !/^[0-9a-f]{64}$/u.test(a)||!/^[0-9a-f]{64}$/u.test(e.signatureHex)?false:node_crypto.timingSafeEqual(Buffer.from(a,"hex"),Buffer.from(e.signatureHex,"hex"))}function _(e){var m;const{rawBody:t,timestamp:a,signature:i,secret:r}=e,c=(m=e.timestampToleranceMs)!=null?m:d,n=typeof a=="string"?a.trim():"",s=typeof i=="string"?i.trim().toLowerCase():"";if(!n)return {valid:false,reason:"missing_timestamp"};const o=Number.parseInt(n,10);return Number.isNaN(o)?{valid:false,reason:"invalid_timestamp_format"}:Math.abs(Date.now()-o)>c?{valid:false,reason:"timestamp_outside_window"}:/^[0-9a-f]{64}$/u.test(s)?r?g({rawBody:t,timestamp:n,signatureHex:s,secret:r})?{valid:true}:{valid:false,reason:"invalid_signature"}:{valid:false,reason:"missing_secret"}:{valid:false,reason:"invalid_signature_format"}}exports.validateTechnancePaymentWebhook=_;
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Technance <dev@technance.com>",
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"axios": "^1.16.1"
|
|
5
|
+
},
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"@eslint/js": "^10.0.1",
|
|
8
|
+
"@types/node": "^24.12.4",
|
|
9
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
10
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
11
|
+
"eslint": "^10.4.0",
|
|
12
|
+
"eslint-config-prettier": "^10.1.8",
|
|
13
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
14
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
15
|
+
"globals": "^17.6.0",
|
|
16
|
+
"np": "^11.2.1",
|
|
17
|
+
"prettier": "^3.8.3",
|
|
18
|
+
"rimraf": "^6.1.3",
|
|
19
|
+
"tsup": "^8.5.1",
|
|
20
|
+
"typescript": "^6.0.3",
|
|
21
|
+
"typescript-eslint": "^8.59.4"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"default": "./dist/index.js",
|
|
26
|
+
"import": "./dist/index.js",
|
|
27
|
+
"require": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist/**",
|
|
32
|
+
"CHANGELOG.md"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "restricted",
|
|
36
|
+
"registry": "https://registry.npmjs.org/"
|
|
37
|
+
},
|
|
38
|
+
"license": "UNLICENSED",
|
|
39
|
+
"main": "./dist/index.js",
|
|
40
|
+
"module": "./dist/index.js",
|
|
41
|
+
"name": "@technance/technance-payment-sdk",
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"version": "1.0.3",
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"clean": "rimraf dist node_modules",
|
|
47
|
+
"dev": "tsup --watch",
|
|
48
|
+
"format": "prettier --no-error-on-unmatched-pattern --write ./**/*.{js,jsx,ts,tsx,json}",
|
|
49
|
+
"format:fix": "pnpm format --fix",
|
|
50
|
+
"format:check": "prettier --no-error-on-unmatched-pattern --check ./**/*.{js,jsx,ts,tsx,json}",
|
|
51
|
+
"lint": "eslint \"./src/**/*.{ts,tsx,jsx,js,mjs}\"",
|
|
52
|
+
"lint:fix": "pnpm lint --fix",
|
|
53
|
+
"release": "pnpm build && np --package-manager pnpm",
|
|
54
|
+
"release:branch": "pnpm release --any-branch",
|
|
55
|
+
"test": "echo \"Tests? Maybe next time :)\" && exit 0",
|
|
56
|
+
"typecheck": "tsc --noEmit"
|
|
57
|
+
}
|
|
58
|
+
}
|