-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from mblsolutions/feature/D00782JB-bulk-ecodes
Feature/d00782 jb bulk ecodes
- Loading branch information
Showing
15 changed files
with
127 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace MBLSolutions\Simfoni; | ||
|
||
use MBLSolutions\Simfoni\Api\ApiResource; | ||
|
||
class Webhook extends ApiResource | ||
{ | ||
|
||
/** | ||
* Create an Order | ||
* | ||
* @param array $params | ||
* @return array | ||
*/ | ||
public function resend(string $id, array $params = []): array | ||
{ | ||
return $this->getApiRequestor()->postRequest('/api/webhook/resend/'.$id, $params); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace MBLSolutions\Simfoni\Tests; | ||
|
||
use MBLSolutions\Simfoni\Order; | ||
use MBLSolutions\Simfoni\Simfoni; | ||
use MBLSolutions\Simfoni\Webhook; | ||
|
||
class WebhookTest extends TestCase | ||
{ | ||
/** @var Order $order */ | ||
protected $order; | ||
|
||
/** {@inheritdoc} **/ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
Simfoni::setToken('test-token'); | ||
|
||
$this->webhook = new Webhook(); | ||
} | ||
|
||
/** @test * */ | ||
public function can_request_webhook_resend() | ||
{ | ||
$id = 'test-1111'; | ||
$params = ['event' => 'order.cancelled', 'type' => 'reference']; | ||
|
||
$this->mockExpectedHttpResponse([ | ||
'message' => 'Webhook order.cancelled for order 123 resent' | ||
]); | ||
|
||
self::assertEquals($this->webhook->resend($id, $params), $this->getMockedResponseBody()); | ||
} | ||
|
||
/** @test * */ | ||
public function can_request_webhook_resend_with_defaults() | ||
{ | ||
$id = '123'; | ||
|
||
$this->mockExpectedHttpResponse([ | ||
'message' => 'Webhook order.complete for order 123 resent' | ||
]); | ||
|
||
self::assertEquals($this->webhook->resend($id), $this->getMockedResponseBody()); | ||
} | ||
|
||
/** @test * */ | ||
public function can_not_request_webhook_without_id() | ||
{ | ||
self::expectException('ArgumentCountError'); | ||
$this->webhook->resend(); | ||
} | ||
} |