This commit is contained in:
franknstayn
2021-07-04 18:42:52 +08:00
parent 5483c9517d
commit dc868ab336
7 changed files with 392 additions and 349 deletions

View File

@@ -28,30 +28,43 @@ class PaypalController extends Controller
public function __construct()
{
$paypal_env = "live";
$paypal_apiUrl = 'https://api.paypal.com'; // default
if($paypal_env == 'live'){
$paypal_apiUrl = 'https://api.paypal.com';
}else{
$paypal_apiUrl = 'https://api.sandbox.paypal.com';
}
$this->_apiContext = PayPal::ApiContext(
config('services.paypal.client_id'),
config('services.paypal.secret')
config('services.paypal_'.$paypal_env.'.client_id'),
config('services.paypal_'.$paypal_env.'.secret')
// config('services.paypal_live.client_id'),
// config('services.paypal_live.secret')
);
// $this->_apiContext->setConfig(array(
// 'mode' => 'sandbox',
// 'service.EndPoint' => 'https://api.sandbox.paypal.com',
// 'http.ConnectionTimeOut' => 30,
// 'log.LogEnabled' => true,
// 'log.FileName' => storage_path('logs/paypal.log'),
// 'log.LogLevel' => 'FINE'
// ));
// live
$this->_apiContext->setConfig(array(
'mode' => 'live',
'service.EndPoint' => 'https://api.paypal.com',
$this->_apiContext->setConfig(array(
'mode' => $paypal_env,
'service.EndPoint' => $paypal_apiUrl,
'http.ConnectionTimeOut' => 30,
'log.LogEnabled' => true,
'log.FileName' => storage_path('logs/paypal.log'),
'log.LogLevel' => 'FINE'
));
));
// live
// $this->_apiContext->setConfig(array(
// 'mode' => 'sandbox',
// 'service.EndPoint' => 'https://api.paypal.com',
// 'http.ConnectionTimeOut' => 30,
// 'log.LogEnabled' => true,
// 'log.FileName' => storage_path('logs/paypal.log'),
// 'log.LogLevel' => 'FINE'
// ));
}
@@ -385,8 +398,8 @@ class PaypalController extends Controller
);
Mail::send('emails.orders', $data, function ($message) use ($data) {
$message->from('no-reply@crewsportswear.com', 'CREW Sportswear');
$message->bcc($data['email_cc'], 'Orders From CREW Sportswear');
$message->from('no-reply@crewsportswear.com', 'Merchbay');
$message->bcc($data['email_cc'], 'Orders From Merchbay');
$message->to($data['receiver'])->subject($data['subject']);
});
// end email sending