diff --git a/app/Services/Client/PaymentMethod.php b/app/Services/Client/PaymentMethod.php index 6f8846d622ac..59253d0883b4 100644 --- a/app/Services/Client/PaymentMethod.php +++ b/app/Services/Client/PaymentMethod.php @@ -107,7 +107,7 @@ class PaymentMethod ->company ->company_gateways ->whereIn('id', $transformed_ids) - ->where('gateway_key', '=', '54faab2ab6e3223dbe848b1686490baa') + ->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa') ->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority return array_search($model->id, $transformed_ids);// this closure sorts for us }); @@ -117,7 +117,7 @@ class PaymentMethod $this->gateways = $this->client ->company ->company_gateways - ->where('gateway_key', '=', '54faab2ab6e3223dbe848b1686490baa') + ->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa') ->where('is_deleted', false); } @@ -163,13 +163,16 @@ class PaymentMethod //note we have to use GatewayType::CREDIT_CARD as alias for CUSTOM foreach ($this->gateways as $gateway) { + foreach ($gateway->driver($this->client)->gatewayTypes() as $type) { + if (isset($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, $type)) { - if ($this->validGatewayForAmount($gateway->fees_and_limits->{GatewayType::CREDIT_CARD}, $this->amount)) { - $this->payment_methods->push([$gateway->id => $type]); - } + + if ($this->validGatewayForAmount($gateway->fees_and_limits->{GatewayType::CREDIT_CARD}, $this->amount)) + $this->payment_methods[] = [$gateway->id => $type]; + } else { - $this->payment_methods->push([$gateway->id => NULL]); + $this->payment_methods[] = [$gateway->id => NULL]; } } }