|
|
@@ -15,11 +15,13 @@ class PaymentController
|
|
|
public function index(PaymentManager $paymentManager, Config $config, Request $request): Response
|
|
|
{
|
|
|
$env = $request->header('env', 'release');
|
|
|
- if($env === 'release' || in_array($env, $config->supported_envs)) {
|
|
|
- $payments = $paymentManager->getAllPayment();
|
|
|
- } else {
|
|
|
- $payments = [];
|
|
|
+ $payments = array_column($paymentManager->getAllPayment(), null,'id');
|
|
|
+ $result = [];
|
|
|
+ foreach ($payments as $id => $payment) {
|
|
|
+ if (in_array($env, $config->getConfig('supported_env_'.$id))) {
|
|
|
+ $result[] = $payment;
|
|
|
+ }
|
|
|
}
|
|
|
- return success_response($payments);
|
|
|
+ return success_response($result);
|
|
|
}
|
|
|
}
|