Skip to content

Commit

Permalink
Merge pull request #10 from AndrewNovikof/fix_tests
Browse files Browse the repository at this point in the history
fix capture and refund, update readme, update tests
  • Loading branch information
AndrewNovikof authored Jan 22, 2019
2 parents 12f00cb + db22e58 commit cd57ad7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $gateway = Omnipay::create('Sberbank');
$gateway->authorize(
[
'orderNumber' => $localOrderNumber, // local order number
'amount' => $order_amount * 100, // The amount of payment in kopecks (or cents)
'amount' => $order_amount, // The amount of payment (you can use integer, decimal with 2 precisions or string equal to decimal
'returnUrl' => $callback_url // succesfull callback url
]
);
Expand Down Expand Up @@ -113,7 +113,7 @@ $gateway = Omnipay::create('Sberbank');
$response = $gateway->authorize(
[
'orderNumber' => $localOrderNumber, // local order number
'amount' => $order_amount * 100, // The amount of payment in kopecks (or cents)
'amount' => $order_amount, // The amount of payment (you can use integer, decimal with 2 precisions or string equal to decimal
'returnUrl' => $callback_url, // succesfull callback url
'description' => 'Order Description'
]
Expand Down Expand Up @@ -161,7 +161,7 @@ $gateway = Omnipay::create('Sberbank');
$response = $gateway->authorize(
[
'orderNumber' => $localOrderNumber, // local order number
'amount' => $order_amount * 100, // The amount of payment in kopecks (or cents)
'amount' => $order_amount, // The amount of payment (you can use integer, decimal with 2 precisions or string equal to decimal
'returnUrl' => $callback_url, // succesfull callback url
'description' => 'Order Description'
]
Expand Down Expand Up @@ -210,7 +210,7 @@ $gateway = Omnipay::create('Sberbank');
$response = $gateway->capture(
[
'orderId' => $localOrderNumber, // gateway order number
'amount' => $order_amount * 100, // The amount of payment in kopecks (or cents)
'amount' => $order_amount, // The amount of payment (you can use integer, decimal with 2 precisions or string equal to decimal
]
)->setUserName('merchant_login')
->setPassword('merchant_password')
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\Examples\\": "tests/Examples"
"Omnipay\\Sberbank\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
Expand Down
1 change: 0 additions & 1 deletion src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Omnipay\Sberbank\Message;

use Omnipay\Common\Exception\InvalidRequestException;
use Omnipay\Common\Exception\RuntimeException;
use Omnipay\Common\Message\AbstractRequest as BaseAbstractRequest;

Expand Down
2 changes: 1 addition & 1 deletion src/Message/CaptureRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function getData()

$data = [
'orderId' => $this->getOrderId(),
'amount' => $this->getAmount(),
'amount' => $this->getAmountInteger(),
];

return $data;
Expand Down
2 changes: 1 addition & 1 deletion src/Message/RefundRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function getData()

$data = [
'orderId' => $this->getOrderId(),
'amount' => $this->getAmount(),
'amount' => $this->getAmountInteger(),
];

return $data;
Expand Down
4 changes: 3 additions & 1 deletion tests/Message/CaptureRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ protected function getRequestParameters()
*/
public function testData()
{
$this->assertEquals($this->request->getData(), $this->getRequestParameters());
$params = $this->getRequestParameters();
$params['amount'] = $params['amount'] * 100;
$this->assertEquals($this->request->getData(), $params);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Message/RefundRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public function getMethod()
*/
public function testData()
{
$this->assertEquals($this->request->getData(), $this->getRequestParameters());
$params = $this->getRequestParameters();
$params['amount'] = $params['amount'] * 100;
$this->assertEquals($this->request->getData(), $params);
}

/**
Expand Down

0 comments on commit cd57ad7

Please sign in to comment.