diff --git a/wrenchboard/etc/wrenchboard_api.conf b/wrenchboard/etc/wrenchboard_api.conf index 81c516d9..1c20667d 100644 --- a/wrenchboard/etc/wrenchboard_api.conf +++ b/wrenchboard/etc/wrenchboard_api.conf @@ -70,6 +70,16 @@ database: }; mailsend: +{ + from = "support@wrenchboard.com"; + server = "smtp.gmail.com"; + domain = "wrenchboard.com"; + user = "support@wrenchboard.com"; + pass = "may12002!"; + name = "WrenchBoard Demo Support"; +}; + +mailsend_no: { from = "dev-system@wrenchboard.com"; server = "smtp.gmail.com"; diff --git a/wrenchboard/src/include/history.h b/wrenchboard/src/include/history.h new file mode 100644 index 00000000..53ab5b81 --- /dev/null +++ b/wrenchboard/src/include/history.h @@ -0,0 +1,8 @@ +#ifndef __mx_history_h__ +#define __mx_history_h__ + +#include "vars.h" + +long WrenchPurchaseHx( CVars in, CVars &out ); + +#endif \ No newline at end of file diff --git a/wrenchboard/src/shared_tool/history.cc b/wrenchboard/src/shared_tool/history.cc new file mode 100644 index 00000000..ab8760a4 --- /dev/null +++ b/wrenchboard/src/shared_tool/history.cc @@ -0,0 +1,80 @@ + +// Account management toosl +#include "clog.h" +#include "cgi.h" +#include "input.h" +#include "wrenchboard_api.h" +#include "history.h" +#include "email.h" +#include "payments.h" +#include "safestring.h" +#include +#include "pgsql.h" +#include "pgsql_wrapper.h" +#include "cfg.h" +#include + + +long WrenchPurchaseHx( CVars in, CVars &out ) +{ + char vname[30]; + long ret = PHP_API_BAD_PARAM; + + logfmt( logINFO, "WrenchContractStatus()" ); + out["result"] = "Yes i go to this back end"; + + try { + long member_id = REQ_LONG( in, "member_id", 1, -1 ); + long limit = REQ_LONG( in, "limit", 1, -1 ); + REQ_LONG( in, "page", 1, -1 ); + REQ_STRING (in, "uid", 10, 100, "(.*)"); + + out["total_record"] = "0"; + const PGresult *res; + res = pgsql_query("SELECT added::date AS added_date," \ + " (CASE WHEN code ='MNCCD' THEN 'New Card Payment' " \ + "WHEN code ='MRCCD' THEN 'Repeat Card Payment' " \ + "ELSE '' END) AS description,amount*0.01 AS amount,fee*0.01 as fee,confirmation " \ + "FROM members_payments " \ + "WHERE member_id = %lu AND status = 1 ORDER BY id DESC LIMIT %lu",member_id,limit); + + if (res != NULL && pgsql_num_rows(res) > 0) { + out["total_record"] = pgsql_num_rows(res); + + for (int i = 0, n = pgsql_num_rows(res); i < n; i++) { + mapf = pgsql_fetch_assoc(res, i); + if (f.empty()) continue; + CVars rec; + map_to_cvars(f, rec); + + snprintf(vname, sizeof (vname), "added_date_%05d", i); + out[vname] = rec["added_date"]; + + snprintf(vname, sizeof (vname), "description_%05d", i); + out[vname] = rec["description"]; + + // amount | id | code | description | symbol | action_type | lorder | current_balance + snprintf(vname, sizeof (vname), "amount_%05d", i); + out[vname] = rec["amount"]; + + snprintf(vname, sizeof (vname), "fee_%05d", i); + out[vname] = rec["fee"]; + + snprintf(vname, sizeof (vname), "confirmation_%05d", i); + out[vname] = rec["confirmation"]; + + snprintf(vname, sizeof (vname), "card_icon_%05d", i); + out[vname] = rec["card_icon"]; + + } + } + ret = PHP_API_OK; + out["status"] = "OK"; + } catch (bad_parameter) { + logfmt(logINFO, "ERROR CALL long WrenchPurchaseHx(CVars in, CVars &out)"); + } + + logfmt( logINFO, "/WrenchPurchaseHx()" ); + return 0; +} +