UNPKG

expresscheckout-nodejs

Version:

Juspay's official expresscheckout-nodejs sdk

81 lines 3.67 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import JuspayResource from '../JuspayResource.js'; var Customer = /** @class */ (function (_super) { __extends(Customer, _super); function Customer(juspayEnvironment) { return _super.call(this, juspayEnvironment) || this; } /** * - 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 */ Customer.prototype.create = function (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 */ Customer.prototype.get = function (customerId, query, juspayConfig) { return this.makeServiceCall({ method: 'GET', path: "/customers/".concat(customerId), query: 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 */ Customer.prototype.update = function (customerId, body, juspayConfig) { return this.makeServiceCall({ method: 'POST', path: "/customers/".concat(customerId), body: body, juspayOverrideConfig: juspayConfig }); }; return Customer; }(JuspayResource)); export default Customer; //# sourceMappingURL=Customer.js.map