Proxima Login fail
Proxima
Wait, I don't see the user array.
function view_n8MSOne_checkout($_post, $_user, $_conf) {
if (!jrUser_is_logged_in()) {
$_re['msg'] = "user must be logged in";
fdebug($_user);
return n8MSOne_response($_re);
}
// validate post
$_data = n8MSOne_validate($_post);
$file = APP_DIR . "/modules/n8MSOne/lib/Stripe.php";
if (!is_file($file)) {
jrCore_logger('CRI', "unable to load stripe library");
$_re['msg'] = "Missing Stripe library";
return n8MSOne_response($_re);
}
require_once $file;
if ( strlen("{$_conf['n8MSOne_stripe_key']}") == 0) {
jrCore_logger('CRI', "Stripe API key not set");
$_re['msg'] = "System error";
return n8MSOne_response($_re);
}
Stripe::setApiKey("{$_conf['n8MSOne_stripe_key']}");
// Create the charge on Stripe's servers - this will charge the user's card
try {
$charge = Stripe_Charge::create(array(
"amount" => $_data['total'],
"card" => $_data['token'],
"description" => $_data['email'],
"currency" => "usd"
)
);
} catch(Stripe_CardError $e) {
$_re['msg'] = $e;
return n8MSOne_response($_re);
}
// Create transaction record
//$_data = n8MSOne_create_txn($_data, $charge);
// Create puchases record for user
//$_data = n8MSOne_create_purchases($_data);
// Create sales record for seller
//$_rs = n8MSOne_create_sales($_data);
fdebug($_user);
$_rs['type'] = "success";
$_rs['msg'] = $_user['user_id'];
// respond to app
return n8MSOne_response($_rs);
}