Skip to content

Commit

Permalink
added amount to convert payment and fixed service visibility bug
Browse files Browse the repository at this point in the history
  • Loading branch information
David Höck committed Mar 23, 2020
1 parent e465667 commit ee362c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Extension/ConvertPaymentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace CoreShop\Payum\MollieBundle\Extension;


use ArrayObject;
use Payum\Core\Bridge\Spl\ArrayObject;
use CoreShop\Component\Core\Model\OrderInterface;
use CoreShop\Component\Core\Model\PaymentInterface;
use CoreShop\Payum\MollieBundle\Model\MollieCustomerInterface;
Expand Down Expand Up @@ -46,6 +46,10 @@ public function onPostExecute(Context $context)

$data = [];

$data['amount'] = [
'value' => number_format(($payment->getTotalAmount() / 100), 2),
'currency' => $payment->getCurrencyCode()
];
$data['description'] = sprintf("Payment for order #%s", $order->getOrderNumber());
$data['locale'] = $order->getLocaleCode();
$data['metadata'] = json_encode([
Expand All @@ -61,7 +65,7 @@ public function onPostExecute(Context $context)
}

$result = ArrayObject::ensureArrayObject($request->getResult());
$result = array_merge($data, $result);
$result = is_array($result) ? array_merge($data, $result) : $data;
$request->setResult((array)$result);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
services:
_defaults:
public: true

CoreShop\Payum\MollieBundle\Form\Payment\MollieType:
tags:
Expand Down

0 comments on commit ee362c3

Please sign in to comment.