@beamnetwork/eco-prime-trust-api
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -1,8 +0,5 @@ | ||
import { AccountCashTransfersAttributes } from '../AccountCashTransfersAttributes'; | ||
import { CashTransferData } from './CashTransferData'; | ||
export declare class TransferCashRequest { | ||
include?: string; | ||
data: { | ||
type?: string; | ||
attributes: AccountCashTransfersAttributes; | ||
}; | ||
data: CashTransferData; | ||
} |
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TransferCashRequest = void 0; | ||
var CashTransferData_1 = require("./CashTransferData"); | ||
var class_validator_1 = require("class-validator"); | ||
var class_transformer_1 = require("class-transformer"); | ||
var TransferCashRequest = (function () { | ||
function TransferCashRequest() { | ||
} | ||
__decorate([ | ||
class_validator_1.ValidateNested(), | ||
class_transformer_1.Type(function () { return CashTransferData_1.CashTransferData; }), | ||
__metadata("design:type", CashTransferData_1.CashTransferData) | ||
], TransferCashRequest.prototype, "data", void 0); | ||
return TransferCashRequest; | ||
@@ -8,0 +25,0 @@ }()); |
export declare class APIResponse<T> { | ||
errors?: any[]; | ||
response?: T; | ||
status: number; | ||
} |
@@ -85,3 +85,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var response, data, ex_1; | ||
var response, status_1, data, ex_1; | ||
return __generator(this, function (_a) { | ||
@@ -94,4 +94,4 @@ switch (_a.label) { | ||
response = _a.sent(); | ||
data = response.data; | ||
return [2, { response: data }]; | ||
status_1 = response.status, data = response.data; | ||
return [2, { response: data, status: status_1 }]; | ||
case 2: | ||
@@ -108,3 +108,3 @@ ex_1 = _a.sent(); | ||
if (response) { | ||
var data = response.data; | ||
var status_2 = response.status, data = response.data; | ||
if (data) { | ||
@@ -114,2 +114,3 @@ var errors = data.errors; | ||
return { | ||
status: status_2, | ||
errors: errors | ||
@@ -121,2 +122,3 @@ }; | ||
return { | ||
status: -1, | ||
errors: [{ | ||
@@ -123,0 +125,0 @@ message: ex.error || ex, |
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FundsTransferMethodIDAttributes = void 0; | ||
var ChildFundsTransfersAttributes_1 = require("./ChildFundsTransfersAttributes"); | ||
var class_validator_1 = require("class-validator"); | ||
var class_transformer_1 = require("class-transformer"); | ||
var FundsTransferMethodIDAttributes = (function () { | ||
function FundsTransferMethodIDAttributes() { | ||
} | ||
__decorate([ | ||
class_validator_1.IsOptional(), | ||
class_validator_1.ValidateNested(), | ||
class_transformer_1.Type(function () { return ChildFundsTransfersAttributes_1.ChildFundsTransfersAttributes; }), | ||
__metadata("design:type", ChildFundsTransfersAttributes_1.ChildFundsTransfersAttributes) | ||
], FundsTransferMethodIDAttributes.prototype, "child-funds-transfers", void 0); | ||
return FundsTransferMethodIDAttributes; | ||
@@ -8,0 +26,0 @@ }()); |
@@ -1,8 +0,5 @@ | ||
import { FundsTransferMethodIDAttributes } from '../FundsTransferMethodIDAttributes'; | ||
import { FundsTransferMethodParams } from './FundsTransferMethodParams'; | ||
export declare class DepositFundsUsingFundsTransferMethodRequest { | ||
include?: string; | ||
data: { | ||
type?: string; | ||
attributes: FundsTransferMethodIDAttributes; | ||
}; | ||
data: FundsTransferMethodParams; | ||
} |
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DepositFundsUsingFundsTransferMethodRequest = void 0; | ||
var class_validator_1 = require("class-validator"); | ||
var class_transformer_1 = require("class-transformer"); | ||
var FundsTransferMethodParams_1 = require("./FundsTransferMethodParams"); | ||
var DepositFundsUsingFundsTransferMethodRequest = (function () { | ||
function DepositFundsUsingFundsTransferMethodRequest() { | ||
} | ||
__decorate([ | ||
class_validator_1.ValidateNested(), | ||
class_transformer_1.Type(function () { return FundsTransferMethodParams_1.FundsTransferMethodParams; }), | ||
__metadata("design:type", FundsTransferMethodParams_1.FundsTransferMethodParams) | ||
], DepositFundsUsingFundsTransferMethodRequest.prototype, "data", void 0); | ||
return DepositFundsUsingFundsTransferMethodRequest; | ||
@@ -8,0 +25,0 @@ }()); |
@@ -1,8 +0,5 @@ | ||
import { FundsTransferMethodIDAttributes } from '../FundsTransferMethodIDAttributes'; | ||
import { FundsTransferMethodParams } from './FundsTransferMethodParams'; | ||
export declare class WithdrawFundsUsingFundsTransferMethodRequest { | ||
include?: string; | ||
data: { | ||
type?: string; | ||
attributes: FundsTransferMethodIDAttributes; | ||
}; | ||
data: FundsTransferMethodParams; | ||
} |
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WithdrawFundsUsingFundsTransferMethodRequest = void 0; | ||
var class_validator_1 = require("class-validator"); | ||
var class_transformer_1 = require("class-transformer"); | ||
var FundsTransferMethodParams_1 = require("./FundsTransferMethodParams"); | ||
var WithdrawFundsUsingFundsTransferMethodRequest = (function () { | ||
function WithdrawFundsUsingFundsTransferMethodRequest() { | ||
} | ||
__decorate([ | ||
class_validator_1.ValidateNested(), | ||
class_transformer_1.Type(function () { return FundsTransferMethodParams_1.FundsTransferMethodParams; }), | ||
__metadata("design:type", FundsTransferMethodParams_1.FundsTransferMethodParams) | ||
], WithdrawFundsUsingFundsTransferMethodRequest.prototype, "data", void 0); | ||
return WithdrawFundsUsingFundsTransferMethodRequest; | ||
@@ -8,0 +25,0 @@ }()); |
@@ -73,2 +73,3 @@ /// <reference types="node" /> | ||
getAMLChecks(request: StandardQueryParams): Promise<APIResponse<GetAMLCheckResponse>>; | ||
simulateLongRunningRequest(idempotentID: string, request: DepositFundsUsingFundsTransferMethodRequest): Promise<APIResponse<ContributionsResponse>>; | ||
getAMLCheck(getAMLCheckRequest: GetAMLCheckRequest): Promise<APIResponse<GetAMLCheckResponse>>; | ||
@@ -75,0 +76,0 @@ sandboxApproveAMLCheck(approveAMLCheckRequest: ApproveAMLCheckRequest): Promise<APIResponse<AMLCheckResponse>>; |
@@ -280,2 +280,25 @@ "use strict"; | ||
}; | ||
PrimeTrustAPI.prototype.simulateLongRunningRequest = function (idempotentID, request) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var include, reqUri, headers, 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/sandbox/timeout'; | ||
if (include) { | ||
reqUri = reqUri + "?include=" + include; | ||
} | ||
headers = { | ||
'X-Idempotent-ID-V2': idempotentID, | ||
}; | ||
req = this.getAxiosInstance().post(reqUri, request, { headers: headers }); | ||
return [4, this.executeRequest(req)]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PrimeTrustAPI.prototype.getAMLCheck = function (getAMLCheckRequest) { | ||
@@ -282,0 +305,0 @@ return __awaiter(this, void 0, void 0, function () { |
{ | ||
"name": "@beamnetwork/eco-prime-trust-api", | ||
"private": false, | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "Eco Prime Trust API TypeScript Implementation", | ||
@@ -32,3 +32,5 @@ "main": "lib/index.js", | ||
"jsonwebtoken": "^8.5.1", | ||
"moment": "^2.24.0" | ||
"moment": "^2.24.0", | ||
"class-transformer": "^0.2.3", | ||
"class-validator": "^0.10.1" | ||
}, | ||
@@ -35,0 +37,0 @@ "devDependencies": { |
@@ -1,2 +0,4 @@ | ||
import { AccountCashTransfersAttributes } from '../AccountCashTransfersAttributes' | ||
import { CashTransferData } from './CashTransferData' | ||
import { ValidateNested } from 'class-validator' | ||
import { Type } from 'class-transformer' | ||
@@ -6,6 +8,5 @@ export class TransferCashRequest { | ||
data: { | ||
type?: string // 'account-cash-transfers' | ||
attributes: AccountCashTransfersAttributes | ||
} | ||
@ValidateNested() | ||
@Type(() => CashTransferData) | ||
data: CashTransferData | ||
} |
export class APIResponse<T> { | ||
errors?: any[] | ||
response?: T | ||
status: number | ||
} |
@@ -45,4 +45,4 @@ import axios, { AxiosInstance } from 'axios' | ||
const response = await req | ||
const { data } = response | ||
return { response: data } | ||
const { status, data } = response | ||
return { response: data, status } | ||
} catch (ex) { | ||
@@ -56,3 +56,3 @@ return this.getError(ex) | ||
if (response) { | ||
const { data } = response | ||
const { status, data } = response | ||
if (data) { | ||
@@ -62,2 +62,3 @@ const { errors } = data | ||
return { | ||
status, | ||
errors | ||
@@ -70,2 +71,3 @@ } | ||
return { | ||
status: -1, | ||
errors: [{ | ||
@@ -72,0 +74,0 @@ message: ex.error || ex, |
import { ChildFundsTransfersAttributes } from './ChildFundsTransfersAttributes' | ||
import { IsOptional, ValidateNested } from 'class-validator' | ||
import { Type } from 'class-transformer' | ||
@@ -10,3 +12,8 @@ export class FundsTransferMethodIDAttributes { | ||
'user-agent'?: string | ||
@IsOptional() | ||
@ValidateNested() | ||
@Type(() => ChildFundsTransfersAttributes) | ||
'child-funds-transfers'?: ChildFundsTransfersAttributes | ||
'account-id': string // <uuid> (UUIDv4) | ||
@@ -13,0 +20,0 @@ 'contact-id': string // <uuid> (UUIDv4) |
@@ -1,2 +0,4 @@ | ||
import { FundsTransferMethodIDAttributes } from '../FundsTransferMethodIDAttributes' | ||
import { ValidateNested } from 'class-validator' | ||
import { Type } from 'class-transformer' | ||
import { FundsTransferMethodParams } from './FundsTransferMethodParams' | ||
@@ -6,6 +8,5 @@ export class DepositFundsUsingFundsTransferMethodRequest { | ||
data: { | ||
type?: string // 'contributions' | ||
attributes: FundsTransferMethodIDAttributes | ||
} | ||
@ValidateNested() | ||
@Type(() => FundsTransferMethodParams) | ||
data: FundsTransferMethodParams | ||
} |
@@ -1,3 +0,4 @@ | ||
import { DisbursementsAttributes } from '../DisbursementsAttributes' | ||
import { FundsTransferMethodIDAttributes } from '../FundsTransferMethodIDAttributes' | ||
import { ValidateNested } from 'class-validator' | ||
import { Type } from 'class-transformer' | ||
import { FundsTransferMethodParams } from './FundsTransferMethodParams' | ||
@@ -7,6 +8,5 @@ export class WithdrawFundsUsingFundsTransferMethodRequest { | ||
data: { | ||
type?: string // 'disbursements' | ||
attributes: FundsTransferMethodIDAttributes // DisbursementsAttributes | ||
} | ||
@ValidateNested() | ||
@Type(() => FundsTransferMethodParams) | ||
data: FundsTransferMethodParams | ||
} |
@@ -284,2 +284,29 @@ import { APIOptions } from './APIOptions' | ||
async simulateLongRunningRequest( | ||
idempotentID: string, | ||
request: DepositFundsUsingFundsTransferMethodRequest, | ||
): Promise<APIResponse<ContributionsResponse>> { | ||
const { include } = request | ||
delete request.include | ||
request.data.type = ContributionsType | ||
let reqUri = '/v2/contributions/sandbox/timeout' | ||
if (include) { | ||
reqUri = `${reqUri}?include=${include}` | ||
} | ||
const headers = { | ||
'X-Idempotent-ID-V2': idempotentID, | ||
} | ||
const req = this.getAxiosInstance().post( | ||
reqUri, | ||
request, | ||
{ headers }, | ||
) | ||
return await this.executeRequest<ContributionsResponse>(req) | ||
} | ||
async getAMLCheck(getAMLCheckRequest: GetAMLCheckRequest): Promise<APIResponse<GetAMLCheckResponse>> { | ||
@@ -286,0 +313,0 @@ const { include, amlCheckID } = getAMLCheckRequest |
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
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
522078
576
5833
5
+ Addedclass-transformer@^0.2.3
+ Addedclass-validator@^0.10.1
+ Added@types/validator@10.11.3(transitive)
+ Addedclass-transformer@0.2.3(transitive)
+ Addedclass-validator@0.10.2(transitive)
+ Addedgoogle-libphonenumber@3.2.34(transitive)
+ Addedvalidator@11.1.0(transitive)