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

@assemblypayments/spi-client-js

Package Overview
Dependencies
Maintainers
12
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@assemblypayments/spi-client-js - npm Package Compare versions

Comparing version 2.1.0 to 2.4.7

.travis.yml

48

karma.conf.js

@@ -15,12 +15,9 @@ module.exports = function (config) {

files: [
// Vendor libs
'node_modules/aes-js/index.js',
'node_modules/bn.js/lib/bn.js',
'node_modules/jssha/src/sha256.js',
// Our code
'src/**/*.js',
// './src/**/*.js',
{ pattern: 'test-context.js', watched: false },
// Include the unit tests
'tests/**/*.spec.js',
// './tests/**/*.spec.js',

@@ -42,5 +39,29 @@ // Mock fixtures

preprocessors: {
'./tests/fixtures/**/*.json': ['json_fixtures']
'./tests/fixtures/**/*.json': ['json_fixtures'],
'test-context.js': ['webpack']
},
webpack: {
mode: 'development',
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
watch: true
},
webpackServer: {
noInfo: true
},
jsonFixturesPreprocessor: {

@@ -75,10 +96,15 @@ // strip this from the file path \ fixture name

// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
singleRun: true
});
};
{
"name": "@assemblypayments/spi-client-js",
"version": "2.1.0",
"version": "2.4.7",
"description": "JavaScript Client Library for Assembly Payments' In-Store Integration.",
"main": "karma.conf.js",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --open --colors --public localhost:3000",
"build": "webpack -p",
"build:dev": "webpack",
"test": "karma start",
"transpile": "babel src --out-file ./dist/spi-client-js.js",
"build": "babel src --out-file ./dist/spi-client-js.js"
"transpile": "babel src --out-file ./dist/spi-client-js.js"
},

@@ -24,5 +26,7 @@ "repository": {

"devDependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"babel-loader": "^8.0.4",
"connect-api-mocker": "^1.3.6",
"jasmine": "^2.8.0",

@@ -32,3 +36,7 @@ "karma": "^2.0.2",

"karma-jasmine": "^1.1.1",
"karma-json-fixtures-preprocessor": "0.0.6"
"karma-json-fixtures-preprocessor": "0.0.6",
"karma-webpack": "^3.0.5",
"webpack": "^4.21.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
},

@@ -35,0 +43,0 @@ "bugs": {

@@ -1,2 +0,2 @@

# SPI Client JavaScript
# SPI Client JavaScript [![Build Status](https://travis-ci.org/AssemblyPayments/spi-client-js.svg?branch=master)](https://travis-ci.org/AssemblyPayments/spi-client-js)

@@ -3,0 +3,0 @@ This is the JavaScript client library for Assembly Payments in-store integration.

@@ -1,8 +0,14 @@

class CashoutOnlyRequest
import {Message, Events, SuccessState} from './Messages';
import {SpiConfig, TransactionOptions} from './SpiModels';
import {RequestIdHelper} from './RequestIdHelper';
export class CashoutOnlyRequest
{
constructor(amountCents, posRefId)
constructor(amountCents, posRefId, surchargeAmount)
{
this.PosRefId = posRefId;
this.CashoutAmount = amountCents;
this.SurchargeAmount = surchargeAmount;
this.Config = new SpiConfig();
this.Options = new TransactionOptions();
}

@@ -14,3 +20,4 @@

"pos_ref_id": this.PosRefId,
"cash_amount": this.CashoutAmount
"cash_amount": this.CashoutAmount,
"surcharge_amount": this.SurchargeAmount
};

@@ -23,3 +30,3 @@

class CashoutOnlyResponse
export class CashoutOnlyResponse
{

@@ -120,2 +127,7 @@ constructor(m)

GetSurchargeAmount()
{
return this._m.Data["surcharge_amount"];
}
GetResponseValue(attribute)

@@ -122,0 +134,0 @@ {

@@ -1,2 +0,2 @@

const ConnectionState = {
export const ConnectionState = {
Disconnected: 'Disconnected',

@@ -7,5 +7,5 @@ Connecting: 'Connecting',

const SPI_PROTOCOL = 'spi.2.1.0';
export const SPI_PROTOCOL = 'spi.2.4.0';
class ConnectionStateEventArgs
export class ConnectionStateEventArgs
{

@@ -17,3 +17,3 @@ constructor(connectionState) {

class MessageEventArgs
export class MessageEventArgs
{

@@ -25,3 +25,3 @@ constructor(message) {

class Connection {
export class Connection {
constructor() {

@@ -39,3 +39,3 @@ this.Address = null;

Connect() {
Connect(UseSecureWebSockets) {
if(this.State === ConnectionState.Connected || this.State === ConnectionState.Connecting) {

@@ -42,0 +42,0 @@ // already connected or connecting. disconnect first.

@@ -1,11 +0,8 @@

class Crypto {
import jsSHA from 'jssha';
import aesjs from 'aes-js';
export class Crypto {
constructor() {
if(typeof jsSHA === 'undefined') {
throw new Error('jsSHA hash lib requried')
}
if(typeof aesjs === 'undefined') {
throw new Error('aes lib requried')
}
}

@@ -12,0 +9,0 @@

@@ -0,3 +1,5 @@

import BN from 'bn.js';
// This creates the private and public keys for diffie-hellman (https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange#Cryptographic_explanation)
// REQUIREMENTS: bn.js and jssha.js
// REQUIREMENTS: bn.js
// ASSUMPTIONS: Inputs to the functions are hexadecimal strings

@@ -13,12 +15,6 @@

// </summary>
class DiffieHellman {
export class DiffieHellman {
constructor () {
if(typeof BN === 'undefined') {
throw new Error('Big Number lib required')
}
if(typeof jsSHA === 'undefined') {
throw new Error('jsSHA hash lib requried')
}
}

@@ -25,0 +21,0 @@

@@ -1,2 +0,6 @@

class KeyRollingHelper {
import {Events, Message} from './Messages';
import {Crypto} from './Crypto';
import {Secrets} from './Secrets';
export class KeyRollingHelper {
static PerformKeyRolling(krRequest, currentSecrets)

@@ -10,3 +14,3 @@ {

class KeyRollingResult {
export class KeyRollingResult {
constructor(keyRollingConfirmation, newSecrets) {

@@ -13,0 +17,0 @@ this.KeyRollingConfirmation = keyRollingConfirmation;

@@ -1,5 +0,6 @@

class Logger {
constructor(element) {
export default class Logger {
constructor(element, lineSeperator = '\n') {
this.buffer = [];
this.element = element;
this.lineSeperator = lineSeperator;
}

@@ -32,3 +33,3 @@

_render() {
this.element.innerText = this.buffer.join('\n');
this.element.innerText = this.buffer.join(this.lineSeperator);
this.element.scrollTop = this.element.scrollHeight;

@@ -41,2 +42,4 @@ }

}
}
}
export {Logger};

@@ -0,5 +1,7 @@

import {Crypto} from './Crypto';
// <summary>
// Events statically declares the various event names in messages.
// </summary>
const Events = {
export const Events = {
PairRequest : "pair_request",

@@ -21,2 +23,3 @@ KeyRequest : "key_request",

CancelTransactionRequest : "cancel_transaction",
CancelTransactionResponse : "cancel_response",
GetLastTransactionRequest : "get_last_transaction",

@@ -43,2 +46,5 @@ GetLastTransactionResponse : "last_transaction",

SetPosInfoRequest : "set_pos_info",
SetPosInfoResponse : "set_pos_info_response",
KeyRollRequest : "request_use_next_keys",

@@ -56,6 +62,14 @@ KeyRollResponse : "response_use_next_keys",

PayAtTableBillDetails : "bill_details", // outgoing. We reply with this when eftpos requests to us get_bill_details.
PayAtTableBillPayment : "bill_payment" // incoming. When the eftpos advices
PayAtTableBillPayment : "bill_payment", // incoming. When the eftpos advices
PrintingRequest : "print",
PrintingResponse : "print_response",
TerminalStatusRequest : "get_terminal_status",
TerminalStatusResponse : "terminal_status",
BatteryLevelChanged : "battery_level_changed"
};
const SuccessState = {
export const SuccessState = {
Unknown: 'Unknown', Success: 'Success', Failed: 'Failed'

@@ -68,3 +82,3 @@ };

// </summary>
class MessageStamp {
export class MessageStamp {
constructor(posId, secrets, serverTimeDelta) {

@@ -82,3 +96,3 @@ this.PosId = posId;

// </summary>
class MessageEnvelope {
export class MessageEnvelope {
constructor(message, enc, hmac, posId) {

@@ -123,3 +137,3 @@ // <summary>

// </summary>
class Message {
export class Message {
constructor(id, eventName, data, needsEncryption) {

@@ -126,0 +140,0 @@ this.Id = id;

@@ -0,5 +1,8 @@

import {Events, Message} from './Messages';
import {RequestIdHelper} from './RequestIdHelper';
// <summary>
// Pairing Interaction 1: Outgoing
// </summary>
class PairRequest {
export class PairRequest {
ToMessage() {

@@ -12,3 +15,3 @@ let data = {padding: true};

// Pairing Interaction 2: Incoming
class KeyRequest {
export class KeyRequest {
constructor(m) {

@@ -22,3 +25,3 @@ this.RequestId = m.Id;

// Pairing Interaction 3: Outgoing
class KeyResponse {
export class KeyResponse {
constructor(requestId, Benc, Bhmac) {

@@ -45,3 +48,3 @@ this.RequestId = requestId;

// Pairing Interaction 4: Incoming
class KeyCheck {
export class KeyCheck {
constructor(m) {

@@ -53,3 +56,3 @@ this.ConfirmationCode = m.IncomingHmac.substring(0,6);

// Pairing Interaction 5: Incoming
class PairResponse {
export class PairResponse {
constructor(m) {

@@ -61,3 +64,3 @@ this.Success = m.Data.success;

// Holder class for Secrets and KeyResponse, so that we can use them together in method signatures.
class SecretsAndKeyResponse {
export class SecretsAndKeyResponse {
constructor(secrets, keyResponse) {

@@ -69,3 +72,3 @@ this.Secrets = secrets;

class DropKeysRequest
export class DropKeysRequest
{

@@ -72,0 +75,0 @@ ToMessage()

@@ -0,6 +1,11 @@

import {PairRequest, KeyResponse, SecretsAndKeyResponse} from './Pairing';
import {Secrets} from './Secrets';
import {Crypto} from './Crypto';
import {DiffieHellman} from './DiffieHellman';
// This is the generator used for diffie-hellman in 2048-bit MODP Group 14 as per (https://tools.ietf.org/html/rfc3526#section-3)
const GENERATOR = 2;
export const GENERATOR = 2;
// This is the prime used for diffie-hellman using 2048-bit MODP Group 14 as per (https://tools.ietf.org/html/rfc3526#section-3)
const GROUP14_2048_BIT_MODP = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF';
export const GROUP14_2048_BIT_MODP = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF';

@@ -11,3 +16,3 @@ // <summary>

// </summary>
class PairingHelper {
export class PairingHelper {
// <summary>

@@ -83,3 +88,3 @@ // Generates a pairing Request.

// </summary>
class PublicKeyAndSecret {
export class PublicKeyAndSecret {
constructor(myPublicKey, sharedSecretKey) {

@@ -86,0 +91,0 @@ this.MyPublicKey = myPublicKey;

@@ -0,5 +1,8 @@

import {Events, Message} from './Messages';
import {PurchaseResponse} from './Purchase';
// <summary>
// This class represents the BillDetails that the POS will be asked for throughout a PayAtTable flow.
// </summary>
class BillStatusResponse
export class BillStatusResponse
{

@@ -93,3 +96,3 @@ constructor() {

const BillRetrievalResult =
export const BillRetrievalResult =
{

@@ -102,3 +105,3 @@ SUCCESS: 'SUCCESS',

const PaymentType =
export const PaymentType =
{

@@ -109,3 +112,3 @@ CARD: 'CARD',

class BillPayment
export class BillPayment
{

@@ -131,3 +134,3 @@ constructor(m)

class PaymentHistoryEntry
export class PaymentHistoryEntry
{

@@ -153,5 +156,6 @@ constructor(paymentType, paymentSummary)

class PayAtTableConfig
export class PayAtTableConfig
{
constructor() {
this.PayAtTabledEnabled = false;
this.OperatorIdEnabled = false;

@@ -180,3 +184,3 @@ this.SplitByAmountEnabled = false;

var data = {
"pay_at_table_enabled": true,
"pay_at_table_enabled": this.PayAtTabledEnabled,
"operator_id_enabled": this.OperatorIdEnabled,

@@ -183,0 +187,0 @@ "split_by_amount_enabled": this.SplitByAmountEnabled,

@@ -1,2 +0,5 @@

class PongHelper
import {RequestIdHelper} from './RequestIdHelper';
import {Events, Message} from './Messages';
export class PongHelper
{

@@ -9,3 +12,3 @@ static GeneratePongRessponse(ping)

class PingHelper
export class PingHelper
{

@@ -12,0 +15,0 @@ static GeneratePingRequest()

@@ -1,2 +0,6 @@

const PreauthEvents =
import {RequestIdHelper} from './RequestIdHelper';
import {Message} from './Messages';
import {PurchaseResponse} from './Purchase';
export const PreauthEvents =
{

@@ -25,3 +29,3 @@ AccountVerifyRequest: "account_verify",

class AccountVerifyRequest
export class AccountVerifyRequest
{

@@ -43,3 +47,3 @@ constructor(posRefId)

class AccountVerifyResponse
export class AccountVerifyResponse
{

@@ -54,3 +58,3 @@ constructor(m)

class PreauthOpenRequest
export class PreauthOpenRequest
{

@@ -74,3 +78,3 @@ constructor(amountCents, posRefId)

class PreauthTopupRequest
export class PreauthTopupRequest
{

@@ -96,3 +100,3 @@ constructor(preauthId, topupAmountCents, posRefId)

class PreauthPartialCancellationRequest
export class PreauthPartialCancellationRequest
{

@@ -118,3 +122,3 @@ constructor(preauthId, partialCancellationAmountCents, posRefId)

class PreauthExtendRequest
export class PreauthExtendRequest
{

@@ -138,3 +142,3 @@ constructor(preauthId, posRefId)

class PreauthCancelRequest
export class PreauthCancelRequest
{

@@ -158,5 +162,5 @@ constructor(preauthId, posRefId)

class PreauthCompletionRequest
export class PreauthCompletionRequest
{
constructor(preauthId, completionAmountCents, posRefId)
constructor(preauthId, completionAmountCents, posRefId, surchargeAmount)
{

@@ -166,2 +170,3 @@ this.PreauthId = preauthId;

this.PosRefId = posRefId;
this.SurchargeAmount = surchargeAmount;
}

@@ -174,3 +179,4 @@

"preauth_id": this.PreauthId,
"completion_amount": this.CompletionAmount
"completion_amount": this.CompletionAmount,
"surcharge_amount": this.SurchargeAmount
};

@@ -182,3 +188,3 @@

class PreauthResponse
export class PreauthResponse
{

@@ -247,3 +253,2 @@ constructor(m)

return this._m.Data["completion_amount"];
break;
default:

@@ -254,2 +259,14 @@ return 0;

}
GetSurchargeAmount()
{
var txType = this._m.Data["transaction_type"];
switch (txType)
{
case "PCOMP":
return this._m.Data["surcharge_amount"];
default:
return 0;
}
}
}

@@ -1,2 +0,6 @@

class PurchaseRequest {
import {Events, SuccessState, Message} from './Messages';
import {RequestIdHelper} from './RequestIdHelper';
import {SpiConfig, TransactionOptions} from './SpiModels';
export class PurchaseRequest {
constructor(amountCents, posRefId) {

@@ -8,3 +12,5 @@ this.PosRefId = posRefId;

this.PromptForCashout = false;
this.SurchargeAmount = 0;
this.Config = new SpiConfig();
this.Options = new TransactionOptions();

@@ -29,6 +35,8 @@ // Library Backwards Compatibility

cash_amount: this.CashoutAmount,
prompt_for_cashout: this.PromptForCashout
prompt_for_cashout: this.PromptForCashout,
surcharge_amount: this.SurchargeAmount
};
this.Config.addReceiptConfig(data);
this.Options.AddOptions(data);
return new Message(RequestIdHelper.Id("prchs"), Events.PurchaseRequest, data, true);

@@ -38,3 +46,3 @@ }

class PurchaseResponse
export class PurchaseResponse
{

@@ -66,2 +74,7 @@ constructor(m)

GetSurchargeAmount()
{
return this._m.Data.surcharge_amount;
}
GetCashoutAmount()

@@ -180,3 +193,4 @@ {

terminal_ref_id: this.GetTerminalReferenceId(),
tip_amount: this.GetTipAmount()
tip_amount: this.GetTipAmount(),
surcharge_amount: this.GetSurchargeAmount()
};

@@ -186,3 +200,3 @@ }

class CancelTransactionRequest
export class CancelTransactionRequest
{

@@ -196,4 +210,29 @@

class GetLastTransactionRequest
export class CancelTransactionResponse
{
constructor(m)
{
this._m = m;
this.PosRefId = this._m.Data.pos_ref_id;
this.Success = this._m.GetSuccessState() == SuccessState.Success;
}
GetErrorReason()
{
return this._m.Data.error_reason;
}
GetErrorDetail()
{
return this._m.Data.error_detail;
}
GetResponseValueWithAttribute(attribute)
{
return this._m.Data[attribute];
}
}
export class GetLastTransactionRequest
{
ToMessage()

@@ -205,3 +244,3 @@ {

class GetLastTransactionResponse
export class GetLastTransactionResponse
{

@@ -222,2 +261,7 @@ constructor(m)

WasTimeOutOfSyncError()
{
return this._m.GetError().startsWith("TIME_OUT_OF_SYNC");
}
WasOperationInProgressError()

@@ -322,5 +366,5 @@ {

class RefundRequest
export class RefundRequest
{
constructor(amountCents, posRefId)
constructor(amountCents, posRefId, isSuppressMerchantPassword)
{

@@ -330,3 +374,5 @@ this.AmountCents = amountCents;

this.PosRefId = posRefId;
this.IsSuppressMerchantPassword = isSuppressMerchantPassword;
this.Config = new SpiConfig();
this.Options = new TransactionOptions();
}

@@ -336,4 +382,10 @@

{
let data = {refund_amount: this.AmountCents, pos_ref_id: this.PosRefId};
let data = {
refund_amount: this.AmountCents,
pos_ref_id: this.PosRefId,
suppress_merchant_password: this.IsSuppressMerchantPassword
};
this.Config.addReceiptConfig(data);
// this.Options.AddOptions(data);
return new Message(RequestIdHelper.Id("refund"), Events.RefundRequest, data, true);

@@ -343,3 +395,3 @@ }

class RefundResponse
export class RefundResponse
{

@@ -441,3 +493,3 @@ constructor(m)

class SignatureRequired
export class SignatureRequired
{

@@ -464,3 +516,3 @@ constructor(m)

class SignatureDecline
export class SignatureDecline
{

@@ -481,3 +533,3 @@ constructor(posRefId)

class SignatureAccept
export class SignatureAccept
{

@@ -498,9 +550,11 @@ constructor(posRefId)

class MotoPurchaseRequest
export class MotoPurchaseRequest
{
constructor(amountCents, posRefId)
constructor(amountCents, posRefId, surchargeAmount)
{
this.PosRefId = posRefId;
this.PurchaseAmount = amountCents;
this.SurchargeAmount = surchargeAmount;
this.Config = new SpiConfig();
this.Options = new TransactionOptions();
}

@@ -512,3 +566,4 @@

pos_ref_id: this.PosRefId,
purchase_amount: this.PurchaseAmount
purchase_amount: this.PurchaseAmount,
surcharge_amount: this.SurchargeAmount
};

@@ -520,3 +575,3 @@ this.Config.addReceiptConfig(data);

class MotoPurchaseResponse
export class MotoPurchaseResponse
{

@@ -530,3 +585,3 @@ constructor(m)

class PhoneForAuthRequired
export class PhoneForAuthRequired
{

@@ -561,3 +616,3 @@ constructor(...args)

class AuthCodeAdvice
export class AuthCodeAdvice
{

@@ -564,0 +619,0 @@ constructor(posRefId, authCode)

@@ -1,2 +0,4 @@

class PurchaseHelper
import {PurchaseRequest, RefundRequest} from './Purchase';
export class PurchaseHelper
{

@@ -8,3 +10,3 @@ static CreatePurchaseRequest(amountCents, purchaseId)

static CreatePurchaseRequestV2(posRefId, purchaseAmount, tipAmount, cashoutAmount, promptForCashout)
static CreatePurchaseRequestV2(posRefId, purchaseAmount, tipAmount, cashoutAmount, promptForCashout, surchargeAmount)
{

@@ -15,3 +17,4 @@ var pr = Object.assign(new PurchaseRequest(purchaseAmount, posRefId),

TipAmount: tipAmount,
PromptForCashout: promptForCashout
PromptForCashout: promptForCashout,
SurchargeAmount: surchargeAmount
});

@@ -22,7 +25,7 @@

static CreateRefundRequest(amountCents, purchaseId)
static CreateRefundRequest(amountCents, purchaseId, isSuppressMerchantPassword)
{
return new RefundRequest(amountCents, purchaseId);
return new RefundRequest(amountCents, purchaseId, isSuppressMerchantPassword);
}
}
let __RequestIdHelperCounter = 1;
class RequestIdHelper {
export class RequestIdHelper {
static Id(prefix) {

@@ -5,0 +5,0 @@ return prefix + __RequestIdHelperCounter++;

@@ -1,2 +0,2 @@

class Secrets {
export class Secrets {
constructor(encKey, hmacKey) {

@@ -3,0 +3,0 @@ this.EncKey = encKey;

@@ -1,2 +0,4 @@

class SettleRequest {
import {Events, SuccessState, Message} from './Messages';
export class SettleRequest {
constructor(id) {

@@ -11,3 +13,3 @@ this.Id = id;

class Settlement {
export class Settlement {
constructor(m) {

@@ -91,3 +93,3 @@ this.RequestId = m.Id;

class SchemeSettlementEntry
export class SchemeSettlementEntry
{

@@ -117,3 +119,3 @@ // SchemeSettlementEntry(string schemeName, bool settleByAcquirer, int totalCount, int totalValue)

class SettlementEnquiryRequest
export class SettlementEnquiryRequest
{

@@ -120,0 +122,0 @@ constructor(id)

@@ -0,5 +1,7 @@

import {SuccessState} from './Messages';
// <summary>
// Represents the 3 Pairing statuses that the Spi instanxce can be in.
// </summary>
const SpiStatus =
export const SpiStatus =
{

@@ -25,3 +27,3 @@ // <summary>

// </summary>
const SpiFlow =
export const SpiFlow =
{

@@ -49,3 +51,3 @@ // <summary>

// </summary>
class PairingFlowState
export class PairingFlowState
{

@@ -92,3 +94,3 @@ constructor(state) {

const TransactionType =
export const TransactionType =
{

@@ -111,3 +113,3 @@ Purchase: 'Purchase',

// </summary>
class InitiateTxResult
export class InitiateTxResult
{

@@ -135,3 +137,3 @@ constructor(initiated, message)

// </summary>
class MidTxResult
export class MidTxResult
{

@@ -151,3 +153,3 @@ // <summary>

// </summary>
class TransactionFlowState
export class TransactionFlowState
{

@@ -254,2 +256,4 @@ constructor(posRefId, type, amountCents, message, msg)

this.AwaitingGltResponse = null;
this.GLTResponsePosRefId = null;
}

@@ -272,2 +276,8 @@

CancelFailed(msg)
{
this.AttemptingToCancel = false;
this.DisplayMessage = msg;
}
CallingGlt()

@@ -346,3 +356,3 @@ {

// </summary>
class SubmitAuthCodeResult
export class SubmitAuthCodeResult
{

@@ -360,3 +370,3 @@ constructor(validFormat, message)

class SpiConfig
export class SpiConfig
{

@@ -366,2 +376,3 @@ constructor() {

this.SignatureFlowOnEftpos = false;
this.PrintMerchantCopy = false;
}

@@ -379,3 +390,6 @@

}
if (this.PrintMerchantCopy)
{
messageData.print_merchant_copy = this.PrintMerchantCopy;
}
return messageData;

@@ -386,4 +400,41 @@ }

{
return `PromptForCustomerCopyOnEftpos:${this.PromptForCustomerCopyOnEftpos} SignatureFlowOnEftpos:${this.SignatureFlowOnEftpos}`;
return `PromptForCustomerCopyOnEftpos:${this.PromptForCustomerCopyOnEftpos} SignatureFlowOnEftpos:${this.SignatureFlowOnEftpos} PrintMerchantCopy: ${this.PrintMerchantCopy}`;
}
}
export class TransactionOptions
{
constructor() {
this._customerReceiptHeader = null;
this._customerReceiptFooter = null;
this._merchantReceiptHeader = null;
this._merchantReceiptFooter = null;
}
SetCustomerReceiptHeader(customerReceiptHeader)
{
this._customerReceiptHeader = customerReceiptHeader;
}
SetCustomerReceiptFooter(customerReceiptFooter)
{
this._customerReceiptFooter = customerReceiptFooter;
}
SetMerchantReceiptHeader(merchantReceiptHeader)
{
this._merchantReceiptHeader = merchantReceiptHeader;
}
SetMerchantReceiptFooter(merchantReceiptFooter)
{
this._merchantReceiptFooter = merchantReceiptFooter;
}
AddOptions(messageData)
{
messageData.customer_receipt_header = this._customerReceiptHeader;
messageData.customer_receipt_footer = this._customerReceiptFooter;
messageData.merchant_receipt_header = this._merchantReceiptHeader;
messageData.merchant_receipt_footer = this._merchantReceiptFooter;
return messageData;
}
}

@@ -1,2 +0,5 @@

class SpiPayAtTable
import {RequestIdHelper} from './RequestIdHelper';
import {BillPayment, PayAtTableConfig, PaymentHistoryEntry, BillRetrievalResult, BillStatusResponse} from './PayAtTable';
export class SpiPayAtTable
{

@@ -9,2 +12,3 @@ constructor(spi)

this.Config = Object.assign(new PayAtTableConfig(), {
PayAtTabledEnabled: true,
OperatorIdEnabled: true,

@@ -11,0 +15,0 @@ AllowedOperatorIds: [],

@@ -1,2 +0,15 @@

class SpiPreauth
import {
PreauthEvents,
AccountVerifyRequest,
PreauthOpenRequest,
PreauthTopupRequest,
PreauthPartialCancellationRequest,
PreauthExtendRequest,
PreauthCompletionRequest,
PreauthCancelRequest} from './Preauth';
import {TransactionFlowState, TransactionType, InitiateTxResult, SpiStatus, SpiFlow} from './SpiModels';
export class SpiPreauth
{

@@ -59,5 +72,5 @@ constructor(spi)

InitiateCompletionTx(posRefId, preauthId, amountCents)
InitiateCompletionTx(posRefId, preauthId, amountCents, surchargeAmount)
{
var msg = new PreauthCompletionRequest(preauthId, amountCents, posRefId).ToMessage();
var msg = new PreauthCompletionRequest(preauthId, amountCents, posRefId, surchargeAmount).ToMessage();
var tfs = new TransactionFlowState(

@@ -64,0 +77,0 @@ posRefId, TransactionType.Preauth, amountCents, msg,

@@ -0,1 +1,4 @@

import {CashoutOnlyRequest, CashoutOnlyResponse} from '../src/Cashout';
import {Message} from '../src/Messages';
describe('Cashout', function() {

@@ -2,0 +5,0 @@ 'use strict';

@@ -0,1 +1,4 @@

import {DiffieHellman} from '../src/DiffieHellman';
import {GENERATOR, GROUP14_2048_BIT_MODP} from '../src/PairingHelper';
describe('DiffieHellman', function() {

@@ -2,0 +5,0 @@ 'use strict';

@@ -0,1 +1,5 @@

import {Message, Events} from '../src/Messages';
import {KeyRollingHelper} from '../src/KeyRollingHelper';
import {Secrets} from '../src/Secrets';
describe('KeyRollingTest', function() {

@@ -2,0 +6,0 @@ 'use strict';

@@ -0,1 +1,4 @@

import {Message, MessageStamp, Events} from '../src/Messages';
import {Secrets} from '../src/Secrets';
describe('MessagesTest', function() {

@@ -2,0 +5,0 @@ 'use strict';

@@ -0,1 +1,5 @@

import {Message} from '../src/Messages';
import {PairingHelper} from '../src/PairingHelper';
import {KeyRequest} from '../src/Pairing';
describe('PairingTests', function() {

@@ -2,0 +6,0 @@ 'use strict';

@@ -0,1 +1,4 @@

import {Message} from '../src/Messages';
import {BillRetrievalResult, PaymentType, BillPayment, PaymentHistoryEntry, PayAtTableConfig} from '../src/PayAtTable';
describe('PayAtTable', function() {

@@ -2,0 +5,0 @@ 'use strict';

@@ -0,1 +1,14 @@

import {Message} from '../src/Messages';
import {
PreauthEvents,
AccountVerifyRequest,
AccountVerifyResponse,
PreauthOpenRequest,
PreauthTopupRequest,
PreauthPartialCancellationRequest,
PreauthExtendRequest,
PreauthCancelRequest,
PreauthCompletionRequest,
PreauthResponse} from '../src/Preauth';
describe('Preauth', function() {

@@ -2,0 +15,0 @@ 'use strict';

@@ -0,1 +1,6 @@

import {Message, Events, MessageStamp} from '../src/Messages';
import {Secrets} from '../src/Secrets';
import {RequestIdHelper} from '../src/RequestIdHelper';
import {PurchaseHelper} from '../src/PurchaseHelper';
describe('Purchase', function() {

@@ -2,0 +7,0 @@ 'use strict';

@@ -0,1 +1,3 @@

import {SpiConfig} from '../src/SpiModels';
describe('SpiModels', function() {

@@ -2,0 +4,0 @@ 'use strict';

@@ -0,1 +1,6 @@

import {Spi} from '../src/Spi';
import {SpiPayAtTable} from '../src/SpiPayAtTable';
import {BillStatusResponse, BillRetrievalResult} from '../src/PayAtTable';
import {Message} from '../src/Messages';
describe('SpiPayAtTable', function() {

@@ -2,0 +7,0 @@ 'use strict';

@@ -0,1 +1,5 @@

import {Spi} from '../src/Spi';
import {SpiPreauth} from '../src/SpiPreauth';
import {PreauthEvents} from '../src/Preauth';
describe('SpiPreauth', function() {

@@ -2,0 +6,0 @@ 'use strict';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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