lightrail-client
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -10,3 +10,3 @@ import { Card } from "./model/Card"; | ||
import { SimulateTransactionParams } from "./params/SimulateTransactionParams"; | ||
export declare function createTransaction(card: string | Card, params: CreateTransactionParams | SimulateTransactionParams): Promise<Transaction>; | ||
export declare function createTransaction(card: string | Card, params: CreateTransactionParams): 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>; |
@@ -7,3 +7,10 @@ import { Pagination } from "./model/Pagination"; | ||
import { CreateContactParams } from "./params/CreateContactParams"; | ||
import * as accounts from "./accounts"; | ||
export { accounts }; | ||
export declare function createContact(params: CreateContactParams): Promise<Contact>; | ||
export declare function getContactByAnyIdentifier(contact: { | ||
contactId?: string; | ||
userSuppliedId?: string; | ||
shopperId?: string; | ||
}): Promise<Contact>; | ||
export declare function getContacts(params?: GetContactsParams & PaginationParams): Promise<{ | ||
@@ -10,0 +17,0 @@ contacts: Contact[]; |
@@ -13,2 +13,4 @@ "use strict"; | ||
const LightrailRequestError_1 = require("./LightrailRequestError"); | ||
const accounts = require("./accounts"); | ||
exports.accounts = accounts; | ||
function createContact(params) { | ||
@@ -30,2 +32,19 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.createContact = createContact; | ||
function getContactByAnyIdentifier(contact) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (contact.contactId) { | ||
return getContactById(contact.contactId); | ||
} | ||
else if (contact.userSuppliedId) { | ||
return getContactByUserSuppliedId(contact.userSuppliedId); | ||
} | ||
else if (contact.shopperId) { | ||
return getContactByUserSuppliedId(contact.shopperId); | ||
} | ||
else { | ||
throw new Error("one of contact.contactId, contact.userSuppliedId or contact.shopperId must be set"); | ||
} | ||
}); | ||
} | ||
exports.getContactByAnyIdentifier = getContactByAnyIdentifier; | ||
function getContacts(params) { | ||
@@ -56,3 +75,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.getContacts({ userSuppliedId }); | ||
const resp = yield getContacts({ userSuppliedId }); | ||
if (resp.contacts.length > 0) { | ||
@@ -59,0 +78,0 @@ return resp.contacts[0]; |
export * from "./CapturePendingTransactionParams"; | ||
export * from "./CreateAccountCardParams"; | ||
export * from "./CreateCardParams"; | ||
@@ -3,0 +4,0 @@ export * from "./CreateContactParams"; |
{ | ||
"name": "lightrail-client", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"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
76992
77
1381