Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrik Sundell committed Sep 12, 2019
2 parents ab2f83f + 0a72aee commit e4a24cd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sveaekonomi/webpay",
"version": "3.11.1",
"version": "3.11.2",
"description": "Php integration library for Svea Ekonomis payment methods",
"license": "Apache-2.0",
"authors": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ protected function formatXml($hostedAdminResponseXML)
$newrow
->setName((string)$orderrow['name'])
->setAmountExVat(floatval(($orderrow['amount'] - $orderrow['vat'])) / 100)
->setAmountIncVat(floatval($orderrow['amount'])/100)
->setDescription((string)$orderrow['description'])
->setQuantity(floatval((string)$orderrow['quantity']))
->setArticleNumber((string)$orderrow['sku'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
namespace Svea\WebPay\Test\UnitTest\HostedService\HandleOrder;


use Svea\WebPay\Config\ConfigurationProvider;
use Svea\WebPay\Config\ConfigurationService;
use Svea\WebPay\HostedService\HostedResponse\HostedAdminResponse\QueryTransactionResponse;
use Svea\WebPay\Response\SveaResponse;

class QueryTransactionResponseTest extends \PHPUnit\Framework\TestCase
{
Expand Down Expand Up @@ -34,4 +37,21 @@ function test_calculateVatPercentFromVatAndAmount_returns_correct_vatpercent_if_

$this->assertEquals("0.00", $test);
}

function test_QueryTransactionResponse_contains_amountincvat_and_amountexvat()
{
$message = new \SimpleXMLElement("<?xml version='1.0' encoding='UTF-8'?><response><message>PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48cmVzcG9uc2U+PHRyYW5zYWN0aW9uIGlkPSI3MTU2NDgiPjxjdXN0b21lcnJlZm5vPjQ5MzcyMDU8L2N1c3RvbWVycmVmbm8+P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nJvd3M+PC90cmFuc2FjdGlvbj48c3RhdHVzY29kZT4wPC9zdGF0dXNjb2RlPjwvcmVzcG9uc2U+</message><merchantid>1130</merchantid><mac>c973795d51add05a20f82fe030a34866edf0ce2abfbb41b829e0f161f53291f95cc74fdb50e1d86e2ab0d2eee8a53cd3f3418ff6266fc6af987b83fbfaccfd82</mac></response>");
$countryCode = "SE";
$config = ConfigurationService::getTestConfig();

$queryTransactionResponse = new QueryTransactionResponse($message, $countryCode, $config);

$this->assertEquals("501.0",$queryTransactionResponse->numberedOrderRows[0]->amountExVat);
$this->assertEquals("626.25",$queryTransactionResponse->numberedOrderRows[0]->amountIncVat);
$this->assertEquals("0",$queryTransactionResponse->numberedOrderRows[1]->amountExVat);
$this->assertEquals("0",$queryTransactionResponse->numberedOrderRows[1]->amountIncVat);
$this->assertEquals("-50.1",$queryTransactionResponse->numberedOrderRows[2]->amountExVat);
$this->assertEquals("-62.62",$queryTransactionResponse->numberedOrderRows[2]->amountIncVat);

}
}
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "3.11.1"
"version": "3.11.2"
}

0 comments on commit e4a24cd

Please sign in to comment.