mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-01-16 19:05:08 -05:00
RegistrationFormStep Module Update - Fix paypal redirect and dicounting
This commit is contained in:
@@ -91,9 +91,20 @@ class RegistrationFormStepsController extends Controller
|
||||
|
||||
public function paypal(Request $request)
|
||||
{
|
||||
|
||||
$subscription_id = null;
|
||||
if(!$request->has('subscription_id') && $request->has('ba_token')){
|
||||
$subscription_id = Cache::get($request->ba_token);
|
||||
Cache::forget($request->ba_token);
|
||||
}
|
||||
|
||||
if($request->has('subscription_id')){
|
||||
$subscription_id =$request->subscription_id;
|
||||
}
|
||||
|
||||
if($subscription_id != null){
|
||||
|
||||
$response = $this->paypalPayment->showSubscription($request->subscription_id);
|
||||
$response = $this->paypalPayment->showSubscription($subscription_id);
|
||||
if(isset($response->status)){
|
||||
if($response->status == 'APPROVED'){
|
||||
|
||||
@@ -275,12 +286,16 @@ class RegistrationFormStepsController extends Controller
|
||||
} else if($request->payment_method == "paypal") {
|
||||
|
||||
$paypalResponse = $this->paypalPayment->payment($request->all(),$planPrice);
|
||||
$data = $paypalResponse->links[0];
|
||||
|
||||
if($paypalResponse->links[0]->rel != 'approve'){
|
||||
if($data->rel != 'approve'){
|
||||
return response()->json(['success' => false, 'message' => 'Payment Error, , please try again later.']);
|
||||
}
|
||||
|
||||
return response()->json(['success' => true, 'redirect_url' => $paypalResponse->links[0]->href]);
|
||||
parse_str(parse_url($data->href)['query'], $params);
|
||||
Cache::put($params['ba_token'],$paypalResponse->id);
|
||||
|
||||
return response()->json(['success' => true, 'redirect_url' => $data->href]);
|
||||
|
||||
} else if($request->payment_method == "prepaid") {
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"/js/register.js": "/js/register.js?id=4b3408bf5b625cf29c56838b5fa6909c",
|
||||
"/js/register.js": "/js/register.js?id=de966932fc654831a29a492897ef76d3",
|
||||
"/css/register.css": "/css/register.css?id=aafe52430d016e7da871a5ded7272d9d",
|
||||
"/css/base.css": "/css/base.css?id=098c47fab7cda21288aa1efbde99a6f1"
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ export default {
|
||||
duration_off = '',
|
||||
discounted_price = parseFloat(subscription_price_monthly).toFixed(2);
|
||||
|
||||
if(e.applied_coupon && e.coupon_discount.plan_ids.includes(subscription.data('subscription-plan-price-id'))){
|
||||
if(e.applied_coupon && e.coupon_discount.plan_ids.includes(parseInt(subscription.val()))){
|
||||
|
||||
duration_off = (e.coupon_discount.duration == 'Once' ? 'for 1st month' : `/ mo for ${subscription_interval} months`);
|
||||
if(e.coupon_discount.type == 'Amount'){
|
||||
@@ -277,7 +277,6 @@ export default {
|
||||
if (status == 200) {
|
||||
e.applied_coupon = true;
|
||||
e.coupon_discount = data;
|
||||
console.log(e.coupon_discount.discount)
|
||||
e.$toast.add({ severity: 'success', summary: 'Success', detail: data.message, life: 3000 });
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user