@mbanq/core-sdk-js 1.0.0-alpha.11 → 1.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -34
- package/dist/chunk-GZY2CY5Q.mjs +1 -0
- package/dist/chunk-ZTU6WB3T.js +1 -0
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/{index-DR1B_Zgp.d.mts → index-DvE2ddFU.d.mts} +573 -7
- package/dist/{index-DN96wLIt.d.ts → index-vaBvDmsq.d.ts} +573 -7
- package/dist/index.d.mts +9 -13
- package/dist/index.d.ts +9 -13
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3RTZWSKG.mjs +0 -1
- package/dist/chunk-DOV4J2LB.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CreatePaymentInput, P as Payment, U as UpdatePaymentInput, a as PaymentResponse } from './index-
|
|
2
|
-
export { k as CreatePaymentInputZod, h as PaymentFilterKeyZod, o as PaymentFilterShape,
|
|
1
|
+
import { C as CreatePaymentInput, P as Payment, U as UpdatePaymentInput, a as PaymentFilters, b as PaymentResponse } from './index-vaBvDmsq.js';
|
|
2
|
+
export { q as CreatePaymentInputShape, k as CreatePaymentInputZod, h as PaymentFilterKeyZod, o as PaymentFilterShape, n as PaymentFiltersZod, e as PaymentRailType, i as PaymentRailZod, m as PaymentResponseZod, p as PaymentShape, d as PaymentStatus, g as PaymentStatusZod, f as PaymentType, j as PaymentTypeZod, S as SortOrderZod, r as UpdatePaymentInputShape, l as UpdatePaymentInputZod, c as createClient } from './index-vaBvDmsq.js';
|
|
3
3
|
import { M as Middleware, C as Command } from './config.d-CyK6ZM6s.js';
|
|
4
4
|
export { a as Config } from './config.d-CyK6ZM6s.js';
|
|
5
5
|
export { G as GetClientData, c as GraphQL, S as SendAuthorizationToCore, U as UpdateCardID, a as UpdateClient, b as UpdateClientIdentifier } from './index-DXK5OdKW.js';
|
|
@@ -44,18 +44,14 @@ declare const UpdatePayment: (params: {
|
|
|
44
44
|
payment: UpdatePaymentInput;
|
|
45
45
|
tenantId?: string;
|
|
46
46
|
}, Payment>;
|
|
47
|
-
declare const GetPayments: (params
|
|
47
|
+
declare const GetPayments: (params: PaymentFilters, configuration: {
|
|
48
48
|
tenantId?: string;
|
|
49
|
-
}) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
limit: (value: number) => /*elided*/ any;
|
|
55
|
-
offset: (value: number) => /*elided*/ any;
|
|
56
|
-
execute: () => Command<any, PaymentResponse>;
|
|
49
|
+
}) => Command<{
|
|
50
|
+
params: PaymentFilters;
|
|
51
|
+
configuration: {
|
|
52
|
+
tenantId?: string;
|
|
57
53
|
};
|
|
58
|
-
}
|
|
54
|
+
}, PaymentResponse>;
|
|
59
55
|
|
|
60
56
|
interface ApiError {
|
|
61
57
|
name: string;
|
|
@@ -68,4 +64,4 @@ interface ApiError {
|
|
|
68
64
|
|
|
69
65
|
declare const isCommandError: (error: unknown) => error is ApiError;
|
|
70
66
|
|
|
71
|
-
export { Command, CreatePayment, CreatePaymentInput, GetPayment, GetPayments, type Logger, type MetricsClient, Middleware, Payment, PaymentResponse, UpdatePayment, UpdatePaymentInput, createLoggingMiddleware, createMetricsMiddleware, isCommandError };
|
|
67
|
+
export { Command, CreatePayment, CreatePaymentInput, GetPayment, GetPayments, type Logger, type MetricsClient, Middleware, Payment, PaymentFilters, PaymentResponse, UpdatePayment, UpdatePaymentInput, createLoggingMiddleware, createMetricsMiddleware, isCommandError };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZTU6WB3Tjs = require('./chunk-ZTU6WB3T.js');var _chunkBDI3SHA2js = require('./chunk-BDI3SHA2.js');var _chunkOGW7GTJPjs = require('./chunk-OGW7GTJP.js');var N=(t=console)=>({before:async e=>{t.info(`Executing ${e.metadata.commandName}`,{input:e.input,metadata:e.metadata})},after:async(e,a)=>{t.info(`Completed ${e.metadata.commandName}`,{response:a,metadata:e.metadata})},onError:async(e,a)=>{t.error(`Error in ${e.metadata.commandName}`,{error:a,input:e.input,metadata:e.metadata})}});var v=t=>({before:async e=>{t.incrementCounter(`${e.metadata.commandName}_started`)},after:async e=>{t.incrementCounter(`${e.metadata.commandName}_completed`)},onError:async(e,a)=>{t.incrementCounter(`${e.metadata.commandName}_error`),t.recordError&&typeof t.recordError=="function"&&t.recordError(a)}});exports.CreatePayment = _chunkZTU6WB3Tjs.n; exports.CreatePaymentInputShape = _chunkZTU6WB3Tjs.i; exports.CreatePaymentInputZod = _chunkZTU6WB3Tjs.j; exports.GetClientData = _chunkBDI3SHA2js.c; exports.GetPayment = _chunkZTU6WB3Tjs.o; exports.GetPayments = _chunkZTU6WB3Tjs.q; exports.GraphQL = _chunkBDI3SHA2js.f; exports.PaymentFilterKeyZod = _chunkZTU6WB3Tjs.a; exports.PaymentFilterShape = _chunkZTU6WB3Tjs.f; exports.PaymentFiltersZod = _chunkZTU6WB3Tjs.g; exports.PaymentRailZod = _chunkZTU6WB3Tjs.c; exports.PaymentResponseZod = _chunkZTU6WB3Tjs.m; exports.PaymentShape = _chunkZTU6WB3Tjs.h; exports.PaymentStatusZod = _chunkZTU6WB3Tjs.b; exports.PaymentTypeZod = _chunkZTU6WB3Tjs.d; exports.SendAuthorizationToCore = _chunkBDI3SHA2js.a; exports.SortOrderZod = _chunkZTU6WB3Tjs.e; exports.UpdateCardID = _chunkBDI3SHA2js.b; exports.UpdateClient = _chunkBDI3SHA2js.d; exports.UpdateClientIdentifier = _chunkBDI3SHA2js.e; exports.UpdatePayment = _chunkZTU6WB3Tjs.p; exports.UpdatePaymentInputShape = _chunkZTU6WB3Tjs.k; exports.UpdatePaymentInputZod = _chunkZTU6WB3Tjs.l; exports.createClient = _chunkZTU6WB3Tjs.r; exports.createLoggingMiddleware = N; exports.createMetricsMiddleware = v; exports.isCommandError = _chunkOGW7GTJPjs.b;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n,b as o,c as m,d,e as
|
|
1
|
+
import{a as n,b as o,c as m,d,e as p,f as i,g as s,h as y,i as c,j as P,k as f,l as u,m as g,n as l,o as S,p as C,q as x,r as h}from"./chunk-GZY2CY5Q.mjs";import{a as w,b as M,c as E,d as I,e as Z,f as U}from"./chunk-5PEETHWV.mjs";import{b as r}from"./chunk-RX3BFHHX.mjs";var N=(t=console)=>({before:async e=>{t.info(`Executing ${e.metadata.commandName}`,{input:e.input,metadata:e.metadata})},after:async(e,a)=>{t.info(`Completed ${e.metadata.commandName}`,{response:a,metadata:e.metadata})},onError:async(e,a)=>{t.error(`Error in ${e.metadata.commandName}`,{error:a,input:e.input,metadata:e.metadata})}});var v=t=>({before:async e=>{t.incrementCounter(`${e.metadata.commandName}_started`)},after:async e=>{t.incrementCounter(`${e.metadata.commandName}_completed`)},onError:async(e,a)=>{t.incrementCounter(`${e.metadata.commandName}_error`),t.recordError&&typeof t.recordError=="function"&&t.recordError(a)}});export{l as CreatePayment,c as CreatePaymentInputShape,P as CreatePaymentInputZod,E as GetClientData,S as GetPayment,x as GetPayments,U as GraphQL,n as PaymentFilterKeyZod,i as PaymentFilterShape,s as PaymentFiltersZod,m as PaymentRailZod,g as PaymentResponseZod,y as PaymentShape,o as PaymentStatusZod,d as PaymentTypeZod,w as SendAuthorizationToCore,p as SortOrderZod,M as UpdateCardID,I as UpdateClient,Z as UpdateClientIdentifier,C as UpdatePayment,f as UpdatePaymentInputShape,u as UpdatePaymentInputZod,h as createClient,N as createLoggingMiddleware,v as createMetricsMiddleware,r as isCommandError};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbanq/core-sdk-js",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.13",
|
|
4
4
|
"description": "A comprehensive JavaScript SDK for interacting with the Mbanq payment API. Features type-safe payment operations, multi-tenant support, and Zod validation.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
package/dist/chunk-3RTZWSKG.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as m,c as y,d as u}from"./chunk-RX3BFHHX.mjs";var E=t=>{let n=[];if(!t.baseUrl)n.push("baseUrl is required");else if(typeof t.baseUrl!="string")n.push("baseUrl must be a string");else try{new URL(t.baseUrl)}catch{n.push("baseUrl must be a valid URL")}return t.axiosConfig?.timeout!==void 0&&(typeof t.axiosConfig.timeout!="number"||t.axiosConfig.timeout<0)&&n.push("timeout must be a positive number"),n};import{z as e}from"zod";var N=e.enum(["originatorName","originatorAccount","originatorBankRoutingCode","recipientName","recipientAccount","recipientBankRoutingCode","reference","traceNumber","externalId","clientId","dateFormat","locale","originatedBy","paymentRail","paymentType","fromValueDate","toValueDate","fromExecuteDate","toExecuteDate","status","fromReturnDate","toReturnDate","isSettlement","orderBy","sortOrder"]),f=e.enum(["DRAFT","AML_SCREENING","AML_REJECTED","EXECUTION_SCHEDULED","EXECUTION_PROCESSING","EXECUTION_SUCCESS","EXECUTION_FAILURE","RETURNED","CANCELLED","COMPLIANCE_FAILURE","DELETED","UNKNOWN"]),x=e.enum(["ACH","SAMEDAYACH","WIRE","SWIFT","INTERNAL","FXPAY","CARD"]),I=e.enum(["CREDIT","DEBIT"]),O=e.enum(["ASC","DESC"]),ke=N.options,Be=f.options,Ue=x.options,Fe=I.options,_e=O.options,w=t=>N.parse(t),k=t=>f.parse(t),B=t=>x.parse(t),U=t=>I.parse(t),F=t=>O.parse(t),_=e.string().min(1),L=e.string().min(1),z=e.string().min(1),V=e.string().min(1),j=e.string().min(1),$=e.string().min(1),M=e.string().min(1),G=e.string().min(1),q=e.string().min(1),K=e.union([e.string(),e.number()]),H=e.string(),Y=e.string(),W=e.string(),D=e.string(),T=e.string(),A=e.string(),X=e.boolean(),J=e.string(),Q=t=>_.parse(t),Z=t=>L.parse(t),ee=t=>z.parse(t),te=t=>V.parse(t),ne=t=>j.parse(t),ae=t=>$.parse(t),re=t=>M.parse(t),oe=t=>G.parse(t),ie=t=>q.parse(t),se=t=>K.parse(t),pe=t=>H.parse(t),ce=t=>Y.parse(t),me=t=>W.parse(t),de=t=>D.parse(t),ye=t=>T.parse(t),ue=t=>A.parse(t),le=t=>X.parse(t),ge=t=>J.parse(t),Ee={originatorName:_.optional(),originatorAccount:L.optional(),originatorBankRoutingCode:z.optional(),recipientName:V.optional(),recipientAccount:j.optional(),recipientBankRoutingCode:$.optional(),reference:M.optional(),traceNumber:G.optional(),externalId:q.optional(),clientId:K.optional(),dateFormat:H.optional(),locale:Y.optional(),originatedBy:W.optional(),paymentRail:x.optional(),paymentType:I.optional(),fromValueDate:D.optional(),toValueDate:D.optional(),fromExecuteDate:T.optional(),toExecuteDate:T.optional(),status:f.optional(),fromReturnDate:A.optional(),toReturnDate:A.optional(),isSettlement:X.optional(),orderBy:J.optional(),sortOrder:O.optional(),limit:e.number().positive().optional(),offset:e.number().min(0).optional()},Le=e.object(Ee).partial();var fe=e.object({id:e.number(),clientId:e.number(),amount:e.number().positive(),correlationId:e.string(),paymentType:I,paymentRail:x,recipient:e.object({cardId:e.string().optional(),recipientType:e.string(),address:e.object({line1:e.string().optional(),line2:e.string().optional(),stateCode:e.string().optional(),countryCode:e.string(),postalCode:e.string().optional()}),name:e.string()}),originator:e.object({accountId:e.string().optional(),recipientType:e.string(),address:e.object({line1:e.string().optional(),line2:e.string().optional(),stateCode:e.string().optional(),countryCode:e.string(),postalCode:e.string().optional()}),name:e.string()}),executedAt:e.string(),createdAt:e.string(),externalId:e.string(),status:f,paymentRailMetaData:e.record(e.string(),e.any()).optional(),currencyData:e.object({code:e.string(),name:e.string(),decimalPlaces:e.number(),displaySymbol:e.string(),nameCode:e.string(),currencyCodeInDigit:e.number(),isBaseCurrency:e.boolean()}),currency:e.string().min(3).max(3)}).catchall(e.any()),xe=e.object({streetAddress:e.string().optional(),city:e.string().optional(),state:e.string().optional(),country:e.string().optional(),postalCode:e.string().optional()}).optional(),ve=e.object({name:e.string().optional(),identifier:e.string().optional(),address:xe}).optional(),v=e.object({name:e.string(),identifier:e.string(),accountType:e.enum(["CHECKING","SAVINGS"]).optional(),address:xe,agent:ve}),De=e.object({amount:e.number().positive(),currency:e.string().min(3).max(3),paymentRail:x,paymentType:I,debtor:v,creditor:v,clientId:e.string().optional(),correspondent:v.optional(),exchangeRate:e.number().positive().optional(),externalId:e.string().optional(),reference:e.union([e.string(),e.array(e.string())]).optional(),paymentRailMetaData:e.record(e.string(),e.any()).optional(),chargeBearer:e.enum(["OUR","BEN","SHA"]).optional(),purposeCode:e.string().optional(),valueDate:e.string().optional(),executionDate:e.string().optional()}).catchall(e.any()).refine(t=>(t.paymentRail==="WIRE"||t.paymentRail==="SWIFT")&&t.creditor?t.creditor.address&&t.creditor.address.state&&t.creditor.address.country:!0,{message:"For WIRE transfers, recipient address with state and country is mandatory"}),Te=e.object({amount:e.number().positive().optional(),correspondent:e.object({name:e.string().optional(),identifier:e.string().optional(),accountType:e.string().optional()}).optional(),creditor:e.object({name:e.string().optional(),identifier:e.string().optional(),accountType:e.string().optional(),agent:e.object({name:e.string().optional(),identifier:e.string().optional()}).optional()}).optional(),debtor:e.object({name:e.string().optional(),identifier:e.string().optional(),accountType:e.string().optional(),agent:e.object({name:e.string().optional(),identifier:e.string().optional()}).optional()}).optional(),exchangeRate:e.number().positive().optional(),externalId:e.string().optional(),errorCode:e.string().optional(),errorMessage:e.string().optional(),reference:e.union([e.string(),e.array(e.string())]).optional(),paymentRailMetaData:e.record(e.string(),e.any()).optional(),status:f.optional()}).catchall(e.any()),ze=e.object({totalFilteredRecords:e.number(),pageItems:e.array(fe)}),C=t=>fe.parse(t),Ie=t=>De.parse(t),he=t=>Te.parse(t);import{ZodError as R}from"zod";var Ae=t=>{try{w(t)}catch(n){throw n instanceof R?m({message:`Invalid filter key: '${t}'. ${n.message}`,code:"invalid_filter_key"}):n}},Oe=(t,n)=>{try{switch(t){case"status":k(n);break;case"paymentRail":B(n);break;case"paymentType":U(n);break;case"sortOrder":F(n);break;case"originatorName":Q(n);break;case"originatorAccount":Z(n);break;case"originatorBankRoutingCode":ee(n);break;case"recipientName":te(n);break;case"recipientAccount":ne(n);break;case"recipientBankRoutingCode":ae(n);break;case"reference":re(n);break;case"traceNumber":oe(n);break;case"externalId":ie(n);break;case"clientId":se(n);break;case"dateFormat":pe(n);break;case"locale":ce(n);break;case"originatedBy":me(n);break;case"fromValueDate":case"toValueDate":de(n);break;case"fromExecuteDate":case"toExecuteDate":ye(n);break;case"fromReturnDate":case"toReturnDate":ue(n);break;case"isSettlement":le(n);break;case"orderBy":ge(n);break;default:break}}catch(o){throw o instanceof R?m({message:`Invalid value for '${t}': '${n}'. ${o.message}`,code:`invalid_${t}_value`}):o}},Ce=t=>({input:t,metadata:{commandName:"CreatePayment",path:"/v1/payments",method:"POST"},execute:async n=>{try{Ie(t.payment)}catch(a){throw a instanceof R?m({message:`Invalid payment data: ${a.message}`,code:"invalid_payment_input"}):a}t.tenantId&&(n.tenantId=t.tenantId);let o=await u(n);try{let a=await o.post("/v1/payments",t.payment);return C(a.data)}catch(a){y(a)}}}),Se=t=>({input:t,metadata:{commandName:"GetPayment",path:`/v1/payments/${t.id}`,method:"GET"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let o=await u(n);try{let a=await o.get(`/v1/payments/${t.id}`);return C(a.data)}catch(a){y(a)}}}),Re=t=>({input:t,metadata:{commandName:"UpdatePayment",path:`/v1/payments/${t.id}`,method:"PUT"},execute:async n=>{try{he(t.payment)}catch(a){throw a instanceof R?m({message:`Invalid payment update data: ${a.message}`,code:"invalid_payment_update_input"}):a}t.tenantId&&(n.tenantId=t.tenantId);let o=await u(n);try{let a=await o.put(`/v1/payments/${t.id}`,t.payment);return C(a.data)}catch(a){y(a)}}}),S=(t,n,o,a)=>({where:c=>(Ae(c),{eq:r=>(Oe(c,r),S({...t,[c]:r},n,o,a))}),limit:c=>S(t,c,o,a),offset:c=>S(t,n,c,a),execute:()=>{let c={...t,limit:n||200,offset:o||0};return{input:{filters:t,limit:n,offset:o,tenantId:a},metadata:{commandName:"GetPayments",path:"/v1/payments",method:"GET"},execute:async r=>{a&&(r.tenantId=a);let i=await u(r);try{return(await i.get("/v1/payments",{params:c})).data}catch(s){y(s)}}}}}),be=t=>({list:()=>S({},void 0,void 0,t?.tenantId)}),Pe=t=>({input:t,metadata:{commandName:"DeletePayment",path:`/v1/payments/${t.id}`,method:"DELETE"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let o=await u(n);try{await o.delete(`/v1/payments/${t.id}`)}catch(a){y(a)}}});var We=t=>{let n=E(t);if(n.length>0)throw m({message:`Invalid configuration: ${n.join(", ")}`,code:"invalid_config"});let o=async(r,i,s)=>{if(t.middlewares)for(let p of t.middlewares)r==="before"&&p.before?await p.before(i):r==="after"&&p.after?await p.after(i,s):r==="onError"&&p.onError&&await p.onError(i,s)},a={...t},d=async r=>{try{await o("before",r);let i=await r.execute(a);return await o("after",r,i),i}catch(i){throw await o("onError",r,i),i}},b=r=>{let i=r||a.tenantId;return{payment:{create:s=>{let p=Ce({payment:s,tenantId:i});return{execute:async()=>d(p)}},get:s=>{let p=Se({id:s,tenantId:i});return{execute:async()=>d(p)}},update:(s,p)=>{let l=Re({id:s,payment:p,tenantId:i});return{execute:async()=>d(l)}},delete:s=>{let p=Pe({id:s,tenantId:i});return{execute:async()=>d(p)}},list:()=>{let p=be({tenantId:i}).list(),l=h=>({where:h.where,limit:g=>{let P=h.limit(g);return l(P)},offset:g=>{let P=h.offset(g);return l(P)},execute:async()=>{let g=h.execute();return d(g)}});return l(p)}}}};return{setConfig:r=>{a=r},updateConfig:r=>{let i={...a,...r,axiosConfig:{...a.axiosConfig,...r.axiosConfig,headers:{...a.axiosConfig?.headers,...r.axiosConfig?.headers}}},s=E(i);if(s.length>0)throw m({message:`Invalid configuration: ${s.join(", ")}`,code:"invalid_config"});a=i},resetConfig:()=>{a=t},request:d,tenant:r=>b(r),...b()}};export{N as a,f as b,x as c,I as d,O as e,Ee as f,Le as g,De as h,Te as i,ze as j,Ce as k,Se as l,Re as m,be as n,We as o};
|
package/dist/chunk-DOV4J2LB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkOGW7GTJPjs = require('./chunk-OGW7GTJP.js');var E=t=>{let n=[];if(!t.baseUrl)n.push("baseUrl is required");else if(typeof t.baseUrl!="string")n.push("baseUrl must be a string");else try{new URL(t.baseUrl)}catch (e2){n.push("baseUrl must be a valid URL")}return _optionalChain([t, 'access', _2 => _2.axiosConfig, 'optionalAccess', _3 => _3.timeout])!==void 0&&(typeof t.axiosConfig.timeout!="number"||t.axiosConfig.timeout<0)&&n.push("timeout must be a positive number"),n};var _zod = require('zod');var N=_zod.z.enum(["originatorName","originatorAccount","originatorBankRoutingCode","recipientName","recipientAccount","recipientBankRoutingCode","reference","traceNumber","externalId","clientId","dateFormat","locale","originatedBy","paymentRail","paymentType","fromValueDate","toValueDate","fromExecuteDate","toExecuteDate","status","fromReturnDate","toReturnDate","isSettlement","orderBy","sortOrder"]),f= exports.b =_zod.z.enum(["DRAFT","AML_SCREENING","AML_REJECTED","EXECUTION_SCHEDULED","EXECUTION_PROCESSING","EXECUTION_SUCCESS","EXECUTION_FAILURE","RETURNED","CANCELLED","COMPLIANCE_FAILURE","DELETED","UNKNOWN"]),x= exports.c =_zod.z.enum(["ACH","SAMEDAYACH","WIRE","SWIFT","INTERNAL","FXPAY","CARD"]),I= exports.d =_zod.z.enum(["CREDIT","DEBIT"]),O= exports.e =_zod.z.enum(["ASC","DESC"]),ke=N.options,Be=f.options,Ue=x.options,Fe=I.options,_e=O.options,w=t=>N.parse(t),k=t=>f.parse(t),B=t=>x.parse(t),U=t=>I.parse(t),F=t=>O.parse(t),_=_zod.z.string().min(1),L=_zod.z.string().min(1),z=_zod.z.string().min(1),V=_zod.z.string().min(1),j=_zod.z.string().min(1),$=_zod.z.string().min(1),M=_zod.z.string().min(1),G=_zod.z.string().min(1),q=_zod.z.string().min(1),K=_zod.z.union([_zod.z.string(),_zod.z.number()]),H=_zod.z.string(),Y=_zod.z.string(),W=_zod.z.string(),D=_zod.z.string(),T=_zod.z.string(),A=_zod.z.string(),X=_zod.z.boolean(),J=_zod.z.string(),Q=t=>_.parse(t),Z=t=>L.parse(t),ee=t=>z.parse(t),te=t=>V.parse(t),ne=t=>j.parse(t),ae=t=>$.parse(t),re=t=>M.parse(t),oe=t=>G.parse(t),ie=t=>q.parse(t),se=t=>K.parse(t),pe=t=>H.parse(t),ce=t=>Y.parse(t),me=t=>W.parse(t),de=t=>D.parse(t),ye=t=>T.parse(t),ue=t=>A.parse(t),le=t=>X.parse(t),ge=t=>J.parse(t),Ee= exports.f ={originatorName:_.optional(),originatorAccount:L.optional(),originatorBankRoutingCode:z.optional(),recipientName:V.optional(),recipientAccount:j.optional(),recipientBankRoutingCode:$.optional(),reference:M.optional(),traceNumber:G.optional(),externalId:q.optional(),clientId:K.optional(),dateFormat:H.optional(),locale:Y.optional(),originatedBy:W.optional(),paymentRail:x.optional(),paymentType:I.optional(),fromValueDate:D.optional(),toValueDate:D.optional(),fromExecuteDate:T.optional(),toExecuteDate:T.optional(),status:f.optional(),fromReturnDate:A.optional(),toReturnDate:A.optional(),isSettlement:X.optional(),orderBy:J.optional(),sortOrder:O.optional(),limit:_zod.z.number().positive().optional(),offset:_zod.z.number().min(0).optional()},Le= exports.g =_zod.z.object(Ee).partial();var fe=_zod.z.object({id:_zod.z.number(),clientId:_zod.z.number(),amount:_zod.z.number().positive(),correlationId:_zod.z.string(),paymentType:I,paymentRail:x,recipient:_zod.z.object({cardId:_zod.z.string().optional(),recipientType:_zod.z.string(),address:_zod.z.object({line1:_zod.z.string().optional(),line2:_zod.z.string().optional(),stateCode:_zod.z.string().optional(),countryCode:_zod.z.string(),postalCode:_zod.z.string().optional()}),name:_zod.z.string()}),originator:_zod.z.object({accountId:_zod.z.string().optional(),recipientType:_zod.z.string(),address:_zod.z.object({line1:_zod.z.string().optional(),line2:_zod.z.string().optional(),stateCode:_zod.z.string().optional(),countryCode:_zod.z.string(),postalCode:_zod.z.string().optional()}),name:_zod.z.string()}),executedAt:_zod.z.string(),createdAt:_zod.z.string(),externalId:_zod.z.string(),status:f,paymentRailMetaData:_zod.z.record(_zod.z.string(),_zod.z.any()).optional(),currencyData:_zod.z.object({code:_zod.z.string(),name:_zod.z.string(),decimalPlaces:_zod.z.number(),displaySymbol:_zod.z.string(),nameCode:_zod.z.string(),currencyCodeInDigit:_zod.z.number(),isBaseCurrency:_zod.z.boolean()}),currency:_zod.z.string().min(3).max(3)}).catchall(_zod.z.any()),xe=_zod.z.object({streetAddress:_zod.z.string().optional(),city:_zod.z.string().optional(),state:_zod.z.string().optional(),country:_zod.z.string().optional(),postalCode:_zod.z.string().optional()}).optional(),ve=_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional(),address:xe}).optional(),v=_zod.z.object({name:_zod.z.string(),identifier:_zod.z.string(),accountType:_zod.z.enum(["CHECKING","SAVINGS"]).optional(),address:xe,agent:ve}),De= exports.h =_zod.z.object({amount:_zod.z.number().positive(),currency:_zod.z.string().min(3).max(3),paymentRail:x,paymentType:I,debtor:v,creditor:v,clientId:_zod.z.string().optional(),correspondent:v.optional(),exchangeRate:_zod.z.number().positive().optional(),externalId:_zod.z.string().optional(),reference:_zod.z.union([_zod.z.string(),_zod.z.array(_zod.z.string())]).optional(),paymentRailMetaData:_zod.z.record(_zod.z.string(),_zod.z.any()).optional(),chargeBearer:_zod.z.enum(["OUR","BEN","SHA"]).optional(),purposeCode:_zod.z.string().optional(),valueDate:_zod.z.string().optional(),executionDate:_zod.z.string().optional()}).catchall(_zod.z.any()).refine(t=>(t.paymentRail==="WIRE"||t.paymentRail==="SWIFT")&&t.creditor?t.creditor.address&&t.creditor.address.state&&t.creditor.address.country:!0,{message:"For WIRE transfers, recipient address with state and country is mandatory"}),Te= exports.i =_zod.z.object({amount:_zod.z.number().positive().optional(),correspondent:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional(),accountType:_zod.z.string().optional()}).optional(),creditor:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional(),accountType:_zod.z.string().optional(),agent:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional()}).optional()}).optional(),debtor:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional(),accountType:_zod.z.string().optional(),agent:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional()}).optional()}).optional(),exchangeRate:_zod.z.number().positive().optional(),externalId:_zod.z.string().optional(),errorCode:_zod.z.string().optional(),errorMessage:_zod.z.string().optional(),reference:_zod.z.union([_zod.z.string(),_zod.z.array(_zod.z.string())]).optional(),paymentRailMetaData:_zod.z.record(_zod.z.string(),_zod.z.any()).optional(),status:f.optional()}).catchall(_zod.z.any()),ze= exports.j =_zod.z.object({totalFilteredRecords:_zod.z.number(),pageItems:_zod.z.array(fe)}),C=t=>fe.parse(t),Ie=t=>De.parse(t),he=t=>Te.parse(t);var Ae=t=>{try{w(t)}catch(n){throw n instanceof _zod.ZodError?_chunkOGW7GTJPjs.a.call(void 0, {message:`Invalid filter key: '${t}'. ${n.message}`,code:"invalid_filter_key"}):n}},Oe=(t,n)=>{try{switch(t){case"status":k(n);break;case"paymentRail":B(n);break;case"paymentType":U(n);break;case"sortOrder":F(n);break;case"originatorName":Q(n);break;case"originatorAccount":Z(n);break;case"originatorBankRoutingCode":ee(n);break;case"recipientName":te(n);break;case"recipientAccount":ne(n);break;case"recipientBankRoutingCode":ae(n);break;case"reference":re(n);break;case"traceNumber":oe(n);break;case"externalId":ie(n);break;case"clientId":se(n);break;case"dateFormat":pe(n);break;case"locale":ce(n);break;case"originatedBy":me(n);break;case"fromValueDate":case"toValueDate":de(n);break;case"fromExecuteDate":case"toExecuteDate":ye(n);break;case"fromReturnDate":case"toReturnDate":ue(n);break;case"isSettlement":le(n);break;case"orderBy":ge(n);break;default:break}}catch(o){throw o instanceof _zod.ZodError?_chunkOGW7GTJPjs.a.call(void 0, {message:`Invalid value for '${t}': '${n}'. ${o.message}`,code:`invalid_${t}_value`}):o}},Ce= exports.k =t=>({input:t,metadata:{commandName:"CreatePayment",path:"/v1/payments",method:"POST"},execute:async n=>{try{Ie(t.payment)}catch(a){throw a instanceof _zod.ZodError?_chunkOGW7GTJPjs.a.call(void 0, {message:`Invalid payment data: ${a.message}`,code:"invalid_payment_input"}):a}t.tenantId&&(n.tenantId=t.tenantId);let o=await _chunkOGW7GTJPjs.d.call(void 0, n);try{let a=await o.post("/v1/payments",t.payment);return C(a.data)}catch(a){_chunkOGW7GTJPjs.c.call(void 0, a)}}}),Se= exports.l =t=>({input:t,metadata:{commandName:"GetPayment",path:`/v1/payments/${t.id}`,method:"GET"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let o=await _chunkOGW7GTJPjs.d.call(void 0, n);try{let a=await o.get(`/v1/payments/${t.id}`);return C(a.data)}catch(a){_chunkOGW7GTJPjs.c.call(void 0, a)}}}),Re= exports.m =t=>({input:t,metadata:{commandName:"UpdatePayment",path:`/v1/payments/${t.id}`,method:"PUT"},execute:async n=>{try{he(t.payment)}catch(a){throw a instanceof _zod.ZodError?_chunkOGW7GTJPjs.a.call(void 0, {message:`Invalid payment update data: ${a.message}`,code:"invalid_payment_update_input"}):a}t.tenantId&&(n.tenantId=t.tenantId);let o=await _chunkOGW7GTJPjs.d.call(void 0, n);try{let a=await o.put(`/v1/payments/${t.id}`,t.payment);return C(a.data)}catch(a){_chunkOGW7GTJPjs.c.call(void 0, a)}}}),S=(t,n,o,a)=>({where:c=>(Ae(c),{eq:r=>(Oe(c,r),S({...t,[c]:r},n,o,a))}),limit:c=>S(t,c,o,a),offset:c=>S(t,n,c,a),execute:()=>{let c={...t,limit:n||200,offset:o||0};return{input:{filters:t,limit:n,offset:o,tenantId:a},metadata:{commandName:"GetPayments",path:"/v1/payments",method:"GET"},execute:async r=>{a&&(r.tenantId=a);let i=await _chunkOGW7GTJPjs.d.call(void 0, r);try{return(await i.get("/v1/payments",{params:c})).data}catch(s){_chunkOGW7GTJPjs.c.call(void 0, s)}}}}}),be= exports.n =t=>({list:()=>S({},void 0,void 0,_optionalChain([t, 'optionalAccess', _4 => _4.tenantId]))}),Pe=t=>({input:t,metadata:{commandName:"DeletePayment",path:`/v1/payments/${t.id}`,method:"DELETE"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let o=await _chunkOGW7GTJPjs.d.call(void 0, n);try{await o.delete(`/v1/payments/${t.id}`)}catch(a){_chunkOGW7GTJPjs.c.call(void 0, a)}}});var We=t=>{let n=E(t);if(n.length>0)throw _chunkOGW7GTJPjs.a.call(void 0, {message:`Invalid configuration: ${n.join(", ")}`,code:"invalid_config"});let o=async(r,i,s)=>{if(t.middlewares)for(let p of t.middlewares)r==="before"&&p.before?await p.before(i):r==="after"&&p.after?await p.after(i,s):r==="onError"&&p.onError&&await p.onError(i,s)},a={...t},d=async r=>{try{await o("before",r);let i=await r.execute(a);return await o("after",r,i),i}catch(i){throw await o("onError",r,i),i}},b=r=>{let i=r||a.tenantId;return{payment:{create:s=>{let p=Ce({payment:s,tenantId:i});return{execute:async()=>d(p)}},get:s=>{let p=Se({id:s,tenantId:i});return{execute:async()=>d(p)}},update:(s,p)=>{let l=Re({id:s,payment:p,tenantId:i});return{execute:async()=>d(l)}},delete:s=>{let p=Pe({id:s,tenantId:i});return{execute:async()=>d(p)}},list:()=>{let p=be({tenantId:i}).list(),l=h=>({where:h.where,limit:g=>{let P=h.limit(g);return l(P)},offset:g=>{let P=h.offset(g);return l(P)},execute:async()=>{let g=h.execute();return d(g)}});return l(p)}}}};return{setConfig:r=>{a=r},updateConfig:r=>{let i={...a,...r,axiosConfig:{...a.axiosConfig,...r.axiosConfig,headers:{..._optionalChain([a, 'access', _5 => _5.axiosConfig, 'optionalAccess', _6 => _6.headers]),..._optionalChain([r, 'access', _7 => _7.axiosConfig, 'optionalAccess', _8 => _8.headers])}}},s=E(i);if(s.length>0)throw _chunkOGW7GTJPjs.a.call(void 0, {message:`Invalid configuration: ${s.join(", ")}`,code:"invalid_config"});a=i},resetConfig:()=>{a=t},request:d,tenant:r=>b(r),...b()}};exports.a = N; exports.b = f; exports.c = x; exports.d = I; exports.e = O; exports.f = Ee; exports.g = Le; exports.h = De; exports.i = Te; exports.j = ze; exports.k = Ce; exports.l = Se; exports.m = Re; exports.n = be; exports.o = We;
|