1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Extract convertToMolieAmount method

This commit is contained in:
Benjamin Beganović 2021-08-02 15:49:50 +02:00
parent b144d1e031
commit d7577b001c
2 changed files with 13 additions and 2 deletions

View File

@ -52,7 +52,7 @@ class CreditCard
public function paymentResponse(PaymentResponseRequest $request)
{
// TODO: Unit tests.
$amount = number_format((float) $this->mollie->payment_hash->data->amount_with_fee, 2, '.', '');
$amount = $this->mollie->convertToMollieAmount((float) $this->mollie->payment_hash->data->amount_with_fee);
$this->mollie->payment_hash
->withData('gateway_type_id', GatewayType::CREDIT_CARD)

View File

@ -115,7 +115,7 @@ class MolliePaymentDriver extends BaseDriver
public function refund(Payment $payment, $amount, $return_client_response = false)
{
return $this->payment_method->yourRefundImplementationHere();
}
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
@ -192,4 +192,15 @@ class MolliePaymentDriver extends BaseDriver
);
}
}
/**
* Convert the amount to the format that Mollie supports.
*
* @param mixed|float $amount
* @return string
*/
public function convertToMollieAmount($amount): string
{
return \number_format((float) $amount, 2, '.', '');
}
}