UNPKG

paystack-sdk

Version:
91 lines (90 loc) 3.2 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Customer = void 0; /** * # Customers * The Customers API allows you create and manage * customers on your integration */ class Customer { constructor(http) { this.http = http; } /** * ## Create Customer * Create a customer on your integration * @param {CreateCustomer} data */ create(data) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.post('/customer', JSON.stringify(data)); }); } /** * ## List Customers * List customers available on your integration */ list(queryParams) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.get('/customer', { params: Object.assign({}, queryParams), }); }); } /** * ## Fetch Customer * Get details of a customer on your integration * @param {String} email_or_code */ fetch(emailCode) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.get(`/customer/${emailCode}`); }); } /** * ## Update CUstomer * Update a customer's details on your integration */ update(code, data) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.put(`/customer/${code}`, JSON.stringify(data)); }); } /** * ## Validate Customer * Validate a customer's identity */ validate(customerCode, data) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.post(`/customer/${customerCode}/identification`, JSON.stringify(data)); }); } /** * ## Whitelist/Blacklist Customer * Whitelist or black a customer on your integration */ setRiskAction(data) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.post('/customer/set_risk_action', JSON.stringify(data)); }); } /** * ## Deactivate Authorization * Deactivate an authorization when the card needs to be forgotten */ deactivateAutorization(authorizationCode) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.post('/customer/deactivate_authorization', JSON.stringify({ authorizaion_code: authorizationCode })); }); } } exports.Customer = Customer;