@m-nasser-m/paymob-sdk-eg
Version:
Paymob typescript SDK
1 lines • 22.8 kB
JavaScript
import*as e from"zod";import*as t from"zod";import*as n from"zod";import*as r from"zod";import*as i from"zod";import*as a from"zod";import*as o from"zod";import*as s from"zod";import{z as ee}from"zod";import te from"ky";import{createHmac as c}from"node:crypto";const ne=1e4,re=3,l=`https://accept.paymob.com`,ie=`${l}/unifiedcheckout/?publicKey=PUBLIC_KEY_PLACEHOLDER&clientSecret=CLIENT_SECRET_PLACEHOLDER`,u={INTENTION:`v1/intention`,AUTH:`api/auth/tokens`,CREATE_PAYMENT_LINK:`api/ecommerce/payment-links`,PAYMENT_ACTIONS:{REFUND:`api/acceptance/void_refund/refund`,VOID:`api/acceptance/void_refund/void`,CAPTURE:`api/acceptance/capture`,MOTO:`api/acceptance/payments/pay`},TRANSACTION_INQUIRY:{ORDER_ID:`api/ecommerce/orders/transaction_inquiry`,TRANSACTION_ID:`api/acceptance/transactions/TRANSACTION_ID_PLACEHOLDER`,MERCHANT_ORDER_ID:`api/ecommerce/orders/transaction_inquiry`},SUBSCRIPTIONS:{CREATE_SUBSCRIPTIONS:`v1/intention`,SUSPEND:`api/acceptance/subscription-plans/SUBSCRIPTION_ID_PLACEHOLDER/suspend`,RESUME:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER/resume`,CANCEL:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER/cancel`,UPDATE:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER`,LIST_CARDS:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER/card-tokens`,CHANGE_PRIMARY_CARD:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER/change-primary-card`,DELETE_SECONDARY_CARD:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER/delete-card`,LIST_SUBSCRIPTION_DETAILS:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER`,LIST_SUBSCRIPTIONS_RELATEDTO_TRANSACTION:`api/acceptance/subscriptions?transaction=TRANSACTION_ID_PLACEHOLDER`,LIST_LAST_TRANSACTION:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER/last-transaction`,LIST_ALL_TRANSACTIONS:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER/transactions`,REGISTER_WEBHOOK:`api/acceptance/subscriptions/SUBSCRIPTION_ID_PLACEHOLDER/webhooks`,PLANS:{CREATE:`api/acceptance/subscription-plans`,SUSPEND:`api/acceptance/subscription-plans/SUBSCRIPTION_PLAN_ID_PLACEHOLDER/suspend`,RESUME:`api/acceptance/subscription-plans/SUBSCRIPTION_PLAN_ID_PLACEHOLDER/resume`,UPDATE:`api/acceptance/subscription-plans/SUBSCRIPTION_PLAN_ID_PLACEHOLDER`,LIST:`api/acceptance/subscription-plans`}}};var d=class extends Error{constructor(e){super(e),this.name=`PaymobAPIError`}},ae=class extends Error{constructor(e){super(e),this.name=`ConfigurationError`}},f=class extends Error{constructor(e){super(e),this.name=`ValidationError`}};const p=t=>{let n=e.number().int();return t===void 0?n:n.min(t)},m=()=>e.number().int().positive(),h=()=>e.number().int().nonnegative(),g=()=>e.number().int().nonnegative(),_=()=>e.string().url(),v=()=>e.string().email(),y=()=>e.string().datetime(),b=e.object({apartment:e.string().optional(),first_name:e.string(),last_name:e.string(),street:e.string().optional(),building:e.string().optional(),phone_number:e.string(),city:e.string().optional(),country:e.string().optional(),email:v().optional(),floor:e.string().optional(),state:e.string().optional()}),x=e.object({name:e.string(),amount:g(),description:e.string(),quantity:m()}),S=e.array(e.union([e.number(),e.string()])).refine(e=>e.length>0,{message:`At least one payment method ID is required.`}),C=e.object({id:e.union([e.string(),p()]),created_at:y(),updated_at:y().optional()}),w=e.object({first_name:e.string().optional(),last_name:e.string().optional(),email:v().optional(),phone_number:e.string().optional()}),oe=e.object({street:e.string().optional(),building:e.string().optional(),floor:e.string().optional(),apartment:e.string().optional(),city:e.string().optional(),state:e.string().optional(),country:e.string().optional(),postal_code:e.string().optional()}),T=e.record(e.string(),e.unknown()),E=t.object({amount:g(),currency:t.string(),payment_methods:S,items:t.array(x).optional(),billing_data:b,extras:t.record(t.any()).optional(),special_reference:t.string().optional(),expiration:t.number().int().positive().optional(),notification_url:t.string().url().optional(),redirection_url:t.string().url().optional()}),se=t.object({id:t.string(),client_secret:t.string(),amount:g(),currency:t.string(),status:t.string(),created_at:y()}),ce=t.object({id:t.string(),client_secret:t.string(),amount:g(),currency:t.string(),status:t.string(),payment_method_options:t.object({card:t.object({request_three_d_secure:t.string()})}),created_at:y(),metadata:T.optional()}),le=(e,t)=>ie.replace(`CLIENT_SECRET_PLACEHOLDER`,e).replace(`PUBLIC_KEY_PLACEHOLDER`,t);var D=class{client;paymobConfig;constructor(e,t){this.client=e,this.paymobConfig=t}async createIntention(e){try{let t=E.parse(e);return await this.client.post(u.INTENTION,{body:JSON.stringify(t)}).json()}catch(e){throw e instanceof ee.ZodError?new f(`Invalid intention request: ${e.message}`):new d(`Failed to create intention: ${e}`)}}async getPaymentUrl(e){if(!e||typeof e!=`string`)throw new f(`client_secret is required and must be a string`);if(!this.paymobConfig.PAYMOB_PUBLIC_KEY)throw new f(`PAYMOB_PUBLIC_KEY is required for payment URL generation`);return le(e,this.paymobConfig.PAYMOB_PUBLIC_KEY)}async createIntentionAndGetUrl(e){let{client_secret:t}=await this.createIntention(e);return this.getPaymentUrl(t)}async voidTransaction(e){this.validateTransactionID(e);try{return await this.client.post(u.PAYMENT_ACTIONS.VOID,{body:JSON.stringify({transaction_id:e})}).json()}catch(t){throw new d(`Failed to void transaction ${e}: ${t}`)}}async refundTransaction(e,t){this.validateTransactionID(e),this.validateAmount(t);try{return await this.client.post(u.PAYMENT_ACTIONS.REFUND,{body:JSON.stringify({transaction_id:e,amount_cents:t})}).json()}catch(t){throw new d(`Failed to refund transaction ${e}: ${t}`)}}async captureTransaction(e,t){this.validateTransactionID(e),this.validateAmount(t);try{return await this.client.post(u.PAYMENT_ACTIONS.CAPTURE,{body:JSON.stringify({transaction_id:e,amount_cents:t})}).json()}catch(t){throw new d(`Failed to capture transaction ${e}: ${t}`)}}validateTransactionID(e){if(!e||typeof e!=`string`||e.trim()===``)throw new f(`Transaction ID is required and must be a non-empty string`)}validateAmount(e){if(typeof e!=`number`||e<=0||!Number.isInteger(e))throw new f(`Amount must be a positive integer representing cents`)}},O=class{client;paymobConfig;constructor(e,t){this.client=e,this.paymobConfig=t}},ue=class{client;paymobConfig;cachedToken=null;tokenExpiryTime=null;constructor(e,t){if(!t?.PAYMOB_API_KEY)throw new ae(`PAYMOB_API_KEY is required`);this.client=e,this.paymobConfig=t}async getAccessToken(){if(this.isTokenValid())return this.cachedToken;try{let e=await this.client.post(u.AUTH,{body:JSON.stringify({api_key:this.paymobConfig.PAYMOB_API_KEY})}).json();if(!e.token)throw new d(`Invalid auth response: missing token`);return this.cachedToken=e.token,this.tokenExpiryTime=Date.now()+55*60*1e3,e.token}catch(e){throw this.cachedToken=null,this.tokenExpiryTime=null,e instanceof d?e:new d(`Authentication failed: ${e}`)}}clearCache(){this.cachedToken=null,this.tokenExpiryTime=null}isTokenValid(){return!!(this.cachedToken&&this.tokenExpiryTime&&Date.now()<this.tokenExpiryTime)}},k=class{client;paymobConfig;auth;constructor(e,t){this.client=e,this.paymobConfig=t,this.auth=new ue(e,t)}async getTransactionUsingOrderID(e){this.validateOrderID(e);try{let t=await this.auth.getAccessToken();return await this.client.post(u.TRANSACTION_INQUIRY.ORDER_ID,{headers:{Authorization:`Bearer ${t}`},body:JSON.stringify({order_id:e})}).json()}catch(t){throw new d(`Failed to retrieve transaction using order ID ${e}: ${t}`)}}async getTransactionUsingTransactionID(e){this.validateTransactionID(e);try{let t=await this.auth.getAccessToken();return await this.client.get(u.TRANSACTION_INQUIRY.TRANSACTION_ID.replace(`TRANSACTION_ID_PLACEHOLDER`,e),{headers:{Authorization:`Bearer ${t}`}}).json()}catch(t){throw new d(`Failed to retrieve transaction using transaction ID ${e}: ${t}`)}}async getTransactionUsingMerchantOrderID(e){this.validateMerchantOrderID(e);try{let t=await this.auth.getAccessToken();return await this.client.post(u.TRANSACTION_INQUIRY.MERCHANT_ORDER_ID,{headers:{Authorization:`Bearer ${t}`},body:JSON.stringify({merchant_order_id:e})}).json()}catch(t){throw new d(`Failed to retrieve transaction using merchant order ID ${e}: ${t}`)}}getAuthInstance(){return this.auth}validateOrderID(e){if(!e||typeof e!=`string`&&typeof e!=`number`||typeof e==`string`&&e.trim()===``)throw new f(`Order ID is required and must be a non-empty string or number`)}validateTransactionID(e){if(!e||typeof e!=`string`||e.trim()===``)throw new f(`Transaction ID is required and must be a non-empty string`)}validateMerchantOrderID(e){if(!e||typeof e!=`string`||e.trim()===``)throw new f(`Merchant Order ID is required and must be a non-empty string`)}};const de=(e,t={})=>te.create({prefixUrl:l,headers:{"Content-Type":`application/json`,Authorization:`Token ${e}`},retry:re,timeout:ne,...t}),A=n.object({id:n.number(),pending:n.boolean(),amount_cents:n.number(),success:n.boolean(),is_auth:n.boolean(),is_capture:n.boolean(),is_standalone_payment:n.boolean(),is_voided:n.boolean(),is_refunded:n.boolean(),is_3d_secure:n.boolean(),integration_id:n.number(),has_parent_transaction:n.boolean(),created_at:n.string(),currency:n.string(),error_occured:n.boolean(),order:n.object({id:n.number()}),owner:n.number(),source_data:n.object({pan:n.string(),type:n.string(),sub_type:n.string()})}),j=n.object({id:n.number(),token:n.string(),masked_pan:n.string(),merchant_id:n.number(),card_subtype:n.string(),created_at:n.string(),email:n.string(),order_id:n.string(),user_added:n.boolean(),next_payment_intention:n.string()}),fe=n.object({type:n.literal(`TRANSACTION`),obj:A}),pe=n.object({type:n.literal(`TOKEN`),obj:j}),M=n.discriminatedUnion(`type`,[n.object({type:n.literal(`TRANSACTION`),obj:A}),n.object({type:n.literal(`TOKEN`),obj:j})]),N=n.object({id:n.number(),pending:n.boolean(),amount_cents:n.number(),success:n.boolean(),is_auth:n.boolean(),is_capture:n.boolean(),is_standalone_payment:n.boolean(),is_voided:n.boolean(),is_refunded:n.boolean(),is_3d_secure:n.boolean(),integration_id:n.number(),has_parent_transaction:n.boolean(),order:n.number(),created_at:n.string(),currency:n.string(),error_occured:n.boolean(),owner:n.number(),"source_data.pan":n.string(),"source_data.type":n.string(),"source_data.sub_type":n.string(),txn_response_code:n.number(),hmac:n.string()}),P=(e,t,n)=>{let r=M.parse(e),i=c(`sha512`,n);if(r.type===`TRANSACTION`){let e=`${r.obj.amount_cents}${r.obj.created_at}${r.obj.currency}${r.obj.error_occured}${r.obj.has_parent_transaction}${r.obj.id}${r.obj.integration_id}${r.obj.is_3d_secure}${r.obj.is_auth}${r.obj.is_capture}${r.obj.is_refunded}${r.obj.is_standalone_payment}${r.obj.is_voided}${r.obj.order.id}${r.obj.owner}${r.obj.pending}${r.obj.source_data.pan}${r.obj.source_data.sub_type}${r.obj.source_data.type}${r.obj.success}`,n=i.update(e).digest(`hex`);return n===t}if(r.type===`TOKEN`){let e=`${r.obj.card_subtype}${r.obj.created_at}${r.obj.email}${r.obj.id}${r.obj.masked_pan}${r.obj.merchant_id}${r.obj.order_id}${r.obj.token}`,n=i.update(e).digest(`hex`);return n===t}return!1},F=(e,t,n)=>{let r=N.parse(e),i=c(`sha512`,n),a=`${r.amount_cents}${r.created_at}${r.currency}${r.error_occured}${r.has_parent_transaction}${r.id}${r.integration_id}${r.is_3d_secure}${r.is_auth}${r.is_capture}${r.is_refunded}${r.is_standalone_payment}${r.is_voided}${r.order}${r.owner}${r.pending}${r[`source_data.pan`]}${r[`source_data.sub_type`]}${r[`source_data.type`]}${r.success}`,o=i.update(a).digest(`hex`);return o===t};var me=class{client;paymobConfig;constructor(e,t){this.client=e,this.paymobConfig=t}comareHMACWebhook(e,t){return P(e,t,this.paymobConfig.PAYMOB_HMAC_SECRET)}comareHMACRedirect(e,t){return F(e,t,this.paymobConfig.PAYMOB_HMAC_SECRET)}},he=class{client;payment;transaction;subscriptions;hmac;constructor(e,t={}){this.client=de(e.PAYMOB_SECRET_KEY,t),this.payment=new D(this.client,e),this.transaction=new k(this.client,e),this.subscriptions=new O(this.client,e),this.hmac=new me(this.client,e)}};const ge=r.object({PAYMOB_API_KEY:r.string().min(1,`API key is required`),PAYMOB_PUBLIC_KEY:r.string().min(1,`Public key is required`),PAYMOB_SECRET_KEY:r.string().min(1,`Secret key is required`),PAYMOB_NOTIFICATION_URL:r.string().min(1,`notification URL is required`).url({message:`notification URL is not a valid URL`}),PAYMOB_REDIRECTION_URL:r.string().min(1,`redirection URL is required`).url({message:`redirection URL is not a valid URL`}),PAYMOB_PAYMENT_INTEGRATION_IDS:r.string().transform(e=>e.split(`,`).map(e=>Number(e))),PAYMOB_HMAC_SECRET:r.string().min(1,`HMAC secret is required`)}),_e=i.object({api_key:i.string()}),ve=i.object({username:i.string(),password:i.string(),expiration:p(0).optional()}),I=i.object({id:p(),user:i.object({id:p(),username:i.string(),first_name:i.string(),last_name:i.string(),email:v()})}),ye=i.object({token:i.string(),profile:I}),be=a.object({amount_cents:g(),payment_methods:S,email:v(),full_name:a.string(),phone_number:a.string(),description:a.string(),is_live:a.boolean().optional(),expires_at:y().optional(),reference_id:a.string().optional(),notification_url:_().optional(),redirection_url:_().optional()}),xe=a.object({client_url:_()}),L=o.enum([`7`,`15`,`30`,`90`,`180`,`365`]).transform(Number),Se=o.object({frequency:L,name:o.string(),reminder_days:h().nullable(),retrial_days:h().nullable(),plan_type:o.string(),number_of_deductions:m().nullable(),amount_cents:g(),use_transaction_amount:o.boolean(),is_active:o.boolean().optional(),integration:p(),webhook_url:_().nullable().optional()}),R=o.object({...C.shape,frequency:L,name:o.string(),reminder_days:h().nullable(),retrial_days:h().nullable(),plan_type:o.string(),number_of_deductions:m().nullable(),amount_cents:g(),use_transaction_amount:o.boolean(),is_active:o.boolean(),integration:p(),fee:o.number().nullable()}),Ce=o.array(R),we=o.object({plan_id:p(),payment_token:o.string(),...w.shape,...oe.shape,return_url:_().optional(),charge_failure_count:h().optional(),description:o.string().optional(),metadata:T.optional()}),Te=o.object({...C.shape,plan:R,customer_details:o.object({...w.shape}),status:o.string(),created_at:y(),updated_at:y()}),z=s.object({id:p(),created_at:y(),phones:s.array(s.string()),company_emails:s.array(v()),company_name:s.string(),state:s.string(),country:s.string(),city:s.string(),postal_code:s.string(),street:s.string()}),B=s.object({id:p(),first_name:s.string(),last_name:s.string(),street:s.string(),building:s.string(),floor:s.string(),apartment:s.string(),city:s.string(),state:s.string(),country:s.string(),email:v(),phone_number:s.string(),postal_code:s.string(),extra_description:s.string(),shipping_method:s.string(),order_id:p(),order:p()}),V=s.object({id:p(),created_at:y(),delivery_needed:s.boolean(),merchant:s.object({id:p(),created_at:y(),phones:s.array(s.string()),company_emails:s.array(v()),company_name:s.string(),state:s.string(),country:s.string(),city:s.string(),postal_code:s.string(),street:s.string()}),collector:s.unknown().nullable(),amount_cents:g(),shipping_data:B.nullable(),shipping_details:s.unknown().nullable(),currency:s.string(),is_payment_locked:s.boolean(),is_return:s.boolean(),is_cancel:s.boolean(),is_returned:s.boolean(),is_canceled:s.boolean(),merchant_order_id:s.string().nullable(),wallet_notification:s.unknown().nullable(),paid_amount_cents:g(),notify_user_with_email:s.boolean(),items:s.array(s.unknown()),order_url:s.string(),commission_fees:g(),delivery_fees_cents:g(),delivery_vat_cents:g(),payment_method:s.string(),merchant_staff_tag:s.string().nullable(),api_source:s.string(),pickup_data:s.unknown().nullable(),delivery_status:s.array(s.unknown())}),H=s.object({type:s.string(),pan:s.string(),sub_type:s.string()}),U=s.object({amount_cents:g(),currency:s.string(),reason_code:s.string()}),W=s.object({acquirer:s.string(),merchant_id:s.string(),terminal_id:s.string(),merchant_name:s.string(),merchant_city:s.string(),merchant_country:s.string(),settlement_amount:s.string(),settlement_currency:s.string(),transaction_id:s.string(),auth_code:s.string(),reference_number:s.string(),receipt_no:s.string(),batch_no:s.string(),message:s.string(),response_code:s.string(),pos_entry_mode:s.string(),card_data:s.string(),acq_response_code:s.string(),avs_acq_response_code:s.string(),eci:s.string(),cavv:s.string(),xid:s.string(),network:s.string(),card_type:s.string(),authentication_3ds:s.string(),transaction_status:s.string(),transaction_status_reason:s.string(),transaction_status_info:s.string(),transaction_status_details:s.string(),transaction_status_details_reason:s.string(),transaction_status_details_info:s.string()}),G=s.object({id:s.string(),amount:g(),currency:s.string(),merchant:s.string(),terminal:s.string(),type:s.string()}),K=s.object({amount:g(),chargeback:U,creationTime:s.string(),currency:s.string(),id:s.string(),merchantId:s.string(),merchantOrderId:s.string(),merchantTransactionId:s.string(),status:s.string(),terminalId:s.string(),totalAuthorizedAmount:s.string(),totalCapturedAmount:s.string(),totalRefundedAmount:s.string(),transaction:G}),q=s.object({order:V,created_at:y(),transaction_processed_callback_responses:s.array(s.unknown()),currency:s.string(),source_data:H,api_source:s.string(),is_void:s.boolean(),is_refund:s.boolean(),is_capture:s.boolean(),is_standalone_payment:s.boolean(),payment_key_claims:s.unknown().nullable(),error_occured:s.boolean(),is_live:s.boolean(),other_endpoint_reference:s.unknown().nullable(),refunded_amount_cents:g(),source_id:p(),is_captured:s.boolean(),captured_amount:g(),merchant_staff_tag:s.string().nullable(),updated_at:y(),is_settled:s.boolean(),bill_balanced:s.boolean(),is_bill:s.boolean(),owner:p(),parent_transaction:s.unknown().nullable(),redirect_url:s.string().nullable(),merchant:z,merchant_external_link:s.string().nullable(),acquirer:W,terminal_id:s.unknown().nullable(),installment:s.unknown().nullable(),order_id:p(),hmac:s.string(),use_redirection:s.boolean(),rrn:s.string(),migs_order:K,integration_id:p(),klass:s.string(),created_by:s.string(),gateway_source_data:s.unknown().nullable(),secure_hash:s.string(),avs_result_code:s.string(),avs_acq_response_code:s.string(),acs_eci:s.string()}),J=s.object({id:p(),pending:s.boolean(),amount_cents:g(),success:s.boolean(),is_auth:s.boolean(),is_capture:s.boolean(),is_standalone_payment:s.boolean(),is_void:s.boolean(),is_refund:s.boolean(),is_voided:s.boolean(),is_refunded:s.boolean(),is_3d_secure:s.boolean(),integration_id:p(),profile_id:p(),has_parent_transaction:s.boolean(),order:V,created_at:y(),transaction_processed_callback_responses:s.array(s.unknown()),currency:s.string(),source_data:H,api_source:s.string(),terminal_id:s.unknown().nullable(),merchant_commission:p(),installment:s.unknown().nullable(),error_occured:s.boolean(),refunded_amount_cents:g(),captured_amount:g(),updated_at:y(),is_settled:s.boolean(),bill_balanced:s.boolean(),is_bill:s.boolean(),owner:p(),parent_transaction:p()}),Ee=s.object({transaction_id:s.string(),amount_cents:m(),reason:s.string().optional()}),De=s.object({transaction_id:s.string(),amount_cents:m()}),Oe=s.object({transaction_id:s.string()}),ke=s.object({transaction_id:s.string()}),Y=s.object({...q.shape,transaction_id:s.string(),parent_id:s.string()}),X=s.object({...q.shape,transaction_id:s.string(),parent_id:s.string()}),Z=s.object({...q.shape,transaction_id:s.string(),parent_id:s.string()}),Ae=s.object({...K.shape,acceptPartialAmount:s.boolean(),authenticationStatus:s.string(),status:s.string(),totalAuthorizedAmount:s.union([p(),s.null()]).nullable(),totalCapturedAmount:s.union([p(),s.null()]).nullable()}),je=s.object({...G.shape,authenticationStatus:s.string(),authorizationResponse:s.object({stan:s.string(),authorizationCode:s.string(),responseCode:s.string(),responseMessage:s.string()}),receipt:s.string(),type:s.literal(`PAYMENT`),status:s.string()}),Q=s.object({...q.shape,transaction_id:s.string(),migs_order:Ae,migs_transaction:je}),$=s.object({apartment:s.string(),email:v(),floor:s.string(),first_name:s.string(),street:s.string(),building:s.string(),phone_number:s.string(),shipping_method:s.string(),postal_code:s.string(),city:s.string(),country:s.string(),last_name:s.string(),state:s.string()}),Me=s.object({user_id:p(),amount_cents:g(),currency:s.string(),integration_id:p(),order_id:p(),billing_data:$,lock_order_when_paid:s.boolean(),extra:s.object({}).passthrough(),notification_url:s.string(),redirection_url:s.string(),single_payment_attempt:s.boolean(),exp:p(),pmk_ip:s.string()}),Ne=s.object({...J.shape,is_refund:s.literal(!0),data:Y}),Pe=s.object({...J.shape,is_capture:s.literal(!0),is_void:s.literal(!1),is_refund:s.literal(!1),data:X}),Fe=s.object({...J.shape,is_void:s.literal(!0),is_refund:s.literal(!1),data:Z}),Ie=s.object({...J.shape,is_standalone_payment:s.boolean(),has_parent_transaction:s.boolean(),data:Q,payment_key_claims:Me.optional(),parent_transaction:s.string().optional(),unique_ref:s.string()});export{W as AcquirerSchema,oe as AddressSchema,_e as AuthApiKeyRequestSchema,I as AuthProfileSchema,ye as AuthResponseSchema,ve as AuthUsernamePasswordRequestSchema,K as BaseMigsOrderSchema,G as BaseMigsTransactionSchema,C as BaseResourceSchema,q as BaseTransactionDataSchema,J as BaseTransactionResponseSchema,$ as BillingDataClaimsSchema,b as BillingDataSchema,De as CaptureRequestSchema,Pe as CaptureResponseSchema,X as CaptureTransactionDataSchema,U as ChargebackSchema,E as CreateIntentionRequestSchema,se as CreateIntentionResponseSchema,be as CreateQuickLinkRequestSchema,xe as CreateQuickLinkResponseSchema,Se as CreateSubscriptionPlanRequestSchema,we as CreateSubscriptionRequestSchema,w as CustomerSchema,ce as IntentionSchema,x as ItemSchema,Ce as ListSubscriptionPlansResponseSchema,z as MerchantSchema,T as MetadataSchema,V as OrderSchema,D as Payment,Me as PaymentKeyClaimsSchema,S as PaymentMethodsSchema,Q as PaymentTransactionDataSchema,he as PaymobSDK,Ee as RefundRequestSchema,Ne as RefundResponseSchema,Y as RefundTransactionDataSchema,B as ShippingDataSchema,H as SourceDataSchema,L as SubscriptionFrequencySchema,R as SubscriptionPlanSchema,Te as SubscriptionSchema,O as Subscriptions,k as TransactionInquiry,ke as TransactionInquiryRequestSchema,Ie as TransactionResponseSchema,Oe as VoidRequestSchema,Fe as VoidResponseSchema,Z as VoidTransactionDataSchema,M as WebhookResponseSchema,g as amountCents,F as compareHMACPaymentRedirect,P as compareHMACWebhook,v as emailValidation,p as integer,h as nonNegativeInteger,N as paymentRedirectResponseSchema,ge as paymobConfigSchema,m as positiveInteger,y as timestampValidation,pe as tokenWebhookResponseSchema,fe as transactionWebhookResponseSchema,_ as urlValidation};