lightrail-client
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -0,1 +1,2 @@ | ||
import * as transactions from "./cardTransactions"; | ||
import * as valueStores from "./valueStores"; | ||
@@ -10,5 +11,3 @@ import { CreateCardParams } from "./params/CreateCardParams"; | ||
import { Contact } from "./model/Contact"; | ||
import { Transaction } from "./model/Transaction"; | ||
import { CreateTransactionParams } from "./params/CreateTransactionParams"; | ||
export { valueStores }; | ||
export { transactions, valueStores }; | ||
export declare function createCard(params: CreateCardParams): Promise<Card>; | ||
@@ -24,3 +23,5 @@ export declare function getCards(params: GetCardsParams & PaginationParams): Promise<{ | ||
export declare function updateCard(card: string | Card, params: UpdateCardParams): Promise<Card>; | ||
export declare function createTransaction(card: string | Card, params: CreateTransactionParams): Promise<Transaction>; | ||
/** | ||
* Get cardId from the string (as the ID itself) or Card object. | ||
*/ | ||
export declare function getCardId(card: string | Card): string; |
@@ -13,2 +13,4 @@ "use strict"; | ||
const contacts = require("./contacts"); | ||
const transactions = require("./cardTransactions"); | ||
exports.transactions = transactions; | ||
const valueStores = require("./valueStores"); | ||
@@ -103,19 +105,5 @@ exports.valueStores = valueStores; | ||
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; | ||
/** | ||
* Get cardId from the string (as the ID itself) or Card object. | ||
*/ | ||
function getCardId(card) { | ||
@@ -122,0 +110,0 @@ if (!card) { |
@@ -19,2 +19,5 @@ import { Pagination } from "./model/Pagination"; | ||
export declare function updateContact(contact: string | Contact, params: UpdateContactParams): Promise<Contact>; | ||
/** | ||
* Get contactId from the string (as the ID itself) or Contact object. | ||
*/ | ||
export declare function getContactId(contact: string | Contact): string; |
@@ -86,2 +86,5 @@ "use strict"; | ||
exports.updateContact = updateContact; | ||
/** | ||
* Get contactId from the string (as the ID itself) or Contact object. | ||
*/ | ||
function getContactId(contact) { | ||
@@ -88,0 +91,0 @@ if (!contact) { |
@@ -0,1 +1,2 @@ | ||
export * from "./CapturePendingTransactionParams"; | ||
export * from "./CreateCardParams"; | ||
@@ -8,2 +9,3 @@ export * from "./CreateContactParams"; | ||
export * from "./GetProgramParams"; | ||
export * from "./GetTransactionsParams"; | ||
export * from "./GetValueStoresParams"; | ||
@@ -13,1 +15,2 @@ export * from "./PaginationParams"; | ||
export * from "./UpdateContactParams"; | ||
export * from "./VoidPendingTransactionParams"; |
{ | ||
"name": "lightrail-client", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"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
46943
71
1078