diff --git a/app/DataMapper/PaymentTransaction.php b/app/DataMapper/PaymentTransaction.php new file mode 100644 index 000000000000..8097902e3163 --- /dev/null +++ b/app/DataMapper/PaymentTransaction.php @@ -0,0 +1,29 @@ +intersectByKeys( $payment_methods_collections->flatten(1)->unique() ); - $multiplied = $collection->map(function ($item, $key) { - return $item * 2; + $payment_list = $payment_methods_intersect->map(function ($value, $key) { + + $gateway = $gateways->where('id', $key)->first(); + + $fee_label = $gateway->calcGatewayFee($amount, $this); + + return [ + 'company_gateway_id' => $key, + 'payment_method_id' => $value, + 'url' => $label + 'label' => ctrans('texts.'$gateway->type->alias) . $fee_label, + ]; + }); - + + } diff --git a/app/Models/CompanyGateway.php b/app/Models/CompanyGateway.php index 1ba12aa23587..891fac8a7f62 100644 --- a/app/Models/CompanyGateway.php +++ b/app/Models/CompanyGateway.php @@ -127,4 +127,19 @@ class CompanyGateway extends BaseModel { return ! empty($this->config('enablePayPal')); } + + /** + * Returns the formatted fee amount for the gateway + * + * @param float $amount The payment amount + * @param Client $client The client object + * @return string The fee amount formatted in the client currency + */ + public function calcGatewayFee($amount, Client $client) :string + { + + $fee = ''; + + } + }