From 222e593e3ef0dafb42db91d23e8cfc78bd4a9604 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 23 Sep 2024 10:30:11 -0400 Subject: [PATCH] No refund reversals --- wrenchboard/src/include/wrenchboard_api.h | 2 ++ wrenchboard/src/shared_tool/jobs.cc | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/wrenchboard/src/include/wrenchboard_api.h b/wrenchboard/src/include/wrenchboard_api.h index 571e66e5..679826ef 100644 --- a/wrenchboard/src/include/wrenchboard_api.h +++ b/wrenchboard/src/include/wrenchboard_api.h @@ -30,6 +30,8 @@ enum { PARTNER_STRIPE }; #define OFFER_REJECT 333 #define OFFER_CANCEL 222 #define OFFER_EXPIRE 444 +#define OFFER_NOREFU 445 + #define OFFER_EXTEND 555 #define OFFER_SENDTOME 777 diff --git a/wrenchboard/src/shared_tool/jobs.cc b/wrenchboard/src/shared_tool/jobs.cc index 904d1d40..9c9c53ae 100644 --- a/wrenchboard/src/shared_tool/jobs.cc +++ b/wrenchboard/src/shared_tool/jobs.cc @@ -1193,6 +1193,8 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { break; case OFFER_EXPIRE: // note status 4 + case OFFER_NOREFU: + logfmt(logINFO, "WrenchConcludeJobsOffer() rc=OFFER_EXPIRE"); if (load_db_record(out, "SELECT id AS offer_id,* FROM members_jobs_offer WHERE offer_code ='%s' AND status = 1", in["offer_code"].c_str())) { // valid load of offer needed @@ -1207,11 +1209,25 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { y["dir"].set_valid(true); y["payment_id"] = out["payment_id"]; y["payment_id"].set_valid(true); + + if ( offer_result == OFFER_EXPIRE){ + if (WrenchRefundoffer(y, out) == PHP_CREATED_OK) { + pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str()); + // REFUND THE MONEY + //job_email(JOBS_OFFER_CANCEL_MAIL, in, out); // the email will come from offer table + } + } + if ( offer_result == OFFER_NOREFU){ + pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str()); + } + + if (WrenchRefundoffer(y, out) == PHP_CREATED_OK) { pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str()); // REFUND THE MONEY //job_email(JOBS_OFFER_CANCEL_MAIL, in, out); // the email will come from offer table } + } break; }