Skip to content

Commit

Permalink
Merge pull request #116 from michielgerritsen/bugfix/continue-payment
Browse files Browse the repository at this point in the history
Bugfix/continue payment
  • Loading branch information
Marvin-Magmodules authored May 6, 2019
2 parents eb7c1be + ee69266 commit 1edaaf9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/code/community/Mollie/Mpm/Model/Client/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function startTransaction(Mage_Sales_Model_Order $order)

$transactionId = $order->getMollieTransactionId();
if (!empty($transactionId)) {
$payment = $mollieApi->payments->get($transactionId);
$payment = $mollieApi->orders->get($transactionId);
return $payment->getCheckoutUrl();
}

Expand Down
27 changes: 27 additions & 0 deletions app/code/community/Mollie/Mpm/Test/Model/Client/OrdersTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

class Mollie_Mpm_Test_Model_Client_OrdersTest extends Mollie_Mpm_Test_TestHelpers_TestCase
{
public function testUsesTheCorrectApiToResumeTheTransaction()
{
$apiMock = $this->createMock('\Mollie\Api\MollieApiClient');
$ordersApiMock = $this->createMock('\Mollie\Api\Endpoints\OrderEndpoint');
$apiMock->orders = $ordersApiMock;

// Make sure the right API is called.
$ordersApiMock->expects($this->once())->method('get')->willReturn(new \Mollie\Api\Resources\Order($apiMock));

$mollieHelperMock = $this->getHelper('mpm');
$mollieHelperMock->method('getMollieAPI')->willReturn($apiMock);

$order = $this->getMockBuilder('Mage_Sales_Model_Order')
->setMethods(['getMollieTransactionId', 'getPayment'])
->getMock();

$order->method('getMollieTransactionId')->willReturn(123);
$order->method('getPayment')->willReturn(new Mage_Sales_Model_Order_Payment);

$instance = new Mollie_Mpm_Model_Client_Orders();
$instance->startTransaction($order);
}
}

0 comments on commit 1edaaf9

Please sign in to comment.