UNPKG

expresscheckout-nodejs

Version:

Juspay's official expresscheckout-nodejs sdk

69 lines 2.93 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const JuspayResource_js_1 = __importDefault(require("../JuspayResource.js")); class Customer extends JuspayResource_js_1.default { constructor(juspayEnvironment) { super(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, juspayConfig) { return this.makeServiceCall({ method: 'POST', path: '/customers', body: body, juspayOverrideConfig: juspayConfig, }); } /** * * 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, query, juspayConfig) { return this.makeServiceCall({ method: 'GET', path: `/customers/${customerId}`, query, juspayOverrideConfig: juspayConfig, }); } /** * * 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, body, juspayConfig) { return this.makeServiceCall({ method: 'POST', path: `/customers/${customerId}`, body, juspayOverrideConfig: juspayConfig, }); } } exports.default = Customer; //# sourceMappingURL=Customer.js.map