@getvolume/volume-shared
Advanced tools
Comparing version 0.0.14 to 0.0.16
@@ -59,3 +59,3 @@ interface IVolumeContext { | ||
*/ | ||
meta?: {}; | ||
meta?: object; | ||
} | ||
@@ -101,4 +101,3 @@ /** | ||
*/ | ||
interface FeatureFlags { | ||
} | ||
type FeatureFlags = object; | ||
interface Institution { | ||
@@ -161,3 +160,10 @@ id: string; | ||
errorDescription?: string; | ||
meta?: PaymentStatusMetadata; | ||
} | ||
interface PaymentStatusMetadata { | ||
paymentId?: string; | ||
merchantPaymentId?: string; | ||
reference?: string; | ||
metadata?: object; | ||
} | ||
declare enum PaymentStatus { | ||
@@ -209,2 +215,2 @@ NEW = "NEW", | ||
export { AgentType, Endpoints, ErrorMessage, FeatureFlags, INTEGRATION_API_URL, IVolumeContext, Institution, InstitutionMetadata, LIVE_API_URL, LOCAL_API_URL, Payment, PaymentRequest, PaymentStatus, PaymentStatusResponse, ResponseWrapper, SANDBOX_API_URL, UseVolume, VolumeEnvironment, VolumeError, VolumeErrorContextType, VolumeEvent, VolumeEventType, apiUrlFromVolumeEnvironment, numberToCurrency }; | ||
export { AgentType, Endpoints, type ErrorMessage, type FeatureFlags, INTEGRATION_API_URL, type IVolumeContext, type Institution, type InstitutionMetadata, LIVE_API_URL, LOCAL_API_URL, type Payment, type PaymentRequest, PaymentStatus, type PaymentStatusMetadata, type PaymentStatusResponse, type ResponseWrapper, SANDBOX_API_URL, type UseVolume, type VolumeEnvironment, VolumeError, VolumeErrorContextType, type VolumeEvent, VolumeEventType, apiUrlFromVolumeEnvironment, numberToCurrency }; |
@@ -1,134 +0,1 @@ | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
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); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
AgentType: () => AgentType, | ||
Endpoints: () => Endpoints, | ||
INTEGRATION_API_URL: () => INTEGRATION_API_URL, | ||
LIVE_API_URL: () => LIVE_API_URL, | ||
LOCAL_API_URL: () => LOCAL_API_URL, | ||
PaymentStatus: () => PaymentStatus, | ||
SANDBOX_API_URL: () => SANDBOX_API_URL, | ||
VolumeError: () => VolumeError, | ||
VolumeErrorContextType: () => VolumeErrorContextType, | ||
VolumeEventType: () => VolumeEventType, | ||
apiUrlFromVolumeEnvironment: () => apiUrlFromVolumeEnvironment, | ||
numberToCurrency: () => numberToCurrency | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
// src/types.ts | ||
var VolumeEventType = /* @__PURE__ */ ((VolumeEventType2) => { | ||
VolumeEventType2["PaymentInitiated"] = "PAYMENT_INITIATED"; | ||
VolumeEventType2["PaymentAuthorizedSDP"] = "PAYMENT_AUTHORIZED_SDP"; | ||
VolumeEventType2["PaymentError"] = "PAYMENT_ERROR"; | ||
VolumeEventType2["GenericError"] = "GENERIC_ERROR"; | ||
VolumeEventType2["SetShoppedId"] = "SET_SHOPPER_ID"; | ||
VolumeEventType2["SupportedDevice"] = "SUPPORTED_DEVICE"; | ||
VolumeEventType2["InstitutionsFetched"] = "INSTITUTIONS_FETCHED"; | ||
VolumeEventType2["CancelUrlFetched"] = "CANCEL_URL_FETCHED"; | ||
VolumeEventType2["ConfirmPageLoaded"] = "CONFIRM_PAGE_LOADED"; | ||
VolumeEventType2["BankSelectionLoaded"] = "BANK_SELECTION_LOADED"; | ||
VolumeEventType2["AwaitingAuthorisation"] = "AWAITING_AUTHORISATION"; | ||
VolumeEventType2["BankLaunchedLoaded"] = "BANK_LAUNCHED_LOADED"; | ||
return VolumeEventType2; | ||
})(VolumeEventType || {}); | ||
var AgentType = /* @__PURE__ */ ((AgentType2) => { | ||
AgentType2["WEB_BROWSER"] = "WEB_BROWSER"; | ||
AgentType2["MOBILE_APPLICATION"] = "MOBILE_APPLICATION"; | ||
return AgentType2; | ||
})(AgentType || {}); | ||
var PaymentStatus = /* @__PURE__ */ ((PaymentStatus2) => { | ||
PaymentStatus2["NEW"] = "NEW"; | ||
PaymentStatus2["AWAITING_AUTHORIZATION"] = "AWAITING_AUTHORIZATION"; | ||
PaymentStatus2["AUTHORIZED"] = "AUTHORIZED"; | ||
PaymentStatus2["PENDING"] = "PENDING"; | ||
PaymentStatus2["COMPLETED"] = "COMPLETED"; | ||
PaymentStatus2["SETTLED"] = "SETTLED"; | ||
PaymentStatus2["FAILED"] = "FAILED"; | ||
PaymentStatus2["UNDEFINED"] = "UNDEFINED"; | ||
return PaymentStatus2; | ||
})(PaymentStatus || {}); | ||
var VolumeError = class extends Error { | ||
constructor(msg, context, httpErrorMessage) { | ||
super(msg); | ||
this.context = context; | ||
this.httpErrorMessage = httpErrorMessage; | ||
this.type = "VolumeError"; | ||
Object.setPrototypeOf(this, VolumeError.prototype); | ||
} | ||
}; | ||
var VolumeErrorContextType = /* @__PURE__ */ ((VolumeErrorContextType2) => { | ||
VolumeErrorContextType2["HTTP_CALL"] = "HTTP_CALL"; | ||
return VolumeErrorContextType2; | ||
})(VolumeErrorContextType || {}); | ||
// src/constants.ts | ||
var LOCAL_API_URL = "http://localhost:8080"; | ||
var LIVE_API_URL = "https://api.volumepay.io"; | ||
var SANDBOX_API_URL = "https://api.sandbox.volumepay.io"; | ||
var INTEGRATION_API_URL = "https://api.integration.volumepay.io"; | ||
var Endpoints = { | ||
AUTHENTICATE: "/api/authenticate", | ||
INSTITUTIONS: "/api/institutions", | ||
CREATE_PAYMENT: "/api/payments", | ||
PAYMENT_STATUS: "/api/payments/{0}/status", | ||
CANCEL_URL: "/api/merchants/applications/{0}/cancel-url" | ||
}; | ||
// src/apiUrlFromEnvironment.ts | ||
var apiUrlFromVolumeEnvironment = (volumeEnvironment) => { | ||
switch (volumeEnvironment) { | ||
case "integration": | ||
return INTEGRATION_API_URL; | ||
case "live": | ||
return LIVE_API_URL; | ||
case "sandbox": | ||
return SANDBOX_API_URL; | ||
case "local": | ||
return LOCAL_API_URL; | ||
default: | ||
return volumeEnvironment; | ||
} | ||
}; | ||
// src/index.ts | ||
var numberToCurrency = (number) => { | ||
return new Intl.NumberFormat("en-GB", { | ||
style: "currency", | ||
currency: "GBP", | ||
minimumFractionDigits: 2 | ||
}).format(number); | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
AgentType, | ||
Endpoints, | ||
INTEGRATION_API_URL, | ||
LIVE_API_URL, | ||
LOCAL_API_URL, | ||
PaymentStatus, | ||
SANDBOX_API_URL, | ||
VolumeError, | ||
VolumeErrorContextType, | ||
VolumeEventType, | ||
apiUrlFromVolumeEnvironment, | ||
numberToCurrency | ||
}); | ||
var s=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var n in e)s(t,n,{get:e[n],enumerable:!0})},L=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of T(e))!_.call(t,o)&&o!==n&&s(t,o,{get:()=>e[o],enumerable:!(i=N(e,o))||i.enumerable});return t};var R=t=>L(s({},"__esModule",{value:!0}),t);var D={};l(D,{AgentType:()=>A,Endpoints:()=>P,INTEGRATION_API_URL:()=>m,LIVE_API_URL:()=>I,LOCAL_API_URL:()=>p,PaymentStatus:()=>d,SANDBOX_API_URL:()=>E,VolumeError:()=>c,VolumeErrorContextType:()=>g,VolumeEventType:()=>u,apiUrlFromVolumeEnvironment:()=>x,numberToCurrency:()=>O});module.exports=R(D);var u=(r=>(r.PaymentInitiated="PAYMENT_INITIATED",r.PaymentAuthorizedSDP="PAYMENT_AUTHORIZED_SDP",r.PaymentError="PAYMENT_ERROR",r.GenericError="GENERIC_ERROR",r.SetShoppedId="SET_SHOPPER_ID",r.SupportedDevice="SUPPORTED_DEVICE",r.InstitutionsFetched="INSTITUTIONS_FETCHED",r.CancelUrlFetched="CANCEL_URL_FETCHED",r.ConfirmPageLoaded="CONFIRM_PAGE_LOADED",r.BankSelectionLoaded="BANK_SELECTION_LOADED",r.AwaitingAuthorisation="AWAITING_AUTHORISATION",r.BankLaunchedLoaded="BANK_LAUNCHED_LOADED",r))(u||{}),A=(n=>(n.WEB_BROWSER="WEB_BROWSER",n.MOBILE_APPLICATION="MOBILE_APPLICATION",n))(A||{}),d=(a=>(a.NEW="NEW",a.AWAITING_AUTHORIZATION="AWAITING_AUTHORIZATION",a.AUTHORIZED="AUTHORIZED",a.PENDING="PENDING",a.COMPLETED="COMPLETED",a.SETTLED="SETTLED",a.FAILED="FAILED",a.UNDEFINED="UNDEFINED",a))(d||{}),c=class t extends Error{constructor(n,i,o){super(n);this.context=i;this.httpErrorMessage=o;Object.setPrototypeOf(this,t.prototype)}type="VolumeError"},g=(e=>(e.HTTP_CALL="HTTP_CALL",e))(g||{});var p="http://localhost:8080",I="https://api.volumepay.io",E="https://api.sandbox.volumepay.io",m="https://api.integration.volumepay.io",P={AUTHENTICATE:"/api/authenticate",INSTITUTIONS:"/api/institutions",CREATE_PAYMENT:"/api/payments",PAYMENT_STATUS:"/api/payments/{0}/status",CANCEL_URL:"/api/merchants/applications/{0}/cancel-url"};var x=t=>{switch(t){case"integration":return m;case"live":return I;case"sandbox":return E;case"local":return p;default:return t}};var O=t=>new Intl.NumberFormat("en-GB",{style:"currency",currency:"GBP",minimumFractionDigits:2}).format(t);0&&(module.exports={AgentType,Endpoints,INTEGRATION_API_URL,LIVE_API_URL,LOCAL_API_URL,PaymentStatus,SANDBOX_API_URL,VolumeError,VolumeErrorContextType,VolumeEventType,apiUrlFromVolumeEnvironment,numberToCurrency}); |
{ | ||
"name": "@getvolume/volume-shared", | ||
"version": "0.0.14", | ||
"version": "0.0.16", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "tsup src/index.ts --dts", | ||
"dev": "yarn build --watch", | ||
"clean": "rm -rf dist .turbo" | ||
}, | ||
"files": [ | ||
@@ -14,6 +9,19 @@ "dist/**" | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
} | ||
}, | ||
"devDependencies": { | ||
"tsup": "^6.7.0" | ||
"tsup": "^8.0.2" | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"dev": "pnpm build --watch", | ||
"clean": "rm -rf dist .turbo" | ||
} | ||
} | ||
} |
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
18034
5
227