lightrail-client
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -10,2 +10,4 @@ import * as valueStores from "./valueStores"; | ||
import { Contact } from "./model/Contact"; | ||
import { Transaction } from "./model/Transaction"; | ||
import { CreateTransactionParams } from "./params/CreateTransactionParams"; | ||
export { valueStores }; | ||
@@ -22,2 +24,3 @@ export declare function createCard(params: CreateCardParams): Promise<Card>; | ||
export declare function updateCard(card: string | Card, params: UpdateCardParams): Promise<Card>; | ||
export declare function createTransaction(card: string | Card, params: CreateTransactionParams): Promise<Transaction>; | ||
export declare function getCardId(card: string | Card): string; |
@@ -102,2 +102,19 @@ "use strict"; | ||
exports.updateCard = updateCard; | ||
function createTransaction(card, params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!params) { | ||
throw new Error("params not set"); | ||
} | ||
else if (!params.userSuppliedId) { | ||
throw new Error("params.userSuppliedId not set"); | ||
} | ||
const cardId = getCardId(card); | ||
const resp = yield lightrail.request("POST", `cards/${encodeURIComponent(cardId)}/transactions`).send(params); | ||
if (resp.status === 200) { | ||
return resp.body.transaction; | ||
} | ||
throw new LightrailRequestError_1.LightrailRequestError(resp); | ||
}); | ||
} | ||
exports.createTransaction = createTransaction; | ||
function getCardId(card) { | ||
@@ -104,0 +121,0 @@ if (!card) { |
{ | ||
"name": "lightrail-client", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"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
33546
59
787