Created
February 26, 2015 16:47
-
-
Save sparkandy/f9da1ee8ab84c521f9e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTES | |
******************************* | |
Route::get('subscription/{package_id}', ['as' => 'subscribe', 'uses' =>'SubscriptionController@getPackageid']); | |
Route::post('subscription', 'SubscriptionController@doSubscription'); | |
Route::get('merchantaccount', 'MerchantsController@merchantdetail'); | |
Route::get('acctype', 'MerchantsController@showAcctype'); | |
//Route::get('payment', 'SubscriptionController@showPayment'); | |
Route::get('payment/{transaction_id}', ['as' => 'payment', 'uses' =>'SubscriptionController@showPayment']); | |
Route::get('paymentcomplete/{transaction_id}', ['as' => 'paymentcomplete', 'uses' =>'SubscriptionController@dopaymentComplete']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function dopaymentComplete ($transaction_id){ | |
//dd($transaction_id); | |
$mertid = '1553'; | |
$type = ""; | |
$response = getStatus($transaction_id,$mertid,$type); | |
//dd($response); | |
//echo $transref; | |
//dd($transaction_id); | |
//dd($res); | |
$trancDetails = DB::table('subscriptions') | |
->where('transaction_id', '=', $transaction_id) | |
->first(); | |
$packageDetails = DB::table('packages') | |
//->join('packages', 'packages.package_id', '=', 'subscriptions.package_id') | |
->where('package_id', '=', $trancDetails->package_id) | |
->first(); | |
if ($packageDetails->price != 0) { | |
$response = strip_tags(preg_replace('#(<title.*?>).*?(</title>)#', '$1$2', $response)); | |
$ref = explode('-', $response); | |
$res = $ref [1]; | |
} else { | |
$res = 'C03'; | |
} | |
$start_date=date("d/m/Y"); | |
$end_date = date("d/m/Y", strtotime(+$trancDetails->duration."month")); | |
//dd($res); | |
//dd($trancDetails->duration); | |
//dd($trancDetails->merchant_id); | |
//dd($end_date); | |
$updated = DB::table('subscriptions') | |
->where('transaction_id', $transaction_id) | |
->update(array('transaction_status' => $res, 'start_date'=>$start_date, 'end_date'=>$end_date)); | |
//dd($updated); | |
$details = DB::table('subscriptions') | |
->join('packages', 'packages.package_id', '=', 'subscriptions.package_id') | |
->join('merchants', 'merchants.merchant_id', '=', 'subscriptions.merchant_id') | |
->join('users', 'users.user_id', '=', 'merchants.user_id') | |
->where('transaction_id', $transaction_id) | |
->first(); | |
//dd($details); | |
/* | |
$fromEmail = '[email protected]'; | |
$fromName = 'Martwire'; | |
$subject = 'Welcome to Martwire'; | |
//$data = Input::get('message'); | |
$total = $details->price * $details->duration; | |
$data = array( 'lastName' => $details->lastName, 'package_name' => $details->package_name, 'price' => $details->price, 'duration' => $details->duration, 'total' => $total, 'description' => $details->description, 'transaction_status' => $details->transaction_status); | |
//$toEmail = Input::get('email'); | |
//$toName = Input::get('firstname')." ".Input::get('lastname'); | |
$toEmail = $details->email; | |
$toName = $details->firstName." ".$details->lastName; | |
Mail::send('emails.subscriptiondetails', $data, function($message) use ($toEmail, $toName, $fromEmail, $fromName, $subject){ | |
$message->to($toEmail, $toName); | |
$message->from($fromEmail, $fromName); | |
$message->subject($subject); | |
});*/ | |
$title = 'Transaction Status - Martwire'; | |
//$categories_menu = getMenu_cart (); | |
return View::make('paymentcomplete')->with(array('title' => $title, 'res' => $res)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment