Backend Provider added
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// Topup management toosl
|
||||
#include "clog.h"
|
||||
#include "cgi.h"
|
||||
#include "input.h"
|
||||
#include "mermsemr_api.h"
|
||||
#include "safestring.h"
|
||||
#include <string>
|
||||
#include "pgsql.h"
|
||||
#include "pgsql_wrapper.h"
|
||||
#include <curl/curl.h>
|
||||
#include "medTEmails.h"
|
||||
|
||||
/* -- */
|
||||
#include "function_members.h"
|
||||
#include "providers.h"
|
||||
#include "function_members.h"
|
||||
|
||||
|
||||
|
||||
|
||||
long providers_call(CVars in, CVars &out) {
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
char vname[20];
|
||||
logfmt(logINFO, "ERROR CALL long providers_call(CVars in, CVars &out)");
|
||||
try {
|
||||
REQ_LONG(in, "action", 0, -1);
|
||||
|
||||
switch (in["action"].Long()) {
|
||||
|
||||
case MERMS_PROVIDERS_LOGIN:
|
||||
|
||||
REQ_STRING(in, "cardnumber", 10, 17, "(.*)");
|
||||
REQ_LONG(in, "exp_month", 0, -1);
|
||||
REQ_LONG(in, "exp_year", 0, -1);
|
||||
REQ_LONG(in, "cvc", 0, -1);
|
||||
|
||||
ret = PHP_API_OK;
|
||||
break;
|
||||
|
||||
case EXISTING_CARD:
|
||||
REQ_LONG(in, "paymentid", 0, -1); // now we have to make sure the payment id is valid for this customer
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case INVOICED:
|
||||
const PGresult *res = pgsql_query("SELECT * FROM members WHERE invoiced =1 AND id=%lu", in["member_id"].Long());
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
ret = PHP_API_OK;
|
||||
} else {
|
||||
out["error_status"] = "user not authorized to use invoice";
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long providers_call(CVars in, CVars &out)");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user