UNPKG

expresscheckout-nodejs

Version:

Juspay's official expresscheckout-nodejs sdk

42 lines (41 loc) 2.41 kB
import { JuspayEnvironment } from '../JuspayEnvironment.js'; import JuspayResource from '../JuspayResource.js'; import { CreateCustomerRequest, GetCustomerQuery, UpdateCustomerRequest, HttpResponse, JuspayConfig } from '../types/index.js'; export default class Customer extends JuspayResource { constructor(juspayEnvironment: JuspayEnvironment); /** * - Create a new customer object. * - You may invoke this method whenever someone registers in your website or App. * - JusPay will respond with an ID that you can persist in your Database. Pass this ID at the time of order creation to ensure proper linking of orders/payments belonging to a customer. * * * @param body object_reference_id, mobile_number are required fields * @param juspayConfig override config using this params usage:- {apiKey: '', merchantId: '', ...} * @returns Promise Response Object * * @link https://docs.juspay.in/api-reference/docs/express-checkout/createcustomer */ create(body: CreateCustomerRequest, juspayConfig?: JuspayConfig): Promise<HttpResponse>; /** * * This will return customer entity for the given identifier. * * @param customerId Use the ID that is generated by JUSPAY during customer creation. You may also send the value that you sent in object_reference_id at the time of creating the customer. * @param juspayConfig override config using this params usage:- {apiKey: '', merchantId: '', ...} * @returns Promise Response Object * * @link https://docs.juspay.in/api-reference/docs/express-checkout/updatecustomer */ get(customerId: string, query?: GetCustomerQuery, juspayConfig?: JuspayConfig): Promise<HttpResponse>; /** * * The API can be used to update the customer details like phone number, email, first name etc * * @param customerId Use the ID that is generated by JUSPAY during customer creation. You may also send the value that you sent in object_reference_id at the time of creating the customer. * @param juspayConfig override config using this params usage:- {apiKey: '', merchantId: '', ...} * @returns Promise Response Object * * @link https://docs.juspay.in/api-reference/docs/express-checkout/updatecustomer */ update(customerId: string, body: UpdateCustomerRequest, juspayConfig?: JuspayConfig): Promise<HttpResponse>; }