lightrail-client
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -10,3 +10,3 @@ import { Card } from "./model/Card"; | ||
import { SimulateTransactionParams } from "./params/SimulateTransactionParams"; | ||
export declare function createTransaction(card: string | Card, params: CreateTransactionParams | SimulateTransactionParams, dryRun?: boolean): Promise<Transaction>; | ||
export declare function createTransaction(card: string | Card, params: CreateTransactionParams | SimulateTransactionParams): Promise<Transaction>; | ||
export declare function simulateTransaction(card: string | Card, params: SimulateTransactionParams): Promise<Transaction>; | ||
@@ -13,0 +13,0 @@ export declare function getTransaction(card: string | Card, transaction: string | Transaction): Promise<Transaction>; |
@@ -14,3 +14,3 @@ "use strict"; | ||
const LightrailRequestError_1 = require("./LightrailRequestError"); | ||
function createTransaction(card, params, dryRun = false) { | ||
function createTransaction(card, params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -24,9 +24,3 @@ if (!params) { | ||
const cardId = cards.getCardId(card); | ||
let resp; | ||
if (dryRun) { | ||
resp = yield lightrail.request("POST", `cards/${encodeURIComponent(cardId)}/transactions/dryRun`).send(params); | ||
} | ||
else { | ||
resp = yield lightrail.request("POST", `cards/${encodeURIComponent(cardId)}/transactions`).send(params); | ||
} | ||
const resp = yield lightrail.request("POST", `cards/${encodeURIComponent(cardId)}/transactions`).send(params); | ||
if (resp.status === 200) { | ||
@@ -41,3 +35,14 @@ return resp.body.transaction; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return createTransaction(card, params, true); | ||
if (!params) { | ||
throw new Error("params not set"); | ||
} | ||
else if (!params.userSuppliedId) { | ||
throw new Error("params.userSuppliedId not set"); | ||
} | ||
const cardId = cards.getCardId(card); | ||
const resp = yield lightrail.request("POST", `cards/${encodeURIComponent(cardId)}/transactions/dryRun`).send(params); | ||
if (resp.status === 200) { | ||
return resp.body.transaction; | ||
} | ||
throw new LightrailRequestError_1.LightrailRequestError(resp); | ||
}); | ||
@@ -44,0 +49,0 @@ } |
@@ -12,4 +12,5 @@ export * from "./CapturePendingTransactionParams"; | ||
export * from "./PaginationParams"; | ||
export * from "./SimulateTransactionParams"; | ||
export * from "./UpdateCardParams"; | ||
export * from "./UpdateContactParams"; | ||
export * from "./VoidPendingTransactionParams"; |
{ | ||
"name": "lightrail-client", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A Javascript and Typescript client for Lightrail", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70713
1229