Emergency fix problem with group payment (reported by Eileen)

This commit is contained in:
Dillon Ngo
2023-12-21 02:17:04 +08:00
parent b4eca67a2f
commit 6f36c4b7ee
+19 -21
View File
@@ -3,7 +3,7 @@
namespace App\Console\Commands;
use App\Classes\Modules\Transactions\Services\ListsGroups;
use App\Classes\Modules\Transactions\Services\FetchesGroup;
use App\Classes\Modules\Transactions\Processors\ReleaseGoodsToCustomerProcessor;
use Carbon\Carbon;
use Illuminate\Console\Command;
@@ -24,8 +24,8 @@ class FixGroupPaymentProblem extends Command
*/
protected $description = 'This is a one time data patch for a problem result from Storage Invoice Implementation';
/** @var ListsGroups */
private $listsGroups;
/** @var FetchesGroup */
private $fetchesGroup;
/** @var ReleaseGoodsToCustomerProcessor */
private $releaseGoodsToCustomerProcessor;
@@ -36,10 +36,10 @@ class FixGroupPaymentProblem extends Command
*
* @return void
*/
public function __construct(ListsGroups $listsGroups, ReleaseGoodsToCustomerProcessor $releaseGoodsToCustomerProcessor)
public function __construct(FetchesGroup $fetchesGroup, ReleaseGoodsToCustomerProcessor $releaseGoodsToCustomerProcessor)
{
parent::__construct();
$this->listsGroups = $listsGroups;
$this->fetchesGroup = $fetchesGroup;
$this->releaseGoodsToCustomerProcessor = $releaseGoodsToCustomerProcessor;
}
@@ -56,27 +56,25 @@ class FixGroupPaymentProblem extends Command
$this->info(Carbon::now() . ': Start data patch.');
$start = new Carbon();
$newfilters['id'] = 325;
$groups = $this->listsGroups->execute($newfilters);
$group = $this->fetchesGroup->execute(['id' => 325]);
foreach ($groups as $group){
$this->info('CheckForStorageInvoiceByTransactions group: '.json_encode($group));
if ($group) {
foreach ($group->groupTransactions as $groupTransaction) {
$invoice = $groupTransaction->transaction;
$this->info('CheckForStorageInvoiceByTransactions group: '.json_encode($invoice));
//$paymentTransaction = $this->createPaymentTransactionProcessor->execute($invoice, PaymentMethodType::WALLET, null);
$this->info('FixGroupPaymentProblem group: '.json_encode($group));
if ($group) {
foreach ($group->groupTransactions as $groupTransaction) {
$invoice = $groupTransaction->transaction;
$this->info('FixGroupPaymentProblem group: '.json_encode($invoice));
//$paymentTransaction = $this->createPaymentTransactionProcessor->execute($invoice, PaymentMethodType::WALLET, null);
//if($paymentTransaction && $paymentTransaction->status == ApprovalStatus::APPROVED){
$pL = $invoice->owner;
$this->releaseGoodsToCustomerProcessor->execute($pL, $invoice);
//}
}
// $group->status = $status;
// $group->save();
//if($paymentTransaction && $paymentTransaction->status == ApprovalStatus::APPROVED){
$pL = $invoice->owner;
$this->releaseGoodsToCustomerProcessor->execute($pL, $invoice);
//}
}
// $group->status = $status;
// $group->save();
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');