paystack-sdk
Version:
Paystack SDK written in Typescript
68 lines (67 loc) • 2 kB
JavaScript
;
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
*/
async create(data) {
return await this.http.post('/customer', JSON.stringify(data));
}
/**
* ## List Customers
* List customers available on your integration
*/
async list(queryParams) {
return await this.http.get('/customer', {
params: { ...queryParams },
});
}
/**
* ## Fetch Customer
* Get details of a customer on your integration
* @param {String} email_or_code
*/
async fetch(emailCode) {
return await this.http.get(`/customer/${emailCode}`);
}
/**
* ## Update CUstomer
* Update a customer's details on your integration
*/
async update(code, data) {
return await this.http.put(`/customer/${code}`, JSON.stringify(data));
}
/**
* ## Validate Customer
* Validate a customer's identity
*/
async validate(customerCode, data) {
return await this.http.post(`/customer/${customerCode}/identification`, JSON.stringify(data));
}
/**
* ## Whitelist/Blacklist Customer
* Whitelist or black a customer on your integration
*/
async setRiskAction(data) {
return await this.http.post('/customer/set_risk_action', JSON.stringify(data));
}
/**
* ## Deactivate Authorization
* Deactivate an authorization when the card needs to be forgotten
*/
async deactivateAutorization(authorizationCode) {
return await this.http.post('/customer/deactivate_authorization', JSON.stringify({ authorizaion_code: authorizationCode }));
}
}
exports.Customer = Customer;