UNPKG

@sahabaplus/moyasar

Version:

A comprehensive TypeScript SDK for integrating with the Moyasar payment gateway

100 lines 3.18 kB
import type { ApiClient, Metadata } from "../../shared/types/index"; import type { ListPaymentsResponse, PaymentListOptions, Payment, CreatePaymentRequest, UpdatePaymentRequest, RefundPaymentRequest, CapturePaymentRequest } from "./types"; import { PaymentStatus } from "./enums"; export declare class PaymentService { private apiClient; constructor(p: { apiClient: ApiClient; }); /** * Create a new payment */ create(params: CreatePaymentRequest): Promise<Payment>; /** * List payments with optional filtering */ list(options?: PaymentListOptions): Promise<ListPaymentsResponse>; /** * Retrieve a specific payment */ retrieve(paymentId: string): Promise<Payment>; /** * Update a payment */ update({ paymentId, update, }: { paymentId: string; update: UpdatePaymentRequest; }): Promise<Payment>; /** * Refund a payment (full or partial) */ refund({ paymentId, refund, }: { paymentId: string; refund: RefundPaymentRequest; }): Promise<Payment>; /** * Capture an authorized payment (full or partial) */ capture({ paymentId, capture, }: { paymentId: string; capture?: CapturePaymentRequest; }): Promise<Payment>; /** * Void an authorized payment */ void(paymentId: string): Promise<Payment>; /** * Search payments by metadata */ searchByMetadata({ metadata, options, }: { metadata: Metadata; options: Omit<PaymentListOptions, "metadata">; }): Promise<ListPaymentsResponse>; /** * Get payments by status */ getByStatus(status: PaymentStatus, options?: Omit<PaymentListOptions, "status">): Promise<ListPaymentsResponse>; /** * Get paid payments */ getPaid(options?: Omit<PaymentListOptions, "status">): Promise<ListPaymentsResponse>; /** * Get failed payments */ getFailed(options?: Omit<PaymentListOptions, "status">): Promise<ListPaymentsResponse>; /** * Get authorized payments */ getAuthorized(options?: Omit<PaymentListOptions, "status">): Promise<ListPaymentsResponse>; /** * Get refunded payments */ getRefunded(options?: Omit<PaymentListOptions, "status">): Promise<ListPaymentsResponse>; /** * Get payments by card last 4 digits */ getByCardLast4({ last4, options, }: { last4: string; options: Omit<PaymentListOptions, "last_4">; }): Promise<ListPaymentsResponse>; /** * Get payments by RRN (Retrieval Reference Number) */ getByRRN({ rrn, options, }: { rrn: string; options: Omit<PaymentListOptions, "rrn">; }): Promise<ListPaymentsResponse>; /** * Check payment capabilities (what actions can be performed) */ getPaymentCapabilities(paymentId: string): Promise<{ canRefund: boolean; canCapture: boolean; canVoid: boolean; maxRefundAmount: number; maxCaptureAmount: number; }>; private handleError; protected parseBody(p: object): Record<string, string>; } //# sourceMappingURL=service.d.ts.map