return false; | return false; | ||||
} | } | ||||
public function isOnlinePaymentActive() | |||||
{ | |||||
return $this->online_payment || ($this->option_stripe_mode_test && Yii::$app->user->identity->status > 10); | |||||
} | |||||
public function isOnlinePaymentActiveAndTypeOrder() | |||||
{ | |||||
return $this->isOnlinePaymentActive() && $this->option_online_payment_type == 'order' ; | |||||
} | |||||
} | } | ||||
{ | { | ||||
public function safeUp() | public function safeUp() | ||||
{ | { | ||||
$this->addColumn('order', 'online_payment_url', Schema::TYPE_STRING); | |||||
$this->addColumn('order', 'online_payment_url', Schema::TYPE_TEXT); | |||||
} | } | ||||
public function safeDown() | public function safeDown() |
]) | ]) | ||||
->one(); | ->one(); | ||||
if ($order) { | |||||
if ($order && !$order->online_payment_url) { | |||||
if ($order->id_point_sale != $posts['Order']['id_point_sale']) { | if ($order->id_point_sale != $posts['Order']['id_point_sale']) { | ||||
$order->id_point_sale = $posts['Order']['id_point_sale']; | $order->id_point_sale = $posts['Order']['id_point_sale']; | ||||
$order->date_update = date('Y-m-d H:i:s'); | $order->date_update = date('Y-m-d H:i:s'); | ||||
return ['status' => 'error', 'errors' => $errors]; | return ['status' => 'error', 'errors' => $errors]; | ||||
} | } | ||||
if (($producer->online_payment || ($producer->option_stripe_mode_test && $user->status > 10)) | |||||
&& $producer->option_online_payment_type == 'order') { | |||||
if ($producer->isOnlinePaymentActiveAndTypeOrder()) { | |||||
$order = Order::searchOne([ | $order = Order::searchOne([ | ||||
'id' => $order->id | 'id' => $order->id | ||||
// Commandes de l'utilisateur | // Commandes de l'utilisateur | ||||
$ordersUserArray = []; | $ordersUserArray = []; | ||||
if (User::getCurrentId()) { | |||||
if (User::getCurrentId() && !$producer->isOnlinePaymentActiveAndTypeOrder()) { | |||||
$conditionsOrdersUser = [ | $conditionsOrdersUser = [ | ||||
'distribution.date > :date' | 'distribution.date > :date' | ||||
]; | ]; | ||||
} | } | ||||
$orderUser = Order::searchOne($conditionOrderUser); | $orderUser = Order::searchOne($conditionOrderUser); | ||||
if($orderUser && $orderUser->online_payment_url) { | |||||
$orderUser = false; | |||||
} | |||||
} | } | ||||
if ($orderUser) { | if ($orderUser) { |
<div id="order-success"> | <div id="order-success"> | ||||
<?php if($returnPayment != 'success'): ?> | |||||
<?php if($producer->isOnlinePaymentActive() && $returnPayment != 'success'): ?> | |||||
<div class="alert alert-danger"> | <div class="alert alert-danger"> | ||||
Le paiement en ligne a échoué.<br /> | |||||
<strong>Attention</strong>, votre commande sera effective à la réception du paiement. | |||||
<h5>Le paiement en ligne a échoué.</h5> | |||||
<strong>Attention</strong>, votre commande ne sera effective qu'à la réception du paiement.<br /> | |||||
<a href="<?= $order->online_payment_url ?>">Cliquez ici</a> pour recommencer votre paiement. | |||||
</div> | |||||
<?php else: ?> | |||||
<div class="alert alert-success"> | |||||
<span class="glyphicon glyphicon-ok glyphicon-big"></span> | |||||
<div class="content"> | |||||
<h3>Votre commande a bien été prise en compte</h3> | |||||
<?php if(!Yii::$app->user->isGuest): ?> | |||||
<a href="<?= Yii::$app->urlManagerProducer->createUrl(['order/history']) ?>" class="btn btn-default"> | |||||
<span class="glyphicon glyphicon-chevron-right"></span> | |||||
Voir toutes mes commandes | |||||
</a> | |||||
<?php endif; ?> | |||||
</div> | |||||
<div class="clr"></div> | |||||
</div> | </div> | ||||
<?php endif; ?> | <?php endif; ?> | ||||
<div class="alert alert-success"> | |||||
<span class="glyphicon glyphicon-ok glyphicon-big"></span> | |||||
<div class="content"> | |||||
<h3>Votre commande a bien été prise en compte</h3> | |||||
<?php if(!Yii::$app->user->isGuest): ?> | |||||
<a href="<?= Yii::$app->urlManagerProducer->createUrl(['order/history']) ?>" class="btn btn-default"> | |||||
<span class="glyphicon glyphicon-chevron-right"></span> | |||||
Voir toutes mes commandes | |||||
</a> | |||||
<?php endif; ?> | |||||
</div> | |||||
<div class="clr"></div> | |||||
</div> | |||||
<div class="alert alert-info alert-order-summary"> | <div class="alert alert-info alert-order-summary"> | ||||
<span class="glyphicon glyphicon-list-alt glyphicon-big"></span> | <span class="glyphicon glyphicon-list-alt glyphicon-big"></span> | ||||
<div class="content"> | <div class="content"> |
use yii\bootstrap\ActiveForm; | use yii\bootstrap\ActiveForm; | ||||
use common\models\Order ; | use common\models\Order ; | ||||
$producer = $this->context->getProducer(); | |||||
$this->setTitle('Mes commandes') ; | $this->setTitle('Mes commandes') ; | ||||
$this->addButton(['label' => '<span class="glyphicon glyphicon-plus"></span> Ajouter', 'url' => 'order/order', 'class' => 'btn btn-primary']) ; | $this->addButton(['label' => '<span class="glyphicon glyphicon-plus"></span> Ajouter', 'url' => 'order/order', 'class' => 'btn btn-primary']) ; | ||||
[ | [ | ||||
'label' => 'Actions', | 'label' => 'Actions', | ||||
'format' => 'raw', | 'format' => 'raw', | ||||
'value' => function($c) { | |||||
'value' => function($c) use ($producer) { | |||||
$html = '' ; | $html = '' ; | ||||
if($c->getState() == Order::STATE_OPEN) { | if($c->getState() == Order::STATE_OPEN) { | ||||
$html .= '<a href="'.Yii::$app->urlManager->createUrl(['order/order','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a> '. | |||||
'<a href="'.Yii::$app->urlManager->createUrl(['order/cancel','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-trash"></span></a> '. | |||||
(($c->id_subscription) ? '<a href="'.Yii::$app->urlManagerProducer->createUrl(['subscription/form','id'=>$c->id_subscription]).'" class="btn btn-default"><span class="glyphicon glyphicon-repeat"></span></a>' : '') ; | |||||
if ($producer->isOnlinePaymentActiveAndTypeOrder()) { | |||||
$paymentStatus = $c->getPaymentStatus(); | |||||
if($paymentStatus == Order::PAYMENT_UNPAID && $c->online_payment_url) { | |||||
$html .= '<a href="'.$c->online_payment_url.'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Payer en ligne</a>'; | |||||
} | |||||
} | |||||
else { | |||||
$html .= '<a href="'.Yii::$app->urlManager->createUrl(['order/order','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a> '. | |||||
'<a href="'.Yii::$app->urlManager->createUrl(['order/cancel','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-trash"></span></a> '. | |||||
(($c->id_subscription) ? '<a href="'.Yii::$app->urlManagerProducer->createUrl(['subscription/form','id'=>$c->id_subscription]).'" class="btn btn-default"><span class="glyphicon glyphicon-repeat"></span></a>' : '') ; | |||||
} | |||||
} | } | ||||
return $html ; | return $html ; | ||||
} | } |
<span class="glyphicon glyphicon-chevron-right"></span> | <span class="glyphicon glyphicon-chevron-right"></span> | ||||
<?php if($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?> | <?php if($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?> | ||||
Confirmez votre commande et retrouvez les informations liées au paiement sur la page suivante. | Confirmez votre commande et retrouvez les informations liées au paiement sur la page suivante. | ||||
<?php elseif($producer->online_payment && $producer->option_online_payment_type == 'order'): ?> | |||||
<?php elseif($producer->isOnlinePaymentActiveAndTypeOrder()): ?> | |||||
La commande est à payer en ligne lors de l'étape suivante. | La commande est à payer en ligne lors de l'étape suivante. | ||||
<?php else: ?> | <?php else: ?> | ||||
La commande sera à régler sur place. | La commande sera à régler sur place. |
padding: 0px; | padding: 0px; | ||||
} | } | ||||
/* line 34, ../sass/order/_confirm.scss */ | /* line 34, ../sass/order/_confirm.scss */ | ||||
.order-confirm #main #order-success .alert.alert-danger { | |||||
padding: 12px; | |||||
} | |||||
/* line 36, ../sass/order/_confirm.scss */ | |||||
.order-confirm #main #order-success .alert.alert-danger h5 { | |||||
margin-top: 10px; | |||||
margin-bottom: 10px; | |||||
} | |||||
/* line 42, ../sass/order/_confirm.scss */ | |||||
.order-confirm #main #order-success .alert strong { | .order-confirm #main #order-success .alert strong { | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
/* line 38, ../sass/order/_confirm.scss */ | |||||
/* line 46, ../sass/order/_confirm.scss */ | |||||
.order-confirm #main #order-success .alert .glyphicon-big { | .order-confirm #main #order-success .alert .glyphicon-big { | ||||
font-size: 90px; | font-size: 90px; | ||||
color: white; | color: white; | ||||
padding: 30px; | padding: 30px; | ||||
float: left; | float: left; | ||||
} | } | ||||
/* line 45, ../sass/order/_confirm.scss */ | |||||
/* line 53, ../sass/order/_confirm.scss */ | |||||
.order-confirm #main #order-success .alert div.content { | .order-confirm #main #order-success .alert div.content { | ||||
color: #333; | color: #333; | ||||
padding: 20px; | padding: 20px; | ||||
margin-left: 151px; | margin-left: 151px; | ||||
} | } | ||||
/* line 50, ../sass/order/_confirm.scss */ | |||||
/* line 58, ../sass/order/_confirm.scss */ | |||||
.order-confirm #main #order-success .alert div.content h3 { | .order-confirm #main #order-success .alert div.content h3 { | ||||
font-family: "capsuularegular"; | font-family: "capsuularegular"; | ||||
font-size: 30px; | font-size: 30px; | ||||
line-height: 35px; | line-height: 35px; | ||||
text-transform: none; | text-transform: none; | ||||
} | } | ||||
/* line 63, ../sass/order/_confirm.scss */ | |||||
/* line 71, ../sass/order/_confirm.scss */ | |||||
.order-confirm #main #order-success .alert div.content .locality { | .order-confirm #main #order-success .alert div.content .locality { | ||||
color: gray; | color: gray; | ||||
} | } |
.alert { | .alert { | ||||
padding: 0px ; | padding: 0px ; | ||||
&.alert-danger { | |||||
padding: 12px; | |||||
h5 { | |||||
margin-top: 10px; | |||||
margin-bottom: 10px; | |||||
} | |||||
} | |||||
strong { | strong { | ||||
font-weight: bold ; | font-weight: bold ; | ||||
} | } |