@beamnetwork/eco-prime-trust-api
Advanced tools
Comparing version 1.0.11 to 1.0.12
import { AccountCreateAttributes } from '../AccountCreateAttributes'; | ||
export declare class OpenAccountRequest { | ||
include?: string; | ||
include?: string[]; | ||
data: { | ||
@@ -5,0 +5,0 @@ type?: string; |
@@ -1,4 +0,4 @@ | ||
import { ResponseLinks } from '../ResponseLinks'; | ||
import { ResponseMeta } from '../ResponseMeta'; | ||
import { AccountAssetTotal } from '../assets/AccountAssetTotal'; | ||
import { ResponseLinks } from '../../ResponseLinks'; | ||
import { ResponseMeta } from '../../ResponseMeta'; | ||
export declare class AssetTotalsResponse { | ||
@@ -5,0 +5,0 @@ links: ResponseLinks; |
@@ -1,3 +0,3 @@ | ||
import { ResponseLinks } from '../ResponseLinks'; | ||
import { ResponseMeta } from '../ResponseMeta'; | ||
import { ResponseLinks } from '../../ResponseLinks'; | ||
import { ResponseMeta } from '../../ResponseMeta'; | ||
import { AccountCashTotal } from '../cash/AccountCashTotal'; | ||
@@ -4,0 +4,0 @@ export declare class CashTotalsResponse { |
@@ -1,3 +0,3 @@ | ||
import { ResponseLinks } from '../../accounts/ResponseLinks'; | ||
import { ResponseMeta } from '../../accounts/ResponseMeta'; | ||
import { ResponseLinks } from '../../ResponseLinks'; | ||
import { ResponseMeta } from '../../ResponseMeta'; | ||
import { AMLCheck } from '../AMLCheck'; | ||
@@ -4,0 +4,0 @@ export declare class GetAMLCheckResponse { |
@@ -1,3 +0,3 @@ | ||
import { ResponseLinks } from '../../accounts/ResponseLinks'; | ||
import { ResponseMeta } from '../../accounts/ResponseMeta'; | ||
import { ResponseLinks } from '../../ResponseLinks'; | ||
import { ResponseMeta } from '../../ResponseMeta'; | ||
import { CIPCheck } from '../CIPCheck'; | ||
@@ -4,0 +4,0 @@ export declare class GetCIPCheckResponse { |
@@ -1,3 +0,3 @@ | ||
import { ResponseLinks } from '../../accounts/ResponseLinks'; | ||
import { ResponseMeta } from '../../accounts/ResponseMeta'; | ||
import { ResponseLinks } from '../../ResponseLinks'; | ||
import { ResponseMeta } from '../../ResponseMeta'; | ||
import { KYCDocumentCheck } from '../KYCDocumentCheck'; | ||
@@ -4,0 +4,0 @@ export declare class GetKYCDocumentCheckResponse { |
@@ -36,2 +36,25 @@ /// <reference types="node" /> | ||
import { ContactResponse } from './contacts/responses/ContactResponse'; | ||
import { CreateProcessorTokenFundsTransferMethodRequest } from './funds-transfers/requests/CreateProcessorTokenFundsTransferMethodRequest'; | ||
import { FundsTransferMethodResponse } from './funds-transfers/responses/FundsTransferMethodResponse'; | ||
import { DepositFundsUsingFundsTransferMethodRequest } from './funds-transfers/requests/DepositFundsUsingFundsTransferMethodRequest'; | ||
import { ContributionsResponse } from './funds-transfers/responses/ContributionsResponse'; | ||
import { SettleFundsTransferRequest } from './funds-transfers/sandbox-only/SettleFundsTransferRequest'; | ||
import { FundsTransferResponse } from './funds-transfers/responses/FundsTransferResponse'; | ||
import { ClearFundsTransferRequest } from './funds-transfers/sandbox-only/ClearFundsTransferRequest'; | ||
import { ReverseFundsTransferRequest } from './funds-transfers/sandbox-only/ReverseFundsTransferRequest'; | ||
import { Query } from './Query'; | ||
import { GetContingentHoldRequest } from './contingent-holds/requests/GetContingentHoldRequest'; | ||
import { ContingentHold } from './contingent-holds/ContingentHold'; | ||
import { ClearContingentHoldRequest } from './contingent-holds/sandbox-only/ClearContingentHoldRequest'; | ||
import { WithdrawFundsUsingFundsTransferMethodRequest } from './funds-transfers/requests/WithdrawFundsUsingFundsTransferMethodRequest'; | ||
import { DisbursementsResponse } from './funds-transfers/responses/DisbursementsResponse'; | ||
import { QueryResponse } from './QueryResponse'; | ||
import { FundsTransfer } from './funds-transfers/FundsTransfer'; | ||
import { FetchResourceByIDRequest } from './FetchResourceByIDRequest'; | ||
import { TransferCashRequest } from './account-cash-transfers/requests/TransferCashRequest'; | ||
import { TransferCashResponse } from './account-cash-transfers/responses/TransferCashResponse'; | ||
import { WebhookConfig } from './webhooks/WebhookConfig'; | ||
import { UpdateWebhookRequest } from './webhooks/requests/UpdateWebHookRequest'; | ||
import { UpdateResponse } from './UpdateResponse'; | ||
import { AccountCashTransfer } from './account-cash-transfers/AccountCashTransfer'; | ||
import { UpdateContactRequest } from './contacts/requests/UpdateContactRequest'; | ||
@@ -59,2 +82,5 @@ export declare class PrimeTrustAPI extends BaseAPI { | ||
sandboxApproveCIPCheck(approveCIPCheckRequest: ApproveCIPCheckRequest): Promise<APIResponse<CIPCheckResponse>>; | ||
sandboxClearFundsTransfer(request: ClearFundsTransferRequest): Promise<APIResponse<FundsTransferResponse>>; | ||
sandboxSettleFundsTransfer(request: SettleFundsTransferRequest): Promise<APIResponse<FundsTransferResponse>>; | ||
sandboxReverseFundsTransfer(request: ReverseFundsTransferRequest): Promise<APIResponse<FundsTransferResponse>>; | ||
getAccountAssetTotals(assetTotalsRequest: AssetTotalsRequest): Promise<APIResponse<AssetTotalsResponse>>; | ||
@@ -64,2 +90,17 @@ getAccountAssetTotalsByAccountID(accountID: string): Promise<APIResponse<AssetTotalsResponse>>; | ||
getAccountCashTotalsByAccountID(accountID: string): Promise<APIResponse<CashTotalsResponse>>; | ||
getContingentHoldsByResourceID(params: object): Promise<APIResponse<QueryResponse<ContingentHold[]>>>; | ||
getContingentHoldByID(request: GetContingentHoldRequest): Promise<APIResponse<QueryResponse<ContingentHold>>>; | ||
sandboxClearContingentHold(request: ClearContingentHoldRequest): Promise<APIResponse<QueryResponse<ContingentHold>>>; | ||
createFundsTransferMethod(request: CreateProcessorTokenFundsTransferMethodRequest): Promise<APIResponse<FundsTransferMethodResponse>>; | ||
depositFundsUsingFundsTransferMethod(request: DepositFundsUsingFundsTransferMethodRequest): Promise<APIResponse<ContributionsResponse>>; | ||
withdrawFundsUsingFundsTransferMethod(request: WithdrawFundsUsingFundsTransferMethodRequest): Promise<APIResponse<DisbursementsResponse>>; | ||
cancelFundsTransfer(request: FetchResourceByIDRequest): Promise<APIResponse<FundsTransferResponse>>; | ||
getFundsTransferByID(request: FetchResourceByIDRequest): Promise<APIResponse<QueryResponse<FundsTransfer>>>; | ||
getFundsTransfersForAccount(accountID: string): Promise<APIResponse<QueryResponse<FundsTransfer[]>>>; | ||
getFundsTransfers(query: Query): Promise<APIResponse<QueryResponse<FundsTransfer[]>>>; | ||
transferCash(request: TransferCashRequest): Promise<APIResponse<TransferCashResponse>>; | ||
getCashTransferByID(request: FetchResourceByIDRequest): Promise<APIResponse<QueryResponse<AccountCashTransfer>>>; | ||
getWebhookConfigByID(request: FetchResourceByIDRequest): Promise<APIResponse<QueryResponse<WebhookConfig>>>; | ||
getWebHooksForAccount(accountID: string): Promise<APIResponse<QueryResponse<WebhookConfig[]>>>; | ||
updateWebhookConfig(request: UpdateWebhookRequest): Promise<APIResponse<UpdateResponse<WebhookConfig>>>; | ||
} |
@@ -69,3 +69,3 @@ "use strict"; | ||
delete getAgreementPreviewsRequest.include; | ||
getAgreementPreviewsRequest.data.type = ResourceTypes_1.AgreementPreviews; | ||
getAgreementPreviewsRequest.data.type = ResourceTypes_1.AgreementPreviewsType; | ||
reqUri = '/v2/agreement-previews'; | ||
@@ -90,3 +90,3 @@ if (include) { | ||
delete openAccountRequest.include; | ||
openAccountRequest.data.type = ResourceTypes_1.Accounts; | ||
openAccountRequest.data.type = ResourceTypes_1.AccountsType; | ||
reqUri = '/v2/accounts'; | ||
@@ -132,3 +132,3 @@ if (include) { | ||
delete updateContactRequest.include; | ||
updateContactRequest.data.type = ResourceTypes_1.Contacts; | ||
updateContactRequest.data.type = ResourceTypes_1.ContactsType; | ||
reqUri = "/v2/contacts/" + id; | ||
@@ -196,3 +196,3 @@ if (include) { | ||
delete kycDocumentCheckRequest.include; | ||
kycDocumentCheckRequest.data.type = ResourceTypes_1.KYCDocumentChecks; | ||
kycDocumentCheckRequest.data.type = ResourceTypes_1.KYCDocumentChecksType; | ||
reqUri = '/v2/kyc-document-checks'; | ||
@@ -235,3 +235,3 @@ if (include) { | ||
include = failKYCDocumentCheckRequest.include, kycDocumentCheckID = failKYCDocumentCheckRequest.kycDocumentCheckID, data = failKYCDocumentCheckRequest.data; | ||
failKYCDocumentCheckRequest.data.type = ResourceTypes_1.KYCDocumentChecks; | ||
failKYCDocumentCheckRequest.data.type = ResourceTypes_1.KYCDocumentChecksType; | ||
reqUri = "/v2/kyc-document-checks/" + kycDocumentCheckID + "/sandbox/fail"; | ||
@@ -435,2 +435,68 @@ if (include) { | ||
}; | ||
PrimeTrustAPI.prototype.sandboxClearFundsTransfer = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, fundsTransferID, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, fundsTransferID = request.fundsTransferID; | ||
delete request.include; | ||
delete request.fundsTransferID; | ||
reqUri = "/v2/funds-transfers/" + fundsTransferID + "/sandbox/clear"; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().post(reqUri); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.sandboxSettleFundsTransfer = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, fundsTransferID, data, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, fundsTransferID = request.fundsTransferID, data = request.data; | ||
delete request.include; | ||
delete request.fundsTransferID; | ||
request.data.type = ResourceTypes_1.FundsTransfersType; | ||
reqUri = "/v2/funds-transfers/" + fundsTransferID + "/sandbox/settle"; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().post(reqUri, { | ||
data: data | ||
}); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.sandboxReverseFundsTransfer = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, fundsTransferID, data, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, fundsTransferID = request.fundsTransferID, data = request.data; | ||
delete request.include; | ||
delete request.fundsTransferID; | ||
request.data.type = ResourceTypes_1.FundsTransfersType; | ||
reqUri = "/v2/funds-transfers/" + fundsTransferID + "/sandbox/reverse"; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().post(reqUri, { | ||
data: data | ||
}); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.getAccountAssetTotals = function (assetTotalsRequest) { | ||
@@ -500,2 +566,290 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
PrimeTrustAPI.prototype.getContingentHoldsByResourceID = function (params) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
req = this.getAxiosInstance().get("/v2/contingent-holds", { | ||
params: params, | ||
}); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.getContingentHoldByID = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, id, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, id = request.id; | ||
delete request.include; | ||
reqUri = "/v2/contingent-holds/" + id; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().get(reqUri); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.sandboxClearContingentHold = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, contingentHoldID, data, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, contingentHoldID = request.contingentHoldID, data = request.data; | ||
delete request.include; | ||
delete request.contingentHoldID; | ||
request.data.type = ResourceTypes_1.ContingentHoldsType; | ||
reqUri = "/v2/contingent-holds/" + contingentHoldID + "/sandbox/clear"; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().post(reqUri, { | ||
data: data | ||
}); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.createFundsTransferMethod = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include; | ||
delete request.include; | ||
request.data.type = ResourceTypes_1.FundsTransferMethodsType; | ||
reqUri = '/v2/funds-transfer-methods'; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().post(reqUri, request); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.depositFundsUsingFundsTransferMethod = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include; | ||
delete request.include; | ||
request.data.type = ResourceTypes_1.ContributionsType; | ||
reqUri = '/v2/contributions'; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().post(reqUri, request); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.withdrawFundsUsingFundsTransferMethod = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include; | ||
delete request.include; | ||
request.data.type = ResourceTypes_1.DisbursementsType; | ||
reqUri = '/v2/disbursements'; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().post(reqUri, request); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.cancelFundsTransfer = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, id, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, id = request.id; | ||
delete request.include; | ||
delete request.id; | ||
reqUri = "/v2/funds-transfers/" + id + "/cancel"; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().post(reqUri); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.getFundsTransferByID = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, id, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, id = request.id; | ||
delete request.include; | ||
reqUri = "/v2/funds-transfers/" + id; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().get(reqUri); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.getFundsTransfersForAccount = function (accountID) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
req = this.getAxiosInstance().get("/v2/funds-transfers", { | ||
params: { | ||
'account.id': accountID, | ||
}, | ||
}); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.getFundsTransfers = function (query) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
req = this.getAxiosInstance().get("/v2/funds-transfers", { | ||
params: { | ||
'funds-transfers.id': 'cdc84352-36a0-4e64-b1f8-21ddbae73b23', | ||
}, | ||
}); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.transferCash = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include; | ||
delete request.include; | ||
request.data.type = ResourceTypes_1.ContributionsType; | ||
reqUri = '/v2/account-cash-transfers'; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().post(reqUri, request); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.getCashTransferByID = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, id, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, id = request.id; | ||
delete request.include; | ||
reqUri = "/v2/account-cash-transfers/" + id; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().get(reqUri); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.getWebhookConfigByID = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, id, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, id = request.id; | ||
delete request.include; | ||
reqUri = "/v2/webhook-configs/" + id; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().get(reqUri); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.getWebHooksForAccount = function (accountID) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
req = this.getAxiosInstance().get("/v2/webhook-configs", { | ||
params: { | ||
'account.id': accountID, | ||
}, | ||
}); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.updateWebhookConfig = function (request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, webhookID, data, reqUri, req; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
include = request.include, webhookID = request.webhookID, data = request.data; | ||
delete request.include; | ||
delete request.webhookID; | ||
request.data.type = ResourceTypes_1.WebhookConfigsType; | ||
reqUri = "/v2/webhook-configs/" + webhookID; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
req = this.getAxiosInstance().patch(reqUri, { | ||
data: data | ||
}); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return PrimeTrustAPI; | ||
@@ -502,0 +856,0 @@ }(BaseAPI_1.BaseAPI)); |
@@ -126,2 +126,4 @@ "use strict"; | ||
this.accessToken = token; | ||
console.log(token); | ||
console.log(jwt.decode(token, { complete: true })); | ||
exp = jwt.decode(token).exp; | ||
@@ -128,0 +130,0 @@ this.expiresAt = moment.unix(exp); |
@@ -1,10 +0,19 @@ | ||
export declare const Accounts = "accounts"; | ||
export declare const AccountAssetTotals = "account-asset-totals"; | ||
export declare const AccountCashTotals = "account-cash-totals"; | ||
export declare const AgreementPreviews = "agreement-previews"; | ||
export declare const Contacts = "contacts"; | ||
export declare const Contact = "contact"; | ||
export declare const AMLChecks = "aml-checks"; | ||
export declare const CIPChecks = "cip-checks"; | ||
export declare const KYCDocumentChecks = "kyc-document-checks"; | ||
export declare const UploadedDocuments = "uploaded-documents"; | ||
export declare const AccountsType = "accounts"; | ||
export declare const AccountAssetTotalsType = "account-asset-totals"; | ||
export declare const AccountCashTotalsType = "account-cash-totals"; | ||
export declare const AgreementPreviewsType = "agreement-previews"; | ||
export declare const ContactsType = "contacts"; | ||
export declare const ContactType = "contact"; | ||
export declare const ContributionsType = "contributions"; | ||
export declare const DisbursementsType = "disbursements"; | ||
export declare const FundsTransferMethodsType = "funds-transfer-methods"; | ||
export declare const FundsTransfersType = "funds-transfers"; | ||
export declare const FundsTransferType = "funds-transfer"; | ||
export declare const ContingentHoldsType = "contingent-holds"; | ||
export declare const AccountCashTransfersType = "account-cash-transfers"; | ||
export declare const WebhookConfigType = "webhook-config"; | ||
export declare const WebhookConfigsType = "webhook-configs"; | ||
export declare const AMLChecksType = "aml-checks"; | ||
export declare const CIPChecksType = "cip-checks"; | ||
export declare const KYCDocumentChecksType = "kyc-document-checks"; | ||
export declare const UploadedDocumentsType = "uploaded-documents"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UploadedDocuments = exports.KYCDocumentChecks = exports.CIPChecks = exports.AMLChecks = exports.Contact = exports.Contacts = exports.AgreementPreviews = exports.AccountCashTotals = exports.AccountAssetTotals = exports.Accounts = void 0; | ||
exports.Accounts = 'accounts'; | ||
exports.AccountAssetTotals = 'account-asset-totals'; | ||
exports.AccountCashTotals = 'account-cash-totals'; | ||
exports.AgreementPreviews = 'agreement-previews'; | ||
exports.Contacts = 'contacts'; | ||
exports.Contact = 'contact'; | ||
exports.AMLChecks = 'aml-checks'; | ||
exports.CIPChecks = 'cip-checks'; | ||
exports.KYCDocumentChecks = 'kyc-document-checks'; | ||
exports.UploadedDocuments = 'uploaded-documents'; | ||
exports.UploadedDocumentsType = exports.KYCDocumentChecksType = exports.CIPChecksType = exports.AMLChecksType = exports.WebhookConfigsType = exports.WebhookConfigType = exports.AccountCashTransfersType = exports.ContingentHoldsType = exports.FundsTransferType = exports.FundsTransfersType = exports.FundsTransferMethodsType = exports.DisbursementsType = exports.ContributionsType = exports.ContactType = exports.ContactsType = exports.AgreementPreviewsType = exports.AccountCashTotalsType = exports.AccountAssetTotalsType = exports.AccountsType = void 0; | ||
exports.AccountsType = 'accounts'; | ||
exports.AccountAssetTotalsType = 'account-asset-totals'; | ||
exports.AccountCashTotalsType = 'account-cash-totals'; | ||
exports.AgreementPreviewsType = 'agreement-previews'; | ||
exports.ContactsType = 'contacts'; | ||
exports.ContactType = 'contact'; | ||
exports.ContributionsType = 'contributions'; | ||
exports.DisbursementsType = 'disbursements'; | ||
exports.FundsTransferMethodsType = 'funds-transfer-methods'; | ||
exports.FundsTransfersType = 'funds-transfers'; | ||
exports.FundsTransferType = 'funds-transfer'; | ||
exports.ContingentHoldsType = 'contingent-holds'; | ||
exports.AccountCashTransfersType = 'account-cash-transfers'; | ||
exports.WebhookConfigType = 'webhook-config'; | ||
exports.WebhookConfigsType = 'webhook-configs'; | ||
exports.AMLChecksType = 'aml-checks'; | ||
exports.CIPChecksType = 'cip-checks'; | ||
exports.KYCDocumentChecksType = 'kyc-document-checks'; | ||
exports.UploadedDocumentsType = 'uploaded-documents'; | ||
//# sourceMappingURL=ResourceTypes.js.map |
{ | ||
"name": "@beamnetwork/eco-prime-trust-api", | ||
"private": false, | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Eco Prime Trust API TypeScript Implementation", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
import { AccountCreateAttributes } from '../AccountCreateAttributes' | ||
export class OpenAccountRequest { | ||
include?: string | ||
include?: string[] | ||
@@ -6,0 +6,0 @@ data: { |
@@ -1,4 +0,4 @@ | ||
import { ResponseLinks } from '../ResponseLinks' | ||
import { ResponseMeta } from '../ResponseMeta' | ||
import { AccountAssetTotal } from '../assets/AccountAssetTotal' | ||
import { ResponseLinks } from '../../ResponseLinks' | ||
import { ResponseMeta } from '../../ResponseMeta' | ||
@@ -5,0 +5,0 @@ export class AssetTotalsResponse { |
@@ -1,3 +0,3 @@ | ||
import { ResponseLinks } from '../ResponseLinks' | ||
import { ResponseMeta } from '../ResponseMeta' | ||
import { ResponseLinks } from '../../ResponseLinks' | ||
import { ResponseMeta } from '../../ResponseMeta' | ||
import { AccountCashTotal } from '../cash/AccountCashTotal' | ||
@@ -4,0 +4,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { ResponseLinks } from '../../accounts/ResponseLinks' | ||
import { ResponseMeta } from '../../accounts/ResponseMeta' | ||
import { ResponseLinks } from '../../ResponseLinks' | ||
import { ResponseMeta } from '../../ResponseMeta' | ||
import { AMLCheck } from '../AMLCheck' | ||
@@ -4,0 +4,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { ResponseLinks } from '../../accounts/ResponseLinks' | ||
import { ResponseMeta } from '../../accounts/ResponseMeta' | ||
import { ResponseLinks } from '../../ResponseLinks' | ||
import { ResponseMeta } from '../../ResponseMeta' | ||
import { CIPCheck } from '../CIPCheck' | ||
@@ -4,0 +4,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { ResponseLinks } from '../../accounts/ResponseLinks' | ||
import { ResponseMeta } from '../../accounts/ResponseMeta' | ||
import { ResponseLinks } from '../../ResponseLinks' | ||
import { ResponseMeta } from '../../ResponseMeta' | ||
import { KYCDocumentCheck } from '../KYCDocumentCheck' | ||
@@ -4,0 +4,0 @@ |
@@ -18,3 +18,17 @@ import { APIOptions } from './APIOptions' | ||
import { VerifyKYCDocumentCheckRequest } from './kyc/sandbox-only/VerifyKYCDocumentCheckRequest' | ||
import { KYCDocumentChecks, Accounts, AgreementPreviews, Contacts } from './ResourceTypes'; | ||
import { | ||
KYCDocumentChecksType, | ||
AccountsType, | ||
AgreementPreviewsType, | ||
FundsTransferMethodsType, | ||
ContributionsType, | ||
FundsTransfersType, | ||
ContingentHoldsType, | ||
DisbursementsType, | ||
WebhookConfigsType, | ||
ContactsType, | ||
WebhookConfigType, | ||
} from './ResourceTypes' | ||
import { GetAccountRequest } from './accounts/requests/GetAccountRequest' | ||
@@ -38,2 +52,25 @@ import { GetKYCDocumentCheckResponse } from './kyc/responses/GetKYCDocumentCheckResponse' | ||
import { ContactResponse } from './contacts/responses/ContactResponse' | ||
import { CreateProcessorTokenFundsTransferMethodRequest } from './funds-transfers/requests/CreateProcessorTokenFundsTransferMethodRequest' | ||
import { FundsTransferMethodResponse } from './funds-transfers/responses/FundsTransferMethodResponse' | ||
import { DepositFundsUsingFundsTransferMethodRequest } from './funds-transfers/requests/DepositFundsUsingFundsTransferMethodRequest' | ||
import { ContributionsResponse } from './funds-transfers/responses/ContributionsResponse' | ||
import { SettleFundsTransferRequest } from './funds-transfers/sandbox-only/SettleFundsTransferRequest' | ||
import { FundsTransferResponse } from './funds-transfers/responses/FundsTransferResponse' | ||
import { ClearFundsTransferRequest } from './funds-transfers/sandbox-only/ClearFundsTransferRequest' | ||
import { ReverseFundsTransferRequest } from './funds-transfers/sandbox-only/ReverseFundsTransferRequest' | ||
import { Query } from './Query' | ||
import { GetContingentHoldRequest } from './contingent-holds/requests/GetContingentHoldRequest' | ||
import { ContingentHold } from './contingent-holds/ContingentHold' | ||
import { ClearContingentHoldRequest } from './contingent-holds/sandbox-only/ClearContingentHoldRequest' | ||
import { WithdrawFundsUsingFundsTransferMethodRequest } from './funds-transfers/requests/WithdrawFundsUsingFundsTransferMethodRequest' | ||
import { DisbursementsResponse } from './funds-transfers/responses/DisbursementsResponse' | ||
import { QueryResponse } from './QueryResponse' | ||
import { FundsTransfer } from './funds-transfers/FundsTransfer' | ||
import { FetchResourceByIDRequest } from './FetchResourceByIDRequest' | ||
import { TransferCashRequest } from './account-cash-transfers/requests/TransferCashRequest' | ||
import { TransferCashResponse } from './account-cash-transfers/responses/TransferCashResponse' | ||
import { WebhookConfig } from './webhooks/WebhookConfig' | ||
import { UpdateWebhookRequest } from './webhooks/requests/UpdateWebHookRequest' | ||
import { UpdateResponse } from './UpdateResponse' | ||
import { AccountCashTransfer } from './account-cash-transfers/AccountCashTransfer' | ||
import { UpdateContactRequest } from './contacts/requests/UpdateContactRequest' | ||
@@ -51,3 +88,3 @@ | ||
getAgreementPreviewsRequest.data.type = AgreementPreviews | ||
getAgreementPreviewsRequest.data.type = AgreementPreviewsType | ||
@@ -69,5 +106,6 @@ let reqUri = '/v2/agreement-previews' | ||
const { include } = openAccountRequest | ||
delete openAccountRequest.include | ||
openAccountRequest.data.type = Accounts | ||
openAccountRequest.data.type = AccountsType | ||
@@ -109,3 +147,3 @@ let reqUri = '/v2/accounts' | ||
updateContactRequest.data.type = Contacts | ||
updateContactRequest.data.type = ContactsType | ||
@@ -173,3 +211,3 @@ let reqUri = `/v2/contacts/${id}` | ||
kycDocumentCheckRequest.data.type = KYCDocumentChecks | ||
kycDocumentCheckRequest.data.type = KYCDocumentChecksType | ||
@@ -208,3 +246,3 @@ let reqUri = '/v2/kyc-document-checks' | ||
failKYCDocumentCheckRequest.data.type = KYCDocumentChecks | ||
failKYCDocumentCheckRequest.data.type = KYCDocumentChecksType | ||
@@ -382,2 +420,65 @@ let reqUri = `/v2/kyc-document-checks/${kycDocumentCheckID}/sandbox/fail` | ||
async sandboxClearFundsTransfer(request: ClearFundsTransferRequest): Promise<APIResponse<FundsTransferResponse>> { | ||
const { include, fundsTransferID } = request | ||
delete request.include | ||
delete request.fundsTransferID | ||
let reqUri = `/v2/funds-transfers/${fundsTransferID}/sandbox/clear` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().post( | ||
reqUri, | ||
) | ||
return await this.executeRequest<FundsTransferResponse>(req) | ||
} | ||
async sandboxSettleFundsTransfer(request: SettleFundsTransferRequest): Promise<APIResponse<FundsTransferResponse>> { | ||
const { include, fundsTransferID, data } = request | ||
delete request.include | ||
delete request.fundsTransferID | ||
request.data.type = FundsTransfersType | ||
let reqUri = `/v2/funds-transfers/${fundsTransferID}/sandbox/settle` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
// tslint:disable: no-console | ||
// console.log('reqUri:', reqUri) | ||
// console.log('data:', data) | ||
const req = this.getAxiosInstance().post( | ||
reqUri, { | ||
data | ||
}, | ||
) | ||
return await this.executeRequest<FundsTransferResponse>(req) | ||
} | ||
async sandboxReverseFundsTransfer(request: ReverseFundsTransferRequest): Promise<APIResponse<FundsTransferResponse>> { | ||
const { include, fundsTransferID, data } = request | ||
delete request.include | ||
delete request.fundsTransferID | ||
request.data.type = FundsTransfersType | ||
let reqUri = `/v2/funds-transfers/${fundsTransferID}/sandbox/reverse` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().post( | ||
reqUri, { | ||
data | ||
}, | ||
) | ||
return await this.executeRequest<FundsTransferResponse>(req) | ||
} | ||
async getAccountAssetTotals(assetTotalsRequest: AssetTotalsRequest): Promise<APIResponse<AssetTotalsResponse>> { | ||
@@ -426,2 +527,274 @@ const req = this.getAxiosInstance().get( | ||
} | ||
async getContingentHoldsByResourceID( | ||
params: object, | ||
): Promise<APIResponse<QueryResponse<ContingentHold[]>>> { | ||
const req = this.getAxiosInstance().get( | ||
`/v2/contingent-holds`, { | ||
params, | ||
}, | ||
) | ||
return await this.executeRequest<QueryResponse<ContingentHold[]>>(req) | ||
} | ||
async getContingentHoldByID(request: GetContingentHoldRequest): Promise<APIResponse<QueryResponse<ContingentHold>>> { | ||
const { include, id } = request | ||
delete request.include | ||
let reqUri = `/v2/contingent-holds/${id}` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().get( | ||
reqUri, | ||
) | ||
return await this.executeRequest<QueryResponse<ContingentHold>>(req) | ||
} | ||
async sandboxClearContingentHold(request: ClearContingentHoldRequest): Promise<APIResponse<QueryResponse<ContingentHold>>> { | ||
const { include, contingentHoldID, data } = request | ||
delete request.include | ||
delete request.contingentHoldID | ||
request.data.type = ContingentHoldsType | ||
let reqUri = `/v2/contingent-holds/${contingentHoldID}/sandbox/clear` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().post( | ||
reqUri, { | ||
data | ||
}, | ||
) | ||
return await this.executeRequest<QueryResponse<ContingentHold>>(req) | ||
} | ||
async createFundsTransferMethod( | ||
request: CreateProcessorTokenFundsTransferMethodRequest, | ||
): Promise<APIResponse<FundsTransferMethodResponse>> { | ||
const { include } = request | ||
delete request.include | ||
request.data.type = FundsTransferMethodsType | ||
let reqUri = '/v2/funds-transfer-methods' | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().post( | ||
reqUri, | ||
request, | ||
) | ||
return await this.executeRequest<FundsTransferMethodResponse>(req) | ||
} | ||
async depositFundsUsingFundsTransferMethod( | ||
request: DepositFundsUsingFundsTransferMethodRequest, | ||
): Promise<APIResponse<ContributionsResponse>> { | ||
const { include } = request | ||
delete request.include | ||
request.data.type = ContributionsType | ||
let reqUri = '/v2/contributions' | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().post( | ||
reqUri, | ||
request, | ||
) | ||
return await this.executeRequest<ContributionsResponse>(req) | ||
} | ||
async withdrawFundsUsingFundsTransferMethod( | ||
request: WithdrawFundsUsingFundsTransferMethodRequest, | ||
): Promise<APIResponse<DisbursementsResponse>> { | ||
const { include } = request | ||
delete request.include | ||
request.data.type = DisbursementsType | ||
let reqUri = '/v2/disbursements' | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().post( | ||
reqUri, | ||
request, | ||
) | ||
return await this.executeRequest<DisbursementsResponse>(req) | ||
} | ||
async cancelFundsTransfer(request: FetchResourceByIDRequest): Promise<APIResponse<FundsTransferResponse>> { | ||
const { include, id } = request | ||
delete request.include | ||
delete request.id | ||
let reqUri = `/v2/funds-transfers/${id}/cancel` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().post( | ||
reqUri, | ||
) | ||
return await this.executeRequest<FundsTransferResponse>(req) | ||
} | ||
async getFundsTransferByID( | ||
request: FetchResourceByIDRequest, | ||
): Promise<APIResponse<QueryResponse<FundsTransfer>>> { | ||
const { include, id } = request | ||
delete request.include | ||
let reqUri = `/v2/funds-transfers/${id}` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().get( | ||
reqUri, | ||
) | ||
return await this.executeRequest<QueryResponse<FundsTransfer>>(req) | ||
} | ||
async getFundsTransfersForAccount( | ||
accountID: string, | ||
): Promise<APIResponse<QueryResponse<FundsTransfer[]>>> { | ||
const req = this.getAxiosInstance().get( | ||
`/v2/funds-transfers`, { | ||
params: { | ||
'account.id': accountID, | ||
}, | ||
}, | ||
) | ||
return await this.executeRequest<QueryResponse<FundsTransfer[]>>(req) | ||
} | ||
async getFundsTransfers( | ||
query: Query, | ||
): Promise<APIResponse<QueryResponse<FundsTransfer[]>>> { | ||
const req = this.getAxiosInstance().get( | ||
`/v2/funds-transfers`, { | ||
params: { | ||
// 'filter[id eq]': 'cdc84352-36a0-4e64-b1f8-21ddbae73b23', | ||
'funds-transfers.id': 'cdc84352-36a0-4e64-b1f8-21ddbae73b23', | ||
}, | ||
}, | ||
) | ||
// GET v2/funds-transfers?filter[id eq]={{funds-transfer-id}}&include=contingent-holds | ||
return await this.executeRequest<QueryResponse<FundsTransfer[]>>(req) | ||
} | ||
async transferCash( | ||
request: TransferCashRequest, | ||
): Promise<APIResponse<TransferCashResponse>> { | ||
const { include } = request | ||
delete request.include | ||
request.data.type = ContributionsType | ||
let reqUri = '/v2/account-cash-transfers' | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().post( | ||
reqUri, | ||
request, | ||
) | ||
return await this.executeRequest<TransferCashResponse>(req) | ||
} | ||
async getCashTransferByID( | ||
request: FetchResourceByIDRequest, | ||
): Promise<APIResponse<QueryResponse<AccountCashTransfer>>> { | ||
const { include, id } = request | ||
delete request.include | ||
let reqUri = `/v2/account-cash-transfers/${id}` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().get( | ||
reqUri, | ||
) | ||
return await this.executeRequest<QueryResponse<AccountCashTransfer>>(req) | ||
} | ||
async getWebhookConfigByID( | ||
request: FetchResourceByIDRequest, | ||
): Promise<APIResponse<QueryResponse<WebhookConfig>>> { | ||
const { include, id } = request | ||
delete request.include | ||
let reqUri = `/v2/webhook-configs/${id}` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().get( | ||
reqUri, | ||
) | ||
return await this.executeRequest<QueryResponse<WebhookConfig>>(req) | ||
} | ||
async getWebHooksForAccount( | ||
accountID: string, | ||
): Promise<APIResponse<QueryResponse<WebhookConfig[]>>> { | ||
const req = this.getAxiosInstance().get( | ||
`/v2/webhook-configs`, { | ||
params: { | ||
'account.id': accountID, | ||
}, | ||
}, | ||
) | ||
return await this.executeRequest<QueryResponse<WebhookConfig[]>>(req) | ||
} | ||
async updateWebhookConfig( | ||
request: UpdateWebhookRequest, | ||
): Promise<APIResponse<UpdateResponse<WebhookConfig>>> { | ||
const { include, webhookID, data } = request | ||
delete request.include | ||
delete request.webhookID | ||
request.data.type = WebhookConfigsType | ||
let reqUri = `/v2/webhook-configs/${webhookID}` | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const req = this.getAxiosInstance().patch( | ||
reqUri, { | ||
data | ||
}, | ||
) | ||
return await this.executeRequest<UpdateResponse<WebhookConfig>>(req) | ||
} | ||
} |
@@ -71,2 +71,4 @@ import axios, { AxiosInstance } from 'axios' | ||
this.accessToken = token | ||
console.log(token) | ||
console.log(jwt.decode(token, { complete: true })) | ||
const { exp } = jwt.decode(token) | ||
@@ -73,0 +75,0 @@ this.expiresAt = moment.unix(exp) |
@@ -1,12 +0,22 @@ | ||
export const Accounts = 'accounts' | ||
export const AccountAssetTotals = 'account-asset-totals' | ||
export const AccountCashTotals = 'account-cash-totals' | ||
export const AgreementPreviews = 'agreement-previews' | ||
export const Contacts = 'contacts' | ||
export const Contact = 'contact' | ||
export const AccountsType = 'accounts' | ||
export const AccountAssetTotalsType = 'account-asset-totals' | ||
export const AccountCashTotalsType = 'account-cash-totals' | ||
export const AgreementPreviewsType = 'agreement-previews' | ||
export const ContactsType = 'contacts' | ||
export const ContactType = 'contact' | ||
export const AMLChecks = 'aml-checks' | ||
export const CIPChecks = 'cip-checks' | ||
export const KYCDocumentChecks = 'kyc-document-checks' | ||
export const ContributionsType = 'contributions' | ||
export const DisbursementsType = 'disbursements' | ||
export const FundsTransferMethodsType = 'funds-transfer-methods' | ||
export const FundsTransfersType = 'funds-transfers' | ||
export const FundsTransferType = 'funds-transfer' | ||
export const ContingentHoldsType = 'contingent-holds' | ||
export const AccountCashTransfersType = 'account-cash-transfers' | ||
export const WebhookConfigType = 'webhook-config' | ||
export const WebhookConfigsType = 'webhook-configs' | ||
export const UploadedDocuments = 'uploaded-documents' | ||
export const AMLChecksType = 'aml-checks' | ||
export const CIPChecksType = 'cip-checks' | ||
export const KYCDocumentChecksType = 'kyc-document-checks' | ||
export const UploadedDocumentsType = 'uploaded-documents' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
475065
568
5604