@spreeloop/orange_money
Version:
A orange money api integration package
61 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Routes = void 0;
const apiHost = 'https://api-s1.orange.cm';
/**
* Orange Money API routes builder.
* @class
*/
class Routes {
/**
* Creates a new instance of the class route.
*
* @param {string} version - The version of the instance. Optional.
*/
constructor(version) {
this.version = version;
/**
* Returns the base route for the API.
*
* @return {string} The base route for the API.
*/
this.baseRoute = () => `${apiHost}/omcoreapis/${this.version}`;
this.version = version !== null && version !== void 0 ? version : '1.0.2';
}
/**
* Initializes the live payment.
*
* @return {string} The endpoint URL for the live payment.
*/
mobileInitPayment() {
return `${this.baseRoute()}/mp/pay`;
}
/**
* Generates the payment status URL based on the provided parameters.
*
* @param {object} params - The parameters for generating the payment status URL.
* - {string} params.payToken - The pay token.
* @return {string} The generated payment status URL.
*/
mobilePaymentStatus(params) {
return `${this.baseRoute()}/mp/paymentstatus/${params.payToken}`;
}
/**
* Generates the URL for the Mobile Pay token.
*
* @return {string} The URL for the Mobile Pay token.
*/
mobilePayToken() {
return `${this.baseRoute()}/mp/init`;
}
/**
* Generates the mobile access token endpoint.
*
* @return {string} The generated mobile access token endpoint.
*/
mobileAccessToken() {
return `${apiHost}/token`;
}
}
exports.Routes = Routes;
//# sourceMappingURL=routes.js.map