@swp/swipe-sdk
Advanced tools
Comparing version 0.12.58 to 0.12.59
module.exports = { | ||
singleQuote: true, | ||
useTabs: false, | ||
semi: false, | ||
trailingComma: 'none', | ||
overrides: [ | ||
{ | ||
files: '*', | ||
options: { | ||
tabWidth: 4, | ||
bracketSpacing: true | ||
} | ||
}, | ||
{ | ||
files: '*.yml', | ||
options: { | ||
tabWidth: 2 | ||
} | ||
} | ||
] | ||
singleQuote: true, | ||
useTabs: false, | ||
semi: false, | ||
trailingComma: 'none', | ||
overrides: [ | ||
{ | ||
files: '*', | ||
options: { | ||
tabWidth: 2, | ||
bracketSpacing: true | ||
} | ||
}, | ||
{ | ||
files: '*.yml', | ||
options: { | ||
tabWidth: 2 | ||
} | ||
} | ||
] | ||
} |
@@ -15,2 +15,3 @@ export * from "./src/swipe"; | ||
export * from "./src/http/dto/zak"; | ||
export * from "./src/http/dto/bankly"; | ||
export * from './src/http/path-query'; | ||
@@ -17,0 +18,0 @@ export * from './src/http/web-client'; |
@@ -27,2 +27,3 @@ "use strict"; | ||
__exportStar(require("./src/http/dto/zak"), exports); | ||
__exportStar(require("./src/http/dto/bankly"), exports); | ||
__exportStar(require("./src/http/path-query"), exports); | ||
@@ -29,0 +30,0 @@ __exportStar(require("./src/http/web-client"), exports); |
@@ -276,3 +276,4 @@ import { SwpError } from '../error/error'; | ||
ZoopFindReceivablesByTransaction = "ZOOP_FIND_RECEIVABLES_BY_TRANSACTION", | ||
ZoopFindReceivablesById = "ZOOP_FIND_RECEIVABLES_BY_ID" | ||
ZoopFindReceivablesById = "ZOOP_FIND_RECEIVABLES_BY_ID", | ||
BanklySendDocuments = "BANKLY_SEND_DOCUMENTS" | ||
} | ||
@@ -279,0 +280,0 @@ export interface BalanceDataResponse { |
@@ -77,3 +77,4 @@ "use strict"; | ||
ExternalServiceResponseType["ZoopFindReceivablesById"] = "ZOOP_FIND_RECEIVABLES_BY_ID"; | ||
ExternalServiceResponseType["BanklySendDocuments"] = "BANKLY_SEND_DOCUMENTS"; | ||
})(ExternalServiceResponseType = exports.ExternalServiceResponseType || (exports.ExternalServiceResponseType = {})); | ||
//# sourceMappingURL=dto.js.map |
@@ -6,5 +6,5 @@ import { CreditCardDTO } from './cash-in'; | ||
INITIAL = "INITIAL", | ||
BASIC_PENDING = "BASIC_PENDING", | ||
BASIC_APPROVED = "BASIC_APPROVED", | ||
BASIC_IN_ANALYSIS = "BASIC_IN_ANALYSIS", | ||
BASIC_IN_ANALYSIS_BANK = "BASIC_IN_ANALYSIS_BANK", | ||
BASIC_REJECTED = "BASIC_REJECTED" | ||
@@ -117,2 +117,8 @@ } | ||
} | ||
export interface DocumentsStatusDTO { | ||
selfie: string; | ||
backSide: string; | ||
frontSide: string; | ||
approved: boolean; | ||
} | ||
export interface DocumentsCnpjDTO extends DocumentsDTO { | ||
@@ -119,0 +125,0 @@ socialContract: boolean; |
@@ -7,5 +7,5 @@ "use strict"; | ||
DocumentStatus["INITIAL"] = "INITIAL"; | ||
DocumentStatus["BASIC_PENDING"] = "BASIC_PENDING"; | ||
DocumentStatus["BASIC_APPROVED"] = "BASIC_APPROVED"; | ||
DocumentStatus["BASIC_IN_ANALYSIS"] = "BASIC_IN_ANALYSIS"; | ||
DocumentStatus["BASIC_IN_ANALYSIS_BANK"] = "BASIC_IN_ANALYSIS_BANK"; | ||
DocumentStatus["BASIC_REJECTED"] = "BASIC_REJECTED"; | ||
@@ -12,0 +12,0 @@ })(DocumentStatus = exports.DocumentStatus || (exports.DocumentStatus = {})); |
@@ -352,3 +352,3 @@ "use strict"; | ||
break; | ||
case profile_1.DocumentStatus.BASIC_PENDING: | ||
case profile_1.DocumentStatus.BASIC_IN_ANALYSIS: | ||
msg = `A documentação da Conta ${accountId} ainda está em análise.`; | ||
@@ -355,0 +355,0 @@ break; |
@@ -357,10 +357,3 @@ "use strict"; | ||
expect(error2.subErrors[0].code).toBe(error_1.SubErrorCode.MISSING_KYC); | ||
const status3 = profile_1.DocumentStatus.BASIC_PENDING; | ||
const accountId3 = 'account id'; | ||
const error3 = constructors_1.newMissingKYC(status3, accountId3); | ||
expect(error3.code).toBe(error_1.ErrorCode.Forbidden); | ||
expect(error3.subErrors.length).toBe(1); | ||
expect(error3.subErrors[0].code).toBe(error_1.SubErrorCode.MISSING_KYC); | ||
expect(error.subErrors[0].msg).not.toBe(error2.subErrors[0].msg); | ||
expect(error2.subErrors[0].msg).not.toBe(error3.subErrors[0].msg); | ||
}); | ||
@@ -367,0 +360,0 @@ test('newInvalidOperationProfile', () => { |
@@ -14,5 +14,6 @@ export declare enum InternalService { | ||
SLACK = "SLACK", | ||
AUTHORIRATION = "AUTHORIRATION" | ||
AUTHORIRATION = "AUTHORIRATION", | ||
BANKLY = "BANKLY" | ||
} | ||
export declare const newInternalServiceError: (name: InternalService, msg: string) => Error; | ||
export declare const newNotFoundParentId: (name: InternalService, id: string) => Error; |
@@ -19,2 +19,3 @@ "use strict"; | ||
InternalService["AUTHORIRATION"] = "AUTHORIRATION"; | ||
InternalService["BANKLY"] = "BANKLY"; | ||
})(InternalService = exports.InternalService || (exports.InternalService = {})); | ||
@@ -21,0 +22,0 @@ const newInternalServiceError = (name, msg) => new Error(`Error from ${name} service. \nGot: ${msg}`); |
@@ -1,8 +0,11 @@ | ||
import { AxiosRequestConfig } from "axios"; | ||
import { InternalService } from "./error/internal-service"; | ||
import { AxiosInstance, AxiosRequestConfig, AxiosStatic } from 'axios'; | ||
import { InternalService } from './error/internal-service'; | ||
export declare class WebClient { | ||
private readonly api; | ||
private readonly serviceName; | ||
constructor(config: AxiosRequestConfig, serviceName: InternalService); | ||
private currentRequest; | ||
constructor(config: AxiosRequestConfig, serviceName: InternalService, httpClient?: AxiosInstance); | ||
static createInstance(client: AxiosStatic, config: AxiosRequestConfig, serviceName: InternalService): WebClient; | ||
private request; | ||
getRequest(): any; | ||
get<T>(url: string, config?: AxiosRequestConfig): Promise<T>; | ||
@@ -9,0 +12,0 @@ delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>; |
@@ -7,7 +7,11 @@ "use strict"; | ||
class WebClient { | ||
constructor(config, serviceName) { | ||
this.api = axios_1.default.create(config); | ||
constructor(config, serviceName, httpClient) { | ||
this.api = httpClient !== null && httpClient !== void 0 ? httpClient : axios_1.default.create(config); | ||
this.serviceName = serviceName; | ||
this.api.interceptors.request.use((param) => (Object.assign({}, param))); | ||
} | ||
static createInstance(client, config, serviceName) { | ||
const httpClient = client.create(config); | ||
return new WebClient(config, serviceName, httpClient); | ||
} | ||
async request(config) { | ||
@@ -17,25 +21,31 @@ var _a, _b; | ||
const res = await this.api.request(config); | ||
this.currentRequest = res.request; | ||
return res.data; | ||
} | ||
catch (reason) { | ||
console.log('error de verdade', reason.response); | ||
this.currentRequest = reason.request; | ||
throw constructors_1.newExternalServiceError(this.serviceName, JSON.stringify((_b = (_a = reason.response) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : reason)); | ||
} | ||
} | ||
getRequest() { | ||
return this.currentRequest; | ||
} | ||
get(url, config) { | ||
return this.request(Object.assign(Object.assign({}, config), { method: "get", url })); | ||
return this.request(Object.assign(Object.assign({}, config), { method: 'get', url })); | ||
} | ||
delete(url, config) { | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: "delete" })); | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: 'delete' })); | ||
} | ||
head(url, config) { | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: "head" })); | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: 'head' })); | ||
} | ||
post(url, data, config) { | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: "post", data })); | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: 'post', data })); | ||
} | ||
put(url, data, config) { | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: "put", data })); | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: 'put', data })); | ||
} | ||
patch(url, data, config) { | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: "patch", data })); | ||
return this.request(Object.assign(Object.assign({}, config), { url, method: 'patch', data })); | ||
} | ||
@@ -42,0 +52,0 @@ } |
{ | ||
"name": "@swp/swipe-sdk", | ||
"version": "0.12.58", | ||
"version": "0.12.59", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "private": false, |
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
372629
185
5448