Merge pull request #4666 from beganovich/v5-show-only-credits-in-amount-exceed

(v5) Show "Apply credits" only
This commit is contained in:
David Bomba 2021-01-12 08:19:28 +11:00 committed by GitHub
commit 3e6f330643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -544,6 +544,14 @@ class Client extends BaseModel implements HasLocalePreference
} }
if (($this->getSetting('use_credits_payment') == 'option' || $this->getSetting('use_credits_payment') == 'always') && $this->service()->getCreditBalance() > 0) { if (($this->getSetting('use_credits_payment') == 'option' || $this->getSetting('use_credits_payment') == 'always') && $this->service()->getCreditBalance() > 0) {
// Show credits as only payment option if both statements are true.
if (
$this->service()->getCreditBalance() > $amount
&& $this->getSetting('use_credits_payment') == 'always') {
$payment_urls = [];
}
$payment_urls[] = [ $payment_urls[] = [
'label' => ctrans('texts.apply_credit'), 'label' => ctrans('texts.apply_credit'),
'company_gateway_id' => CompanyGateway::GATEWAY_CREDIT, 'company_gateway_id' => CompanyGateway::GATEWAY_CREDIT,