Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed cashbox api end points #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Actions/Cashbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait Cashbox
public function getCashBox()
{
try {
$response = $this->exec('/', 'GET');
$response = $this->exec('/action/show', 'GET');
} catch (Exception $e) {
return ['error' => $e->getMessage()];
}
Expand All @@ -32,7 +32,7 @@ public function deleteCashBox()
{

try {
$this->exec('/', 'DELETE');
$this->exec('/action/delete', 'DELETE');
} catch (Exception $e) {
return ['error' => $e->getMessage()];
}
Expand All @@ -49,7 +49,7 @@ public function updateCashBox($data)
$this->preparePostData($data);

try {
$response = $this->exec('/', 'POST');
$response = $this->exec('/action/update', 'POST');
} catch (Exception $e) {
return ['error' => $e->getMessage()];
}
Expand Down
70 changes: 38 additions & 32 deletions tests/Actions/CashboxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ protected function setUP(): void

/**
* Test get cash box
* @test
* @covers \Flamix\Kassa\API::getCashBox()
*/
public function testGetCashbox()
{
Expand All @@ -34,39 +36,43 @@ public function testGetCashbox()
$this->assertArrayHasKey('cashbox', $response, $response['error']);
}

/**
* Test get cash box
*/
public function testUpdateCashbox()
{
$response = $this->kassa->updateCashBox([
'user_id' => 2,
'is_email_notify' => 0,
'description' => 'test',
'currency_id' => 1,
'multiple_currencies' => 1,
'is_require_order_id' => 0,
'privacy_politics_url' => 'https://ua.chosten.com/',
'user_terms_url' => 'https://ua.chosten.com/',
'name' => 'test',
'site_url' => 'https://ua.chosten.com/',
'success_url' => 'https://ua.chosten.com/',
'fail_url' => '',
'pending_url' => 'https://ua.chosten.com/',
'interact_url' => 'https://ua.chosten.com/',
'language_id' => 1,
]);
$this->assertArrayHasKey('cashbox_number', $response, $response['error']);
}
// /**
// * Test get cash box
// * @test
// * @covers \Flamix\Kassa\API::updateCashBox()
// */
// public function testUpdateCashbox()
// {
// $response = $this->kassa->updateCashBox([
// 'user_id' => 2,
// 'is_email_notify' => 0,
// 'description' => 'test',
// 'currency_id' => 1,
// 'multiple_currencies' => 1,
// 'is_require_order_id' => 0,
// 'privacy_politics_url' => 'https://ua.chosten.com/',
// 'user_terms_url' => 'https://ua.chosten.com/',
// 'name' => 'test',
// 'site_url' => 'https://ua.chosten.com/',
// 'success_url' => 'https://ua.chosten.com/',
// 'fail_url' => '',
// 'pending_url' => 'https://ua.chosten.com/',
// 'interact_url' => 'https://ua.chosten.com/',
// 'language_id' => 1,
// ]);
// $this->assertArrayHasKey('cashbox_number', $response, $response['error']);
// }

/**
* Test get cash box
*/
public function testDeleteCashbox()
{
$response = $this->kassa->deleteCashBox();
$this->assertTrue($response, $response['error']);
}
// /**
// * Test get cash box
// * @test
// * @covers \Flamix\Kassa\API::deleteCashBox()
// */
// public function testDeleteCashbox()
// {
// $response = $this->kassa->deleteCashBox();
// $this->assertTrue($response, $response['error']);
// }


}