bitpay-sdk
Advanced tools
Comparing version 6.1.1 to 6.2.0
@@ -19,3 +19,3 @@ import { Facade } from './index'; | ||
private tokenContainer; | ||
constructor(configFilePath: string | null, privateKey: PrivateKey | null, tokenContainer: TokenContainer | null, posToken: PosToken | null, environment?: Environment, bitPayClient?: BitPayClient, // using for tests | ||
constructor(configFilePath: string | null, privateKey: PrivateKey | null, tokenContainer: TokenContainer | null, posToken: PosToken | null, environment?: Environment, platformInfo?: string, bitPayClient?: BitPayClient, // using for tests | ||
guidGenerator?: GuidGenerator); | ||
@@ -27,3 +27,3 @@ /** | ||
*/ | ||
static createPosClient(posToken: string, environment?: Environment): Client; | ||
static createPosClient(posToken: string, environment?: Environment, platformInfo?: string): Client; | ||
/** | ||
@@ -34,3 +34,3 @@ * Client factory based on config file | ||
*/ | ||
static createClientByConfig(configFilePath: string): Client; | ||
static createClientByConfig(configFilePath: string, platformInfo?: string): Client; | ||
/** | ||
@@ -42,3 +42,3 @@ * Client factory based on private key and tokens | ||
*/ | ||
static createClientByPrivateKey(privateKey: string, tokenContainer: TokenContainer, environment?: Environment): Client; | ||
static createClientByPrivateKey(privateKey: string, tokenContainer: TokenContainer, environment?: Environment, platformInfo?: string): Client; | ||
getToken(facade: Facade): string; | ||
@@ -45,0 +45,0 @@ /** |
@@ -15,3 +15,3 @@ "use strict"; | ||
class Client { | ||
constructor(configFilePath, privateKey, tokenContainer, posToken, environment, bitPayClient, // using for tests | ||
constructor(configFilePath, privateKey, tokenContainer, posToken, environment, platformInfo, bitPayClient, // using for tests | ||
guidGenerator // using for tests | ||
@@ -42,3 +42,3 @@ ) { | ||
this.tokenContainer = tokenContainer; | ||
this.bitPayClient = new index_2.BitPayClient(Client.getBaseUrl(environment), ecKey, this.getIdentity(ecKey)); | ||
this.bitPayClient = new index_2.BitPayClient(Client.getBaseUrl(environment), ecKey, this.getIdentity(ecKey), platformInfo); | ||
return; | ||
@@ -48,3 +48,3 @@ } | ||
this.guidGenerator = new GuidGenerator_1.GuidGenerator(); | ||
this.bitPayClient = new index_2.BitPayClient(Client.getBaseUrl(environment), null, null); | ||
this.bitPayClient = new index_2.BitPayClient(Client.getBaseUrl(environment), null, null, platformInfo); | ||
if (posToken !== null) { | ||
@@ -60,4 +60,4 @@ this.tokenContainer.addPos(posToken.getValue()); | ||
*/ | ||
static createPosClient(posToken, environment) { | ||
return new Client(null, null, null, new PosToken_1.PosToken(posToken), environment); | ||
static createPosClient(posToken, environment, platformInfo) { | ||
return new Client(null, null, null, new PosToken_1.PosToken(posToken), environment, platformInfo); | ||
} | ||
@@ -69,4 +69,4 @@ /** | ||
*/ | ||
static createClientByConfig(configFilePath) { | ||
return new Client(configFilePath, null, null, null); | ||
static createClientByConfig(configFilePath, platformInfo) { | ||
return new Client(configFilePath, null, null, null, undefined, platformInfo); | ||
} | ||
@@ -79,4 +79,4 @@ /** | ||
*/ | ||
static createClientByPrivateKey(privateKey, tokenContainer, environment) { | ||
return new Client(null, new PrivateKey_1.PrivateKey(privateKey), tokenContainer, null, environment); | ||
static createClientByPrivateKey(privateKey, tokenContainer, environment, platformInfo) { | ||
return new Client(null, new PrivateKey_1.PrivateKey(privateKey), tokenContainer, null, environment, platformInfo); | ||
} | ||
@@ -665,3 +665,3 @@ getToken(facade) { | ||
} | ||
initByConfigFilePath(configFilePath) { | ||
initByConfigFilePath(configFilePath, platformInfo) { | ||
if (!fs.existsSync(configFilePath)) { | ||
@@ -677,3 +677,3 @@ BitPayExceptionProvider_1.BitPayExceptionProvider.throwGenericExceptionWithMessage('Configuration file not found'); | ||
const ecKey = this.getEcKeyByConfig(envConfig); | ||
this.bitPayClient = new index_2.BitPayClient(Client.getBaseUrl(environment), ecKey, this.getIdentity(ecKey)); | ||
this.bitPayClient = new index_2.BitPayClient(Client.getBaseUrl(environment), ecKey, this.getIdentity(ecKey), platformInfo); | ||
this.guidGenerator = new GuidGenerator_1.GuidGenerator(); | ||
@@ -680,0 +680,0 @@ } |
@@ -10,3 +10,3 @@ import { ec } from 'elliptic'; | ||
private readonly responseParser; | ||
constructor(baseUrl: string, ecKey: KeyPair | null, identity: string | null); | ||
constructor(baseUrl: string, ecKey: KeyPair | null, identity: string | null, platformInfo?: string); | ||
/** | ||
@@ -13,0 +13,0 @@ * |
@@ -12,3 +12,3 @@ "use strict"; | ||
class BitPayClient { | ||
constructor(baseUrl, ecKey, identity) { | ||
constructor(baseUrl, ecKey, identity, platformInfo) { | ||
this.ecKey = ecKey; | ||
@@ -24,2 +24,5 @@ this.baseUrl = baseUrl; | ||
}; | ||
if (platformInfo) { | ||
this.defaultHeaders['x-bitpay-platform-info'] = platformInfo; | ||
} | ||
this.keyUtils = new index_1.KeyUtils(); | ||
@@ -26,0 +29,0 @@ this.responseParser = new BitPayResponseParser_1.BitPayResponseParser(); |
@@ -6,4 +6,4 @@ export declare const Test = "TEST"; | ||
export declare const BitpayApiVersion = "2.0.0"; | ||
export declare const BitpayPluginInfo = "BitPay_NodeJs_Client_v6.1.1"; | ||
export declare const BitpayPluginInfo = "BitPay_NodeJs_Client_v6.2.0"; | ||
export declare const BitpayApiFrame = "std"; | ||
export declare const BitpayApiFrameVersion = "1.0.0"; |
@@ -9,3 +9,3 @@ "use strict"; | ||
exports.BitpayApiVersion = '2.0.0'; | ||
exports.BitpayPluginInfo = 'BitPay_NodeJs_Client_v6.1.1'; | ||
exports.BitpayPluginInfo = 'BitPay_NodeJs_Client_v6.2.0'; | ||
exports.BitpayApiFrame = 'std'; | ||
@@ -12,0 +12,0 @@ exports.BitpayApiFrameVersion = '1.0.0'; |
{ | ||
"name": "bitpay-sdk", | ||
"version": "6.1.1", | ||
"version": "6.2.0", | ||
"description": "Complete version of the NodeJS library for the new cryptographically secure BitPay API", | ||
@@ -5,0 +5,0 @@ "engines": { |
337684
8887