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

@getvolume/volume-js

Package Overview
Dependencies
Maintainers
5
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getvolume/volume-js - npm Package Compare versions

Comparing version 1.0.19 to 1.0.21

dist/index.d.mts

2

dist/index.d.ts

@@ -32,3 +32,3 @@ import { ResponseWrapper, AgentType } from '@getvolume/volume-shared';

headers?: Record<string, string>;
metadata?: Object;
metadata?: object;
}): Promise<ResponseWrapper<Response>>;

@@ -35,0 +35,0 @@ cancelUrl(headers?: Record<string, string>): Promise<ResponseWrapper<Response>>;

@@ -1,274 +0,1 @@

"use strict";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/index.ts
var src_exports = {};
__export(src_exports, {
Volume: () => Volume
});
module.exports = __toCommonJS(src_exports);
// src/requests/requests.ts
var import_volume_shared2 = require("@getvolume/volume-shared");
// src/utilities/apiUrlFromVolumeEnvironment.ts
var import_volume_shared = require("@getvolume/volume-shared");
var apiUrlFromVolumeEnvironment = (environment) => {
if (environment === "local")
return import_volume_shared.LOCAL_API_URL;
if (environment === "live")
return import_volume_shared.LIVE_API_URL;
if (environment === "sandbox")
return import_volume_shared.SANDBOX_API_URL;
if (environment === "integration")
return import_volume_shared.INTEGRATION_API_URL;
return environment;
};
// src/requests/requests.ts
function formatString(str, val) {
for (let index = 0; index < val.length; index++) {
str = str.replace(`{${index}}`, val[index]);
}
return str;
}
function applicationIdRequest(_0) {
return __async(this, arguments, function* ({
applicationId,
environment,
endpoint,
method = "GET",
body = void 0,
params = void 0,
xVolumeVersion = "",
xAppName = "",
xDeviceInfo = "",
xCommitSha = "",
additionalHeaders = {}
}) {
let baseUrl = `${apiUrlFromVolumeEnvironment(environment)}${import_volume_shared2.Endpoints[endpoint]}`;
const url = params != void 0 ? formatString(baseUrl, params) : baseUrl;
return yield fetch(url, {
method,
body,
headers: new Headers(__spreadValues({
"x-application-id": applicationId,
Accept: "application/json",
"Content-Type": "application/vnd.volume.v0.7+json",
"x-volume-version": xVolumeVersion,
"x-app-name": xAppName,
"x-device-info": xDeviceInfo,
"x-commitSha": xCommitSha
}, additionalHeaders))
});
});
}
// src/index.ts
var import_volume_shared3 = require("@getvolume/volume-shared");
// package.json
var package_default = {
name: "@getvolume/volume-js",
version: "1.0.19",
description: "Volume JS",
main: "./dist/index.js",
types: "./dist/index.d.ts",
files: [
"dist/**"
],
scripts: {
test: "vitest run",
"test:watch": "vitest",
build: "tsup src/index.ts --dts",
clean: "rm -rf dist .turbo",
dev: "yarn build --watch"
},
dependencies: {
"@getvolume/volume-shared": "0.0.14"
},
author: "Kai Spencer",
license: "ISC",
devDependencies: {
"cross-fetch": "^3.1.5",
msw: "^0.47.0",
"node-fetch": "^3.2.8",
tsup: "^6.7.0",
typescript: "^4.9.5",
vitest: "^0.18.1"
}
};
// src/index.ts
var Volume = class {
constructor(initConfig) {
this.initConfig = initConfig;
}
get version() {
return package_default.version;
}
institutions(headers) {
return __async(this, null, function* () {
try {
return {
response: yield applicationIdRequest({
applicationId: this.initConfig.applicationId,
endpoint: "INSTITUTIONS",
environment: this.initConfig.environment,
xAppName: this.initConfig.xAppName,
xDeviceInfo: this.initConfig.xDeviceInfo,
xVolumeVersion: this.initConfig.xVolumeVersion,
xCommitSha: this.initConfig.xCommitSha,
additionalHeaders: headers
})
};
} catch (e) {
return {
error: e
};
}
});
}
paymentStatus(paymentId, headers) {
return __async(this, null, function* () {
try {
return {
response: yield applicationIdRequest({
applicationId: this.initConfig.applicationId,
endpoint: "PAYMENT_STATUS",
params: [paymentId],
environment: this.initConfig.environment,
xAppName: this.initConfig.xAppName,
xDeviceInfo: this.initConfig.xDeviceInfo,
xVolumeVersion: this.initConfig.xVolumeVersion,
xCommitSha: this.initConfig.xCommitSha,
additionalHeaders: headers
})
};
} catch (e) {
return {
error: e
};
}
});
}
createSingleDomesticPayment(_0) {
return __async(this, arguments, function* ({
institutionId,
paymentRequest,
merchantPaymentId,
shopperId,
paymentId,
headers,
metadata
}) {
try {
return {
response: yield applicationIdRequest({
environment: this.initConfig.environment,
applicationId: this.initConfig.applicationId,
endpoint: "CREATE_PAYMENT",
method: "POST",
body: JSON.stringify(__spreadProps(__spreadValues(__spreadValues({}, shopperId && { shopperId }), paymentId && { paymentId }), {
paymentRequest,
institutionId,
merchantPaymentId,
metadata,
applicationId: this.initConfig.applicationId,
agentType: this.initConfig.agentType ? this.initConfig.agentType : import_volume_shared3.AgentType.MOBILE_APPLICATION
})),
xAppName: this.initConfig.xAppName,
xDeviceInfo: this.initConfig.xDeviceInfo,
xVolumeVersion: this.initConfig.xVolumeVersion,
xCommitSha: this.initConfig.xCommitSha,
additionalHeaders: headers
})
};
} catch (e) {
return {
error: e
};
}
});
}
cancelUrl(headers) {
return __async(this, null, function* () {
try {
return {
response: yield applicationIdRequest({
applicationId: this.initConfig.applicationId,
endpoint: "CANCEL_URL",
params: [this.initConfig.applicationId],
environment: this.initConfig.environment,
xAppName: this.initConfig.xAppName,
xDeviceInfo: this.initConfig.xDeviceInfo,
xVolumeVersion: this.initConfig.xVolumeVersion,
xCommitSha: this.initConfig.xCommitSha,
additionalHeaders: headers
})
};
} catch (e) {
return {
error: e
};
}
});
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Volume
});
"use strict";var f=Object.defineProperty,N=Object.defineProperties,T=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var C=(e,i,n)=>i in e?f(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,g=(e,i)=>{for(var n in i||(i={}))v.call(i,n)&&C(e,n,i[n]);if(h)for(var n of h(i))P.call(i,n)&&C(e,n,i[n]);return e},I=(e,i)=>N(e,w(i));var D=(e,i)=>{for(var n in i)f(e,n,{get:i[n],enumerable:!0})},U=(e,i,n,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of b(i))!v.call(e,t)&&t!==n&&f(e,t,{get:()=>i[t],enumerable:!(o=T(i,t))||o.enumerable});return e};var _=e=>U(f({},"__esModule",{value:!0}),e);var d=(e,i,n)=>new Promise((o,t)=>{var a=r=>{try{p(n.next(r))}catch(m){t(m)}},c=r=>{try{p(n.throw(r))}catch(m){t(m)}},p=r=>r.done?o(r.value):Promise.resolve(r.value).then(a,c);p((n=n.apply(e,i)).next())});var O={};D(O,{Volume:()=>l});module.exports=_(O);var R=require("@getvolume/volume-shared");var y={name:"@getvolume/volume-js",version:"1.0.21",description:"Volume JS",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",exports:{".":{require:"./dist/index.js",import:"./dist/index.mjs",types:"./dist/index.d.ts"}},files:["dist/**"],scripts:{test:"vitest run","test:watch":"vitest",build:"tsup",clean:"rm -rf dist .turbo",dev:"pnpm build --watch"},dependencies:{"@getvolume/volume-shared":"workspace:*"},author:"Kai Spencer",license:"ISC",devDependencies:{msw:"^2.3.0",tsup:"^8.0.2",vitest:"^1.6.0"}};var A=require("@getvolume/volume-shared");var s=require("@getvolume/volume-shared"),V=e=>e==="local"?s.LOCAL_API_URL:e==="live"?s.LIVE_API_URL:e==="sandbox"?s.SANDBOX_API_URL:e==="integration"?s.INTEGRATION_API_URL:e;function j(e,i){for(let n=0;n<i.length;n++)e=e.replace(`{${n}}`,i[n]);return e}function u(G){return d(this,arguments,function*({applicationId:e,environment:i,endpoint:n,method:o="GET",body:t=void 0,params:a=void 0,xVolumeVersion:c="",xAppName:p="",xDeviceInfo:r="",xCommitSha:m="",additionalHeaders:S={}}){let x=`${V(i)}${A.Endpoints[n]}`,E=a!==void 0?j(x,a):x;return yield fetch(E,{method:o,body:t,headers:new Headers(g({"x-application-id":e,Accept:"application/json","Content-Type":"application/vnd.volume.v0.7+json","x-volume-version":c,"x-app-name":p,"x-device-info":r,"x-commitSha":m},S))})})}var l=class{constructor(i){this.initConfig=i}get version(){return y.version}institutions(i){return d(this,null,function*(){try{return{response:yield u({applicationId:this.initConfig.applicationId,endpoint:"INSTITUTIONS",environment:this.initConfig.environment,xAppName:this.initConfig.xAppName,xDeviceInfo:this.initConfig.xDeviceInfo,xVolumeVersion:this.initConfig.xVolumeVersion,xCommitSha:this.initConfig.xCommitSha,additionalHeaders:i})}}catch(n){return{error:n}}})}paymentStatus(i,n){return d(this,null,function*(){try{return{response:yield u({applicationId:this.initConfig.applicationId,endpoint:"PAYMENT_STATUS",params:[i],environment:this.initConfig.environment,xAppName:this.initConfig.xAppName,xDeviceInfo:this.initConfig.xDeviceInfo,xVolumeVersion:this.initConfig.xVolumeVersion,xCommitSha:this.initConfig.xCommitSha,additionalHeaders:n})}}catch(o){return{error:o}}})}createSingleDomesticPayment(r){return d(this,arguments,function*({institutionId:i,paymentRequest:n,merchantPaymentId:o,shopperId:t,paymentId:a,headers:c,metadata:p}){try{return{response:yield u({environment:this.initConfig.environment,applicationId:this.initConfig.applicationId,endpoint:"CREATE_PAYMENT",method:"POST",body:JSON.stringify(I(g(g({},t&&{shopperId:t}),a&&{paymentId:a}),{paymentRequest:n,institutionId:i,merchantPaymentId:o,metadata:p,applicationId:this.initConfig.applicationId,agentType:this.initConfig.agentType?this.initConfig.agentType:R.AgentType.MOBILE_APPLICATION})),xAppName:this.initConfig.xAppName,xDeviceInfo:this.initConfig.xDeviceInfo,xVolumeVersion:this.initConfig.xVolumeVersion,xCommitSha:this.initConfig.xCommitSha,additionalHeaders:c})}}catch(m){return{error:m}}})}cancelUrl(i){return d(this,null,function*(){try{return{response:yield u({applicationId:this.initConfig.applicationId,endpoint:"CANCEL_URL",params:[this.initConfig.applicationId],environment:this.initConfig.environment,xAppName:this.initConfig.xAppName,xDeviceInfo:this.initConfig.xDeviceInfo,xVolumeVersion:this.initConfig.xVolumeVersion,xCommitSha:this.initConfig.xCommitSha,additionalHeaders:i})}}catch(n){return{error:n}}})}};0&&(module.exports={Volume});
{
"name": "@getvolume/volume-js",
"version": "1.0.19",
"version": "1.0.21",
"description": "Volume JS",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
"files": [
"dist/**"
],
"scripts": {
"test": "vitest run",
"test:watch": "vitest",
"build": "tsup src/index.ts --dts",
"clean": "rm -rf dist .turbo",
"dev": "yarn build --watch"
},
"dependencies": {
"@getvolume/volume-shared": "0.0.14"
"@getvolume/volume-shared": "0.0.16"
},

@@ -23,9 +24,13 @@ "author": "Kai Spencer",

"devDependencies": {
"cross-fetch": "^3.1.5",
"msw": "^0.47.0",
"node-fetch": "^3.2.8",
"tsup": "^6.7.0",
"typescript": "^4.9.5",
"vitest": "^0.18.1"
"msw": "^2.3.0",
"tsup": "^8.0.2",
"vitest": "^1.6.0"
},
"scripts": {
"test": "vitest run",
"test:watch": "vitest",
"build": "tsup",
"clean": "rm -rf dist .turbo",
"dev": "pnpm build --watch"
}
}
}
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