UNPKG

@lomi./sdk

Version:
986 lines (985 loc) 30.7 kB
import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class DefaultService { /** * Ping the API * @returns any Successful response * @throws ApiError */ static getPing() { return __request(OpenAPI, { method: 'GET', url: '/ping', }); } /** * Get merchant details * @returns Merchant OK * @throws ApiError */ static getMerchants({ merchantId, }) { return __request(OpenAPI, { method: 'GET', url: '/merchants/{merchant_id}', path: { 'merchant_id': merchantId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * List connected payment providers for a merchant * @returns ConnectedProvider OK * @throws ApiError */ static merchantProviders({ merchantId, }) { return __request(OpenAPI, { method: 'GET', url: '/merchants/{merchant_id}/providers', path: { 'merchant_id': merchantId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Create a new product * @returns Product Created * @throws ApiError */ static postProducts({ requestBody, }) { return __request(OpenAPI, { method: 'POST', url: '/products', body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, }, }); } /** * List products for a merchant * @returns Product OK * @throws ApiError */ static getProducts({ merchantId, }) { return __request(OpenAPI, { method: 'GET', url: '/products', query: { 'merchant_id': merchantId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Get product details * Get details of a specific product * @returns Product Product details retrieved successfully * @throws ApiError */ static getProduct({ productId, }) { return __request(OpenAPI, { method: 'GET', url: '/products/{product_id}', path: { 'product_id': productId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Update product status * Update only the active status of a product. Core details (name, price, etc.) cannot be changed after creation. * @returns any Product status updated successfully * @throws ApiError */ static updateProductStatus({ productId, requestBody, }) { return __request(OpenAPI, { method: 'PATCH', url: '/products/{product_id}', path: { 'product_id': productId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Delete product * Delete a product * @returns void * @throws ApiError */ static deleteProduct({ productId, }) { return __request(OpenAPI, { method: 'DELETE', url: '/products/{product_id}', path: { 'product_id': productId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Create a subscription plan * @returns SubscriptionPlan Created * @throws ApiError */ static postSubscriptions({ requestBody, }) { return __request(OpenAPI, { method: 'POST', url: '/subscriptions', body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, }, }); } /** * List subscription plans for a merchant * @returns SubscriptionPlan OK * @throws ApiError */ static getSubscriptions({ merchantId, limit = 20, offset, }) { return __request(OpenAPI, { method: 'GET', url: '/subscriptions', query: { 'merchant_id': merchantId, 'limit': limit, 'offset': offset, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Create a subscription plan for a merchant * @returns SubscriptionPlan Created * @throws ApiError */ static postMerchantsSubscriptions({ merchantId, requestBody, }) { return __request(OpenAPI, { method: 'POST', url: '/merchants/{merchant_id}/subscriptions', path: { 'merchant_id': merchantId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, }, }); } /** * List subscription plans for a merchant * @returns SubscriptionPlan OK * @throws ApiError */ static getMerchantsSubscriptions({ merchantId, limit, offset, }) { return __request(OpenAPI, { method: 'GET', url: '/merchants/{merchant_id}/subscriptions', path: { 'merchant_id': merchantId, }, query: { 'limit': limit, 'offset': offset, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Get subscription plan details for a merchant * Get details of a specific subscription plan belonging to a merchant * @returns SubscriptionPlan Subscription plan details retrieved successfully * @throws ApiError */ static getSubscriptionPlan({ merchantId, planId, }) { return __request(OpenAPI, { method: 'GET', url: '/merchants/{merchant_id}/subscriptions/{plan_id}', path: { 'merchant_id': merchantId, 'plan_id': planId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Update subscription plan * Update specific fields (is_active, metadata) of a subscription plan. Core details are immutable via API. * @returns SubscriptionPlan Subscription plan updated successfully * @throws ApiError */ static updateSubscriptionPlan({ merchantId, planId, requestBody, }) { return __request(OpenAPI, { method: 'PATCH', url: '/merchants/{merchant_id}/subscriptions/{plan_id}', path: { 'merchant_id': merchantId, 'plan_id': planId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Delete subscription plan * Delete a subscription plan belonging to a merchant * @returns void * @throws ApiError */ static deleteSubscriptionPlan({ merchantId, planId, }) { return __request(OpenAPI, { method: 'DELETE', url: '/merchants/{merchant_id}/subscriptions/{plan_id}', path: { 'merchant_id': merchantId, 'plan_id': planId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * List transactions for a merchant * @returns Transaction OK * @throws ApiError */ static transactionsList({ merchantId, }) { return __request(OpenAPI, { method: 'GET', url: '/transactions', query: { 'merchant_id': merchantId, }, }); } /** * List available payment providers * @returns Provider OK * @throws ApiError */ static providers() { return __request(OpenAPI, { method: 'GET', url: '/providers', errors: { 401: `API key is missing or invalid`, }, }); } /** * Create a refund * Initiate a refund for a transaction * @returns Refund Refund created successfully * @throws ApiError */ static createRefund({ requestBody, }) { return __request(OpenAPI, { method: 'POST', url: '/refunds', body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Get refund details * Get details of a specific refund * @returns Refund Refund details retrieved successfully * @throws ApiError */ static getRefund({ refundId, }) { return __request(OpenAPI, { method: 'GET', url: '/refunds/{refund_id}', path: { 'refund_id': refundId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Update refund status * Update the status of a refund * @returns Refund Refund updated successfully * @throws ApiError */ static updateRefund({ refundId, requestBody, }) { return __request(OpenAPI, { method: 'PATCH', url: '/refunds/{refund_id}', path: { 'refund_id': refundId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Create a customer * Create a new customer for a merchant * @returns Customer Customer created successfully * @throws ApiError */ static createCustomer({ requestBody, }) { return __request(OpenAPI, { method: 'POST', url: '/customers', body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, }, }); } /** * List customers * List all customers for a merchant * @returns Customer List of customers * @throws ApiError */ static listCustomers({ merchantId, email, phoneNumber, }) { return __request(OpenAPI, { method: 'GET', url: '/customers', query: { 'merchant_id': merchantId, 'email': email, 'phone_number': phoneNumber, }, errors: { 401: `API key is missing or invalid`, }, }); } /** * Get customer details * Get details of a specific customer * @returns Customer Customer details retrieved successfully * @throws ApiError */ static getCustomer({ customerId, }) { return __request(OpenAPI, { method: 'GET', url: '/customers/{customer_id}', path: { 'customer_id': customerId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Update customer * Update customer details * @returns Customer Customer updated successfully * @throws ApiError */ static updateCustomer({ customerId, requestBody, }) { return __request(OpenAPI, { method: 'PATCH', url: '/customers/{customer_id}', path: { 'customer_id': customerId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Delete customer * Delete a customer * @returns void * @throws ApiError */ static deleteCustomer({ customerId, }) { return __request(OpenAPI, { method: 'DELETE', url: '/customers/{customer_id}', path: { 'customer_id': customerId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Create a payment link * Create a new payment link for collecting payments * @returns PaymentLink Payment link created successfully * @throws ApiError */ static createPaymentLink({ requestBody, }) { return __request(OpenAPI, { method: 'POST', url: '/payment-links', body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * List payment links * List all payment links for a merchant * @returns PaymentLink List of payment links * @throws ApiError */ static listPaymentLinks({ merchantId, linkType, currencyCode, isActive, }) { return __request(OpenAPI, { method: 'GET', url: '/payment-links', query: { 'merchant_id': merchantId, 'link_type': linkType, 'currency_code': currencyCode, 'is_active': isActive, }, errors: { 401: `API key is missing or invalid`, }, }); } /** * Get payment link details * Get details of a specific payment link * @returns PaymentLink Payment link details retrieved successfully * @throws ApiError */ static getPaymentLink({ linkId, }) { return __request(OpenAPI, { method: 'GET', url: '/payment-links/{link_id}', path: { 'link_id': linkId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Update payment link * Update configurable details of a payment link. * **Important:** Core link details (title, description, price/product/plan, currency, quantity settings) are fixed after creation and cannot be changed via the API. To modify these, create a new link. * * @returns PaymentLink Payment link updated successfully * @throws ApiError */ static updatePaymentLink({ linkId, requestBody, }) { return __request(OpenAPI, { method: 'PATCH', url: '/payment-links/{link_id}', path: { 'link_id': linkId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Delete payment link * Delete a payment link * @returns void * @throws ApiError */ static deletePaymentLink({ linkId, }) { return __request(OpenAPI, { method: 'DELETE', url: '/payment-links/{link_id}', path: { 'link_id': linkId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Register a new webhook endpoint * Create a new webhook endpoint for receiving event notifications * @returns Webhook Webhook endpoint created successfully * @throws ApiError */ static createWebhook({ requestBody, }) { return __request(OpenAPI, { method: 'POST', url: '/webhooks', body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, }, }); } /** * List webhook endpoints * List all webhook endpoints for a merchant * @returns Webhook List of webhook endpoints * @throws ApiError */ static listWebhooks({ merchantId, organizationId, isActive, }) { return __request(OpenAPI, { method: 'GET', url: '/webhooks', query: { 'merchant_id': merchantId, 'organization_id': organizationId, 'is_active': isActive, }, errors: { 401: `API key is missing or invalid`, }, }); } /** * Get webhook details * Get details of a specific webhook endpoint * @returns Webhook Webhook details retrieved successfully * @throws ApiError */ static getWebhook({ webhookId, }) { return __request(OpenAPI, { method: 'GET', url: '/webhooks/{webhook_id}', path: { 'webhook_id': webhookId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Update webhook configuration * Update webhook endpoint configuration * @returns Webhook Webhook configuration updated successfully * @throws ApiError */ static updateWebhook({ webhookId, requestBody, }) { return __request(OpenAPI, { method: 'PATCH', url: '/webhooks/{webhook_id}', path: { 'webhook_id': webhookId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Delete webhook endpoint * Delete a webhook endpoint * @returns void * @throws ApiError */ static deleteWebhook({ webhookId, }) { return __request(OpenAPI, { method: 'DELETE', url: '/webhooks/{webhook_id}', path: { 'webhook_id': webhookId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Create a checkout session * Create a new checkout session for collecting payments * @returns CheckoutSession Checkout session created successfully * @throws ApiError */ static createCheckoutSession({ requestBody, }) { return __request(OpenAPI, { method: 'POST', url: '/checkout-sessions', body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * List checkout sessions * List all checkout sessions for a merchant * @returns CheckoutSession List of checkout sessions * @throws ApiError */ static listCheckoutSessions({ merchantId, checkoutSessionId, status, }) { return __request(OpenAPI, { method: 'GET', url: '/checkout-sessions', query: { 'merchant_id': merchantId, 'checkout_session_id': checkoutSessionId, 'status': status, }, errors: { 401: `API key is missing or invalid`, }, }); } /** * Get a checkout session by ID * Get details of a specific checkout session * @returns CheckoutSession Checkout session details retrieved successfully * @throws ApiError */ static getCheckoutSession({ sessionId, }) { return __request(OpenAPI, { method: 'GET', url: '/checkout-sessions/{session_id}', path: { 'session_id': sessionId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Get transaction details * Get details of a specific transaction by its ID * @returns Transaction Transaction details retrieved successfully * @throws ApiError */ static getTransactionById({ transactionId, }) { return __request(OpenAPI, { method: 'GET', url: '/transactions/{transaction_id}', path: { 'transaction_id': transactionId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Get merchant monthly recurring revenue * Retrieve current monthly recurring revenue * @returns any Monthly recurring revenue retrieved successfully * @throws ApiError */ static getMerchantMrr({ merchantId, }) { return __request(OpenAPI, { method: 'GET', url: '/merchants/{merchant_id}/mrr', path: { 'merchant_id': merchantId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Get merchant annual recurring revenue * Retrieve current annual recurring revenue * @returns any Annual recurring revenue retrieved successfully * @throws ApiError */ static getMerchantArr({ merchantId, }) { return __request(OpenAPI, { method: 'GET', url: '/merchants/{merchant_id}/arr', path: { 'merchant_id': merchantId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Get merchant account balance * Retrieve current account balance for a merchant * @returns any Account balance retrieved successfully * @throws ApiError */ static getMerchantBalance({ merchantId, currencyCode, }) { return __request(OpenAPI, { method: 'GET', url: '/merchants/{merchant_id}/balance', path: { 'merchant_id': merchantId, }, query: { 'currency_code': currencyCode, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * List merchant accounts * Retrieve all accounts belonging to a merchant with their balances * @returns MerchantAccount List of merchant accounts retrieved successfully * @throws ApiError */ static listMerchantAccounts({ merchantId, currencyCode, }) { return __request(OpenAPI, { method: 'GET', url: '/merchants/{merchant_id}/accounts', path: { 'merchant_id': merchantId, }, query: { 'currency_code': currencyCode, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Get transaction summary for a merchant * Retrieve summary of transactions including total counts and amounts by status * @returns any Transaction summary retrieved successfully * @throws ApiError */ static getMerchantTransactionsSummary({ merchantId, startDate, endDate, currencyCode, }) { return __request(OpenAPI, { method: 'GET', url: '/merchants/{merchant_id}/transactions/summary', path: { 'merchant_id': merchantId, }, query: { 'start_date': startDate, 'end_date': endDate, 'currency_code': currencyCode, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * List customer subscriptions * List all subscriptions for a merchant * @returns Subscription List of subscriptions * @throws ApiError */ static listCustomerSubscriptions({ merchantId, customerId, status, }) { return __request(OpenAPI, { method: 'GET', url: '/customer-subscriptions', query: { 'merchant_id': merchantId, 'customer_id': customerId, 'status': status, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Get subscription details * Get details of a specific subscription * @returns Subscription Subscription details retrieved successfully * @throws ApiError */ static getSubscription({ subscriptionId, merchantId, }) { return __request(OpenAPI, { method: 'GET', url: '/customer-subscriptions/{subscription_id}', path: { 'subscription_id': subscriptionId, }, query: { 'merchant_id': merchantId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Update subscription * Update subscription details * @returns Subscription Subscription updated successfully * @throws ApiError */ static updateSubscription({ subscriptionId, merchantId, requestBody, }) { return __request(OpenAPI, { method: 'PATCH', url: '/customer-subscriptions/{subscription_id}', path: { 'subscription_id': subscriptionId, }, query: { 'merchant_id': merchantId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request parameters`, 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Cancel subscription * Cancel a subscription * @returns void * @throws ApiError */ static cancelSubscription({ subscriptionId, merchantId, }) { return __request(OpenAPI, { method: 'DELETE', url: '/customer-subscriptions/{subscription_id}', path: { 'subscription_id': subscriptionId, }, query: { 'merchant_id': merchantId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Regenerate webhook secret * Generate a new verification token for a webhook endpoint * @returns any Webhook secret regenerated successfully * @throws ApiError */ static regenerateWebhookSecret({ webhookId, }) { return __request(OpenAPI, { method: 'POST', url: '/webhooks/{webhook_id}/regenerate-secret', path: { 'webhook_id': webhookId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } /** * Send test webhook * Send a test event to a webhook endpoint to verify it's working correctly * @returns any Test webhook sent successfully * @throws ApiError */ static testWebhook({ webhookId, }) { return __request(OpenAPI, { method: 'POST', url: '/webhooks/{webhook_id}/test', path: { 'webhook_id': webhookId, }, errors: { 401: `API key is missing or invalid`, 404: `The requested resource was not found`, }, }); } }