-
Notifications
You must be signed in to change notification settings - Fork 9
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 #93 from alma/develop
Develop
- Loading branch information
Showing
6 changed files
with
48 additions
and
5 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,8 @@ | ||
<?php | ||
|
||
namespace Alma\API\Exceptions; | ||
|
||
|
||
class InsuranceCancelPendingException extends AlmaException | ||
{ | ||
} |
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
use Alma\API\Entities\Insurance\File; | ||
use Alma\API\Entities\Insurance\Subscriber; | ||
use Alma\API\Entities\Insurance\Subscription; | ||
use Alma\API\Exceptions\InsuranceCancelPendingException; | ||
use Alma\API\Exceptions\MissingKeyException; | ||
use Alma\API\Exceptions\ParametersException; | ||
use Alma\API\Exceptions\RequestException; | ||
|
@@ -29,7 +30,7 @@ class InsuranceTest extends TestCase | |
const TEST_EMAIL = '[email protected]'; | ||
const TEST_CMSREFERENCE = '17-35'; | ||
const TEST_BIRTHDATE = '1988-08-22'; | ||
const INSURANCE_CUSTOMER_CART_PATH = '/v1/insurance/customer-cart'; | ||
const INSURANCE_CUSTOMER_CART_PATH = '/v1/insurance/customer-carts'; | ||
/** | ||
* @var ClientContext | ||
*/ | ||
|
@@ -897,14 +898,16 @@ public function testSendCustomerCartCallApiPostCustomerCartWithCmsReferencesArra | |
|
||
/** | ||
* @return void | ||
* @throws InsuranceCancelPendingException | ||
* @throws ParametersException | ||
* @throws RequestError | ||
* @throws RequestException | ||
*/ | ||
public function testCancelSubscriptionCallRequestWithSubscriptionArrayPayloadAndThrowExceptionForResponseUpperThan400() | ||
public function testCancelSubscriptionCallRequestWithSubscriptionArrayPayloadAndThrowExceptionForResponseUpperThan400ButNo410() | ||
{ | ||
$this->expectException(RequestException::class); | ||
$subscriptionCancelPayload = 'subscriptionId1'; | ||
|
||
$this->responseMock->shouldReceive('isError')->once()->andReturn(true); | ||
$this->requestObject->shouldReceive('post')->once()->andReturn($this->responseMock); | ||
$this->insuranceMock->shouldReceive('request') | ||
|
@@ -914,6 +917,26 @@ public function testCancelSubscriptionCallRequestWithSubscriptionArrayPayloadAnd | |
$this->insuranceMock->cancelSubscription($subscriptionCancelPayload); | ||
} | ||
|
||
/** | ||
* @return void | ||
* @throws InsuranceCancelPendingException | ||
* @throws ParametersException | ||
* @throws RequestError | ||
* @throws RequestException | ||
*/ | ||
public function testCancelSubscriptionCallRequestWithSubscriptionArrayPayloadAndThrowInsuranceCancelPendingExceptionForResponse410() | ||
{ | ||
$this->expectException(InsuranceCancelPendingException::class); | ||
$subscriptionCancelPayload = 'subscriptionId1'; | ||
$this->responseMock->responseCode = 410; | ||
$this->requestObject->shouldReceive('post')->once()->andReturn($this->responseMock); | ||
$this->insuranceMock->shouldReceive('request') | ||
->with(self::INSURANCE_SUBSCRIPTIONS_PATH . '/subscriptionId1/void') | ||
->once() | ||
->andReturn($this->requestObject); | ||
$this->insuranceMock->cancelSubscription($subscriptionCancelPayload); | ||
} | ||
|
||
/** | ||
* @dataProvider cancelSubscriptionErrorPayloadDataProvider | ||
* @param $payload | ||
|
@@ -926,6 +949,9 @@ public function testCheckSubscriptionIdFormatThrowParamsErrorForBadPayload($payl | |
$this->insuranceMock->checkSubscriptionIdFormat($payload); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function cancelSubscriptionErrorPayloadDataProvider() | ||
{ | ||
return [ | ||
|