UNPKG

expresscheckout-nodejs

Version:

Juspay's official expresscheckout-nodejs sdk

70 lines (69 loc) 3.65 kB
import { JuspayEnvironment } from '../JuspayEnvironment.js'; import JuspayResource from '../JuspayResource.js'; import { CreateOrderRequest, RefundOrderRequest, UpdateOrderRequest, OrderStatusRequest, HttpResponse, JuspayConfig } from '../types/index.js'; export default class Order extends JuspayResource { constructor(juspayEnvironment: JuspayEnvironment); /** * - Create an order that is a representation of your shopping cart. * - The order contains important information like amount, customer details, shipping address, billing address, etc. * - Only after an order is created, payment can be started. * - Order create is a server to server call. * * @param body order_id, amount is must * @param juspayConfig override config using this params usage:- {apiKey: '', merchantId: '', ...} * @returns Promise Response Object * * @link https://docs.juspay.in/api-reference/docs/express-checkout/create-order-api */ create(body: CreateOrderRequest, juspayConfig?: JuspayConfig): Promise<HttpResponse>; /** * * - Retrieve the order object associated with the order_id. * - Refer the link to include relevant version in the header - https://developer.juspay.in/reference#section-version * * - this route supports jwe authentiction * - if decided auth is jwe (if jweAuth config is set) please review the data given * - as the api is different * - for /order/:orderId aka basic auth refer to this:- https://developer.juspay.in/reference/get-order-status * - for jwe auth it's type is, please go through the document share with you * * @param orderId - Unique Identifier for the order * @param query - request body * @param juspayConfig override config using this params usage:- {apiKey: '', merchantId: '', ...} * @param authMethod - to choose auth type currently supports 'JWE' and 'BASIC' * @returns Promise Response Object * * @link https://docs.juspay.in/api-reference/docs/express-checkout/order-status-api * */ status(orderId: string, query?: OrderStatusRequest, juspayConfig?: JuspayConfig, authMethod?: JuspayResource.AuthMethod): Promise<HttpResponse>; /** * * - Update an order that has already been created. * - The only amount, address and UDF fields can be updated. * - Address fields can be optionally sent as explained in the /orders API. * - The API response is similar to that of the order create API * * @param orderId - Unique Identifier for the order * @param body: - amount is required * @param juspayConfig override config using this params usage:- {apiKey: '', merchantId: '', ...} * @returns Promise Response Object * * @link https://docs.juspay.in/api-reference/docs/express-checkout/update-order-api * */ update(orderId: string, body: UpdateOrderRequest, juspayConfig?: JuspayConfig): Promise<HttpResponse>; /** * * - Create a refund for an Order. * - Refunds can be initiated only for transactions that are CHARGED. * * @param orderId - Unique Identifier for the order * @param juspayConfig override config using this params usage:- {apiKey: '', merchantId: '', ...} * @returns Promise Response Object * - The response of refund initiation is similar to that of order status API Response with the addition of refund block. * * @link https://docs.juspay.in/api-reference/docs/express-checkout/refund-order-api */ refund(orderId: string, body: RefundOrderRequest, juspayConfig?: JuspayConfig): Promise<HttpResponse>; }