diff --git a/routes/web.php b/routes/web.php
index 84258c9a..4c13db32 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -598,14 +598,18 @@ Route::get('/yd/fix', function(){
});
Route::get('/billplz/fix', function(){
- $payments = \App\Models\Transaction::where('type', \App\Classes\ValueObjects\Constants\TransactionType::PAYMENT)->where('payment_method',\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_GATEWAY)->get();
+ $payments = \App\Models\Transaction::where('type', \App\Classes\ValueObjects\Constants\TransactionType::PAYMENT)->where('payment_method',\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_GATEWAY)->where('status', '!=', \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED)->get();
echo '
fixed orders
';
foreach ($payments as $payment){
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$payment->payment_reference);
if($response->successful()){
$data = $response->json();
- $orderNumber = $payment->owner->owner->owner->reference;
+ $invoice = $payment->owner;
+ $packingList = $invoice->owner;
+ $order = $packingList->owner;
+
+ $orderNumber = $order->reference;
if(!$data['paid'] && $payment->status === \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED) {
echo '
Fraude: '.$orderNumber.'
';
continue;
@@ -618,6 +622,9 @@ Route::get('/billplz/fix', function(){
$payment->status = \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED;
$payment->save();
+ $invoice->status = \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED;
+ $invoice->save();
+
$packingList = $payment->owner->owner;
if(app()->environment('production')){
(App()->make(UpdateDoFromVTPortalProcessor::class))->execute($packingList);