Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lightrail-stripe

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightrail-stripe - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

dist/index.d.ts

6

dist/stripeLightrailSplitTenderTransactions.d.ts

@@ -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: {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc