Procházet zdrojové kódy

Merge branch 'dev'

prodstable
Guillaume před 3 roky
rodič
revize
148c36922a
6 změnil soubory, kde provedl 64 přidání a 31 odebrání
  1. +1
    -1
      common/helpers/MeanPayment.php
  2. +3
    -2
      common/models/Order.php
  3. +20
    -0
      console/migrations/m210920_060127_add_field_order_online_payment_url.php
  4. +27
    -26
      producer/controllers/CreditController.php
  5. +6
    -2
      producer/controllers/OrderController.php
  6. +7
    -0
      producer/views/order/confirm.php

+ 1
- 1
common/helpers/MeanPayment.php Zobrazit soubor

@@ -56,7 +56,7 @@ class MeanPayment {
public static function getStrBy($meanPayment)
{
switch($meanPayment) {
case self::CREDIT_CARD : return 'Carte bancaire' ;
case self::CREDIT_CARD : return 'Paiement en ligne' ;
case self::MONEY : return 'Espèces' ;
case self::CHEQUE : return 'Chèque' ;
case self::TRANSFER : return 'Virement' ;

+ 3
- 2
common/models/Order.php Zobrazit soubor

@@ -103,7 +103,7 @@ class Order extends ActiveRecordCommon
[['id_user', 'date', 'status'], 'required', 'message' => ''],
[['id_user', 'id_point_sale', 'id_distribution', 'id_subscription', 'id_invoice', 'id_quotation', 'id_delivery_note'], 'integer'],
[['auto_payment', 'tiller_synchronization', 'delivery_home'], 'boolean'],
[['status', 'reference', 'delivery_address'], 'string'],
[['status', 'reference', 'delivery_address', 'online_payment_url'], 'string'],
[['date', 'date_update', 'comment', 'comment_point_sale', 'mean_payment'], 'safe']
];
}
@@ -127,7 +127,8 @@ class Order extends ActiveRecordCommon
'id_delivery_note' => 'Bon de livraison',
'reference' => 'Référence',
'delivery_home' => 'Livraison à domicile',
'delivery_address' => 'Adresse de livraison'
'delivery_address' => 'Adresse de livraison',
'online_payment_url' => 'URL de paiement'
];
}


+ 20
- 0
console/migrations/m210920_060127_add_field_order_online_payment_url.php Zobrazit soubor

@@ -0,0 +1,20 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m210920_060127_add_field_order_online_payment_url
*/
class m210920_060127_add_field_order_online_payment_url extends Migration
{
public function safeUp()
{
$this->addColumn('order', 'online_payment_url', Schema::TYPE_STRING);
}

public function safeDown()
{
$this->dropColumn('producer', 'online_payment_url');
}
}

+ 27
- 26
producer/controllers/CreditController.php Zobrazit soubor

@@ -248,32 +248,33 @@ class CreditController extends ProducerBaseController
);
}
}

// envoi d'un email de confirmation
$user = User::findOne($paymentIntentMetadata->user_id);
$userProducer = UserProducer::find()
->where([
'id_user' => $idUser,
'id_producer' => $idProducer
])
->one();

$paramsEmail = [
'from_email' => $producer->getEmailOpendistrib(),
'from_name' => $producer->name,
'to_email' => $user->email,
'to_name' => $user->getUsername(),
'subject' => '['.$producer->name.'] Alimentation de votre crédit',
'content_view_text' => '@common/mail/creditConfirm-text.php',
'content_view_html' => '@common/mail/creditConfirm-html.php',
'content_params' => [
'user' => $user,
'userProducer' => $userProducer,
'producer' => $producer,
'amount' => $amount,
]
] ;
Mailjet::sendMail($paramsEmail);
else {
// envoi d'un email de confirmation
$user = User::findOne($paymentIntentMetadata->user_id);
$userProducer = UserProducer::find()
->where([
'id_user' => $idUser,
'id_producer' => $idProducer
])
->one();

$paramsEmail = [
'from_email' => $producer->getEmailOpendistrib(),
'from_name' => $producer->name,
'to_email' => $user->email,
'to_name' => $user->getUsername(),
'subject' => '['.$producer->name.'] Alimentation de votre crédit',
'content_view_text' => '@common/mail/creditConfirm-text.php',
'content_view_html' => '@common/mail/creditConfirm-html.php',
'content_params' => [
'user' => $user,
'userProducer' => $userProducer,
'producer' => $producer,
'amount' => $amount,
]
] ;
Mailjet::sendMail($paramsEmail);
}

break;


+ 6
- 2
producer/controllers/OrderController.php Zobrazit soubor

@@ -313,6 +313,9 @@ class OrderController extends ProducerBaseController
),
]);
$redirect = $checkout_session->url;

$order->online_payment_url = $redirect;
$order->save();
}
}

@@ -958,7 +961,7 @@ class OrderController extends ProducerBaseController
return $pointsSaleArray;
}

public function actionConfirm($idOrder)
public function actionConfirm($idOrder, $returnPayment = '')
{
$order = Order::searchOne(['id' => $idOrder]);
$producer = $this->getProducer();
@@ -968,7 +971,8 @@ class OrderController extends ProducerBaseController
}

return $this->render('confirm', [
'order' => $order
'order' => $order,
'returnPayment' => $returnPayment
]);
}


+ 7
- 0
producer/views/order/confirm.php Zobrazit soubor

@@ -46,6 +46,13 @@ $producer = GlobalParam::getCurrentProducer() ;

<div id="order-success">

<?php if($returnPayment != 'success'): ?>
<div class="alert alert-danger">
Le paiement en ligne a échoué.<br />
<strong>Attention</strong>, votre commande sera effective à la réception du paiement.
</div>
<?php endif; ?>

<div class="alert alert-success">
<span class="glyphicon glyphicon-ok glyphicon-big"></span>
<div class="content">

Načítá se…
Zrušit
Uložit