lightrail-stripe
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,3 +0,5 @@ | ||
import { StripeLightrailSplitTenderCharge } from "./model/StripeLightrailSplitTenderCharge"; | ||
import { CreateSplitTenderChargeParams } from "./model/CreateSplitTenderChargeParams"; | ||
import { StripeLightrailSplitTenderCharge } from "./params/StripeLightrailSplitTenderCharge"; | ||
import { CreateSplitTenderChargeParams } from "./params/CreateSplitTenderChargeParams"; | ||
import { SimulateSplitTenderChargeParams } from "./params/SimulateSplitTenderChargeParams"; | ||
export declare function simulateSplitTenderCharge(params: SimulateSplitTenderChargeParams, lightrailShare: number): Promise<StripeLightrailSplitTenderCharge>; | ||
export declare function createSplitTenderCharge(params: CreateSplitTenderChargeParams, lightrailShare: number, stripeParam: object | string): Promise<StripeLightrailSplitTenderCharge>; |
@@ -12,2 +12,33 @@ "use strict"; | ||
const lightrail = require("lightrail-client"); | ||
function simulateSplitTenderCharge(params, lightrailShare) { | ||
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"); | ||
} | ||
let splitTenderSimulation = { | ||
lightrailTransaction: null, | ||
stripeCharge: null | ||
}; | ||
if (lightrailShare > 0) { | ||
const contact = yield lightrail.contacts.getContactByUserSuppliedId(params.shopperId); | ||
const card = yield lightrail.cards.getAccountCardByContactAndCurrency(contact, params.currency); | ||
if (!card) { | ||
throw new Error(`No ${params.currency} card found for shopperId '${params.shopperId}'.`); | ||
} | ||
let lightrailTransactionParameters = { | ||
value: 0 - lightrailShare, | ||
currency: params.currency, | ||
userSuppliedId: params.userSuppliedId, | ||
}; | ||
lightrailTransactionParameters.metadata = appendSplitTenderMetadataForLightrail(params, null); | ||
const lightrailSimulatedTransaction = yield lightrail.cards.transactions.simulateTransaction(card, lightrailTransactionParameters); | ||
splitTenderSimulation.lightrailTransaction = lightrailSimulatedTransaction; | ||
} | ||
return splitTenderSimulation; | ||
}); | ||
} | ||
exports.simulateSplitTenderCharge = simulateSplitTenderCharge; | ||
function createSplitTenderCharge(params, lightrailShare, stripeParam) { | ||
@@ -14,0 +45,0 @@ return __awaiter(this, void 0, void 0, function* () { |
{ | ||
"name": "lightrail-stripe", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A Javascript and Typescript library for creating Lightrail-Stripe integrated applications.", | ||
@@ -44,3 +44,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"lightrail-client": "0.0.9", | ||
"lightrail-client": "1.1.2", | ||
"stripe": "^5.3.0", | ||
@@ -47,0 +47,0 @@ "uuid": "^3.1.0" |
@@ -67,3 +67,3 @@ # Lightrail Stripe Integration Library | ||
userSuppliedId:"order-s3xx30", | ||
value:-6960, | ||
amount:6960, | ||
currency:"USD", | ||
@@ -70,0 +70,0 @@ metadata: { |
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
19167
15
185
+ Added@types/jsonwebtoken@7.2.8(transitive)
+ Added@types/node@22.10.1(transitive)
+ Addedbuffer-equal-constant-time@1.0.1(transitive)
+ Addedecdsa-sig-formatter@1.0.11(transitive)
+ Addedjsonwebtoken@8.5.1(transitive)
+ Addedjwa@1.4.1(transitive)
+ Addedjws@3.2.2(transitive)
+ Addedlightrail-client@1.1.2(transitive)
+ Addedlodash.includes@4.3.0(transitive)
+ Addedlodash.isboolean@3.0.3(transitive)
+ Addedlodash.isinteger@4.0.4(transitive)
+ Addedlodash.isnumber@3.0.3(transitive)
+ Addedlodash.isstring@4.0.1(transitive)
+ Addedlodash.once@4.1.1(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedundici-types@6.20.0(transitive)
- Removedlightrail-client@0.0.9(transitive)
Updatedlightrail-client@1.1.2