feat: Payment system with voucher cards.

feat: Design with inversion dependency injection architecture.
feat: Prettier http middleware.
feat: Re-write items categories with preferred accounts.
This commit is contained in:
Ahmed Bouhuolia
2020-08-27 20:39:55 +02:00
parent e23b8d9947
commit e4270dc039
63 changed files with 2567 additions and 462 deletions

View File

@@ -0,0 +1,27 @@
import axios from 'axios';
import SMSClientInterface from '@/services/SMSClient/SMSClientInterfaces';
import config from '@/../config/config';
export default class EasySMSClient implements SMSClientInterface {
clientName: string = 'easysms';
/**
* Send message to given phone number via easy SMS client.
* @param {string} to
* @param {string} message
*/
send(to: string, message: string) {
console.log(config);
const API_KEY = config.easySMSGateway.api_key;
const params = `action=send-sms&api_key=${API_KEY}=&to=${to}&sms=${message}&unicode=1`;
return new Promise((resolve, reject) => {
axios.get(`https://easysms.devs.ly/sms/api?${params}`)
.then((response) => {
if (response.code === 'ok') { resolve(); }
else { reject(); }
})
.catch((error) => { reject(error) });
});
}
}

View File

@@ -0,0 +1,13 @@
import SMSClientInterface from '@/services/SMSClient/SMSClientInterface';
export default class SMSAPI {
smsClient: SMSClientInterface;
constructor(smsClient: SMSClientInterface){
this.smsClient = smsClient;
}
sendMessage(to: string, message: string, extraParams: [], extraHeaders: []) {
return this.smsClient.send(to, message);
}
}

View File

@@ -0,0 +1,5 @@
export default interface SMSClientInterface {
clientName: string;
send(to: string, message: string): boolean;
}

View File

@@ -0,0 +1,3 @@
import SMSAPI from './SMSAPI';
export default SMSAPI;