Coupon redeem return
This commit is contained in:
@@ -73,7 +73,7 @@ logfmt(logINFO, "coupons_calls()");
|
||||
|
||||
long RedeemCoupon( CVars in, CVars &out ){
|
||||
logfmt(logINFO, "long RedeemCoupon( CVars in, CVars &out )()");
|
||||
long ret = 0;
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
|
||||
const PGresult *res;
|
||||
|
||||
@@ -83,10 +83,20 @@ long RedeemCoupon( CVars in, CVars &out ){
|
||||
REQ_LONG(in, "code_id", 1, -1);
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
|
||||
long payment_id = WrenchMemberCouponPayment( in, out );
|
||||
|
||||
long payment_id = 0;
|
||||
payment_id = WrenchMemberCouponPayment( in, out );
|
||||
if( payment_id > 0 ){
|
||||
out["payment_id"] = payment_id;
|
||||
out["status"] = "COMPLETED";
|
||||
out["status_text"] = "The coupon was redeemed successfully.";
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
else{
|
||||
out["status_text"] = "Unable to redeem the coupon.";
|
||||
}
|
||||
|
||||
} catch (bad_parameter) {
|
||||
out["status_text"] = "Unable to redeem the coupon.";
|
||||
ret = PHP_API_BAD_PARAM;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user