Skip to content

Commit 4728f14

Browse files
authored
Merge pull request #36 from kodbruket/v.1.3.8
Version 1.3.8
2 parents cedd5ea + b2d7b1c commit 4728f14

35 files changed

Lines changed: 1963 additions & 41 deletions

Block/Info/HostedWindow.php

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,30 @@ protected function _prepareSpecificInformation($transport = null)
6969

7070
$data = json_decode($transaction, true);
7171

72-
$transport->setData('ID', $data['id']);
73-
$transport->setData('Reference', $data['payment_ref']);
74-
$transport->setData('Status', $data['status']);
75-
$transport->setData('Payment method', $data['transaction_type']);
76-
$transport->setData('Card type', $data['payment_details']['card_type']);
77-
$transport->setData('Card number', $data['payment_details']['card_number']);
78-
$transport->setData('Card holder', $data['payment_details']['card_holder']);
79-
$transport->setData('MPI ref', $data['mpi_ref']);
80-
$transport->setData('SSN', $data['payment_details']['ssn']);
72+
if (array_key_exists('id', $data)) {
73+
$transport->setData('ID', $data['id']);
74+
$transport->setData('Reference', $data['payment_ref']);
75+
$transport->setData('Status', $data['status']);
76+
$transport->setData('Payment method', $data['transaction_type']);
77+
$transport->setData('Card type', $data['payment_details']['card_type']);
78+
$transport->setData('Card number', $data['payment_details']['card_number']);
79+
$transport->setData('Card holder', $data['payment_details']['card_holder']);
80+
$transport->setData('MPI ref', $data['mpi_ref']);
81+
$transport->setData('SSN', $data['payment_details']['ssn']);
8182

82-
$gender = '';
83+
$gender = '';
8384

84-
if (strtolower($data['payment_details']['country_code']) == 'swe' && strtolower($data['payment_details']['segmentation']) == 'b2c' && $data['payment_details']['ssn']) {
85-
$genderCheck = substr($data['payment_details']['ssn'], -2, 1);
86-
$gender = ($genderCheck % 2) ? 'Male' : 'Female';
87-
}
85+
if (strtolower($data['payment_details']['country_code']) == 'swe' && strtolower($data['payment_details']['segmentation']) == 'b2c' && $data['payment_details']['ssn']) {
86+
$genderCheck = substr($data['payment_details']['ssn'], -2, 1);
87+
$gender = ($genderCheck % 2) ? 'Male' : 'Female';
88+
}
8889

89-
$transport->setData('Gender', $gender);
90-
$transport->setData('Currency', strtoupper($data['currency']));
91-
$transport->setData('Payment link', $data['href']);
92-
$transport->setData('Created at', $data['created_at']);
93-
$transport->setData('Processed at', $data['processed_at']);
90+
$transport->setData('Gender', $gender);
91+
$transport->setData('Currency', strtoupper($data['currency']));
92+
$transport->setData('Payment link', $data['href']);
93+
$transport->setData('Created at', $data['created_at']);
94+
$transport->setData('Processed at', $data['processed_at']);
95+
}
9496

9597
$transport = parent::_prepareSpecificInformation($transport);
9698

Model/Api/Customer.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public function __construct(
5252
$this->_config = $config;
5353
$this->_storeManager = $storeManager;
5454
$this->urlBuilder = $urlBuilder;
55-
$this->objectManager = \Magento\Framework\App\ObjectManager::getInstance();
55+
if (!defined('PHPUNIT_MONDIDO_TESTSUITE')) {
56+
$this->objectManager = \Magento\Framework\App\ObjectManager::getInstance();
57+
}
5658
}
5759

5860
/**
@@ -100,7 +102,7 @@ public function create(\Magento\Customer\Model\Data\Customer $customer)
100102
$this->resource,
101103
[],
102104
[
103-
'ref' => $customer->getId(),
105+
'ref' => $customer->getId(),
104106
'metadata' => json_encode($metaData)
105107
]
106108
);
@@ -221,8 +223,8 @@ public function buildMetadata(\Magento\Customer\Model\Data\Customer $customer)
221223
// Setup basic data
222224
$metaData = [
223225
'firstname' => $customer->getFirstname(),
224-
'lastname' => $customer->getLastname(),
225-
'email' => $customer->getEmail(),
226+
'lastname' => $customer->getLastname(),
227+
'email' => $customer->getEmail(),
226228
];
227229

228230
// Fields to use when looking at addresses

Model/Api/Transaction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ protected function getItems($quote)
369369
'artno' => $shippingAddress->getShippingMethod(),
370370
'description' => $shippingAddress->getShippingDescription(),
371371
'qty' => 1,
372-
'amount' => $this->helper->formatNumber($baseShippingAmount),
372+
'amount' => $this->helper->formatNumber($shippingAddress->getBaseShippingInclTax()),
373373
'vat' => $this->helper->formatNumber($shippingVat),
374374
'discount' => $this->helper->formatNumber($shippingAddress->getBaseShippingDiscountAmount())
375375
];
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Mondido
4+
*
5+
* PHP version 5.6
6+
*
7+
* @category Mondido
8+
* @package Mondido_Mondido
9+
* @author Andreas Karlsson <andreas@kodbruket.se>
10+
* @license MIT License https://opensource.org/licenses/MIT
11+
* @link https://www.mondido.com
12+
*/
13+
14+
namespace Mondido\Mondido\Test\Unit\Api;
15+
16+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManager;
17+
18+
/**
19+
* GuestTransactionManagementInterfaceTest
20+
*
21+
* @category Mondido
22+
* @package Mondido_Mondido
23+
* @author Andreas Karlsson <andreas@kodbruket.se>
24+
* @license MIT License https://opensource.org/licenses/MIT
25+
* @link https://www.mondido.com
26+
*/
27+
class GuestTransactionManagementInterfaceTest extends \PHPUnit_Framework_TestCase
28+
{
29+
/**
30+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
31+
*/
32+
protected $objectManager;
33+
34+
/**
35+
* Set up
36+
*
37+
* @return void
38+
*/
39+
protected function setUp()
40+
{
41+
$this->objectManager = new ObjectManager($this);
42+
}
43+
44+
/**
45+
* Test execute
46+
*
47+
* @return void
48+
*/
49+
public function testExecute()
50+
{
51+
$this->assertEquals(1, 1);
52+
}
53+
54+
/**
55+
* Tear down
56+
*
57+
* @return void
58+
*/
59+
protected function tearDown()
60+
{
61+
$this->object = null;
62+
$this->objectManager = null;
63+
}
64+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Mondido
4+
*
5+
* PHP version 5.6
6+
*
7+
* @category Mondido
8+
* @package Mondido_Mondido
9+
* @author Andreas Karlsson <andreas@kodbruket.se>
10+
* @license MIT License https://opensource.org/licenses/MIT
11+
* @link https://www.mondido.com
12+
*/
13+
14+
namespace Mondido\Mondido\Test\Unit\Api;
15+
16+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManager;
17+
18+
/**
19+
* TransactionManagementInterfaceTest
20+
*
21+
* @category Mondido
22+
* @package Mondido_Mondido
23+
* @author Andreas Karlsson <andreas@kodbruket.se>
24+
* @license MIT License https://opensource.org/licenses/MIT
25+
* @link https://www.mondido.com
26+
*/
27+
class TransactionManagementInterfaceTest extends \PHPUnit_Framework_TestCase
28+
{
29+
/**
30+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
31+
*/
32+
protected $objectManager;
33+
34+
/**
35+
* Set up
36+
*
37+
* @return void
38+
*/
39+
protected function setUp()
40+
{
41+
$this->objectManager = new ObjectManager($this);
42+
}
43+
44+
/**
45+
* Test execute
46+
*
47+
* @return void
48+
*/
49+
public function testExecute()
50+
{
51+
$this->assertEquals(1, 1);
52+
}
53+
54+
/**
55+
* Tear down
56+
*
57+
* @return void
58+
*/
59+
protected function tearDown()
60+
{
61+
$this->object = null;
62+
$this->objectManager = null;
63+
}
64+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
/**
3+
* Mondido
4+
*
5+
* PHP version 5.6
6+
*
7+
* @category Mondido
8+
* @package Mondido_Mondido
9+
* @author Andreas Karlsson <andreas@kodbruket.se>
10+
* @license MIT License https://opensource.org/licenses/MIT
11+
* @link https://www.mondido.com
12+
*/
13+
14+
namespace Mondido\Mondido\Test\Unit\Block\Adminhtml\System\Config\Fieldset;
15+
16+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManager;
17+
18+
/**
19+
* GroupTest
20+
*
21+
* @category Mondido
22+
* @package Mondido_Mondido
23+
* @author Andreas Karlsson <andreas@kodbruket.se>
24+
* @license MIT License https://opensource.org/licenses/MIT
25+
* @link https://www.mondido.com
26+
*/
27+
class GroupTest extends \PHPUnit_Framework_TestCase
28+
{
29+
protected $object;
30+
31+
/**
32+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
33+
*/
34+
protected $objectManager;
35+
36+
/**
37+
* Set up
38+
*
39+
* @return void
40+
*/
41+
protected function setUp()
42+
{
43+
$this->objectManager = new ObjectManager($this);
44+
$this->object = $this->objectManager->getObject(
45+
'Mondido\Mondido\Block\Adminhtml\System\Config\Fieldset\Group'
46+
);
47+
}
48+
49+
/**
50+
* Test execute
51+
*
52+
* @return void
53+
*/
54+
public function testExecute()
55+
{
56+
$this->assertEquals(get_class($this->object), 'Mondido\Mondido\Block\Adminhtml\System\Config\Fieldset\Group');
57+
}
58+
59+
/**
60+
* Tear down
61+
*
62+
* @return void
63+
*/
64+
protected function tearDown()
65+
{
66+
$this->object = null;
67+
$this->objectManager = null;
68+
}
69+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
/**
3+
* Mondido
4+
*
5+
* PHP version 5.6
6+
*
7+
* @category Mondido
8+
* @package Mondido_Mondido
9+
* @author Andreas Karlsson <andreas@kodbruket.se>
10+
* @license MIT License https://opensource.org/licenses/MIT
11+
* @link https://www.mondido.com
12+
*/
13+
14+
namespace Mondido\Mondido\Test\Unit\Block\Adminhtml\System\Config\Fieldset;
15+
16+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManager;
17+
18+
/**
19+
* PaymentTest
20+
*
21+
* @category Mondido
22+
* @package Mondido_Mondido
23+
* @author Andreas Karlsson <andreas@kodbruket.se>
24+
* @license MIT License https://opensource.org/licenses/MIT
25+
* @link https://www.mondido.com
26+
*/
27+
class PaymentTest extends \PHPUnit_Framework_TestCase
28+
{
29+
protected $object;
30+
31+
/**
32+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
33+
*/
34+
protected $objectManager;
35+
36+
/**
37+
* Set up
38+
*
39+
* @return void
40+
*/
41+
protected function setUp()
42+
{
43+
$this->objectManager = new ObjectManager($this);
44+
$this->object = $this->objectManager->getObject(
45+
'Mondido\Mondido\Block\Adminhtml\System\Config\Fieldset\Payment'
46+
);
47+
}
48+
49+
/**
50+
* Test execute
51+
*
52+
* @return void
53+
*/
54+
public function testExecute()
55+
{
56+
$this->assertEquals(get_class($this->object), 'Mondido\Mondido\Block\Adminhtml\System\Config\Fieldset\Payment');
57+
}
58+
59+
/**
60+
* Tear down
61+
*
62+
* @return void
63+
*/
64+
protected function tearDown()
65+
{
66+
$this->object = null;
67+
$this->objectManager = null;
68+
}
69+
}

0 commit comments

Comments
 (0)