Browse Source

[Backend] Problème synchronisation Tiller #238

refactoring
Guillaume 2 years ago
parent
commit
0d31ba5e27
4 changed files with 1427 additions and 1324 deletions
  1. +1396
    -1320
      backend/controllers/DistributionController.php
  2. +1
    -1
      common/helpers/Tiller.php
  3. +4
    -3
      common/models/Order.php
  4. +26
    -0
      console/migrations/m220802_092239_add_field_order_tiller_external_id.php

+ 1396
- 1320
backend/controllers/DistributionController.php
File diff suppressed because it is too large
View File


+ 1
- 1
common/helpers/Tiller.php View File

$ordersOpendistribSynchro[$orderOpendistrib->id] = false; $ordersOpendistribSynchro[$orderOpendistrib->id] = false;
if(isset($ordersTiller->orders)) { if(isset($ordersTiller->orders)) {
foreach ($ordersTiller->orders as $orderTiller) { foreach ($ordersTiller->orders as $orderTiller) {
if ($orderOpendistrib->id == $orderTiller->externalId
if ($orderOpendistrib->tiller_external_id == $orderTiller->externalId
&& (int) round($orderOpendistrib->getAmountWithTax(Order::AMOUNT_TOTAL) * 100) == (int) $orderTiller->currentBill) { && (int) round($orderOpendistrib->getAmountWithTax(Order::AMOUNT_TOTAL) * 100) == (int) $orderTiller->currentBill) {


$ordersOpendistribSynchro[$orderOpendistrib->id] = true; $ordersOpendistribSynchro[$orderOpendistrib->id] = true;

+ 4
- 3
common/models/Order.php View File

'integer' 'integer'
], ],
[['auto_payment', 'tiller_synchronization', 'delivery_home'], 'boolean'], [['auto_payment', 'tiller_synchronization', 'delivery_home'], 'boolean'],
[['status', 'reference', 'delivery_address', 'online_payment_url'], 'string'],
[['date', 'date_update', 'comment', 'comment_point_sale', 'mean_payment'], 'safe']
[['status', 'reference', 'delivery_address', 'online_payment_url', 'tiller_external_id'], 'string'],
[['date', 'date_update', 'comment', 'comment_point_sale', 'mean_payment', 'tiller_external_id'], 'safe']
]; ];
} }


'reference' => 'Référence', 'reference' => 'Référence',
'delivery_home' => 'Livraison à domicile', 'delivery_home' => 'Livraison à domicile',
'delivery_address' => 'Adresse de livraison', 'delivery_address' => 'Adresse de livraison',
'online_payment_url' => 'URL de paiement'
'online_payment_url' => 'URL de paiement',
'tiller_external_id' => 'Tiller : externalId',
]; ];
} }



+ 26
- 0
console/migrations/m220802_092239_add_field_order_tiller_external_id.php View File

<?php

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

/**
* Class m220802_092239_add_field_order_tiller_external_id
*/
class m220802_092239_add_field_order_tiller_external_id extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('order', 'tiller_external_id', Schema::TYPE_STRING.' DEFAULT NULL');
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('order', 'tiller_external_id');
}
}

Loading…
Cancel
Save