Skip to content

Commit

Permalink
solve payment issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvirsinh_gohil committed Jan 11, 2022
1 parent dcb3dde commit bcd8037
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/Models/Payment.php
Original file line number Diff line number Diff line change
@@ -442,7 +442,7 @@ public static function generatePayment($transaction)

$serial = (new SerialNumberFormatter())
->setModel(new Payment())
->setCompany(request()->header('company'))
->setCompany($invoice->company_id)
->setCustomer($invoice->customer_id)
->setNextNumbers();

@@ -455,7 +455,7 @@ public static function generatePayment($transaction)
$data['exchange_rate'] = $invoice->exchange_rate;
$data['base_amount'] = $data['amount'] * $data['exchange_rate'];
$data['currency_id'] = $invoice->currency_id;
$data['company_id'] = request()->header('company');
$data['company_id'] = $invoice->company_id;
$data['transaction_id'] = $transaction->id;

$payment = Payment::create($data);
10 changes: 7 additions & 3 deletions app/Models/PaymentMethod.php
Original file line number Diff line number Diff line change
@@ -36,6 +36,11 @@ public function company()
return $this->belongsTo(Company::class);
}

public function scopeWhereCompanyId($query, $id)
{
$query->where('company_id', $id);
}

public function scopeWhereCompany($query)
{
$query->where('company_id', request()->header('company'));
@@ -48,7 +53,7 @@ public function scopeWherePaymentMethod($query, $payment_id)

public function scopeWhereSearch($query, $search)
{
$query->where('name', 'LIKE', '%' . $search . '%');
$query->where('name', 'LIKE', '%'.$search.'%');
}

public function scopeApplyFilters($query, array $filters)
@@ -88,8 +93,7 @@ public static function createPaymentMethod($request)

public static function getSettings($id)
{
$settings = PaymentMethod::whereCompany()
->find($id)
$settings = PaymentMethod::find($id)
->settings;

return $settings;

0 comments on commit bcd8037

Please sign in to comment.