-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -569,4 +569,45 @@ public function it_can_set_tax_percentage_when_creating_subscription() | |
$this->assertArrayHasKey('id', $response); | ||
$this->assertArrayHasKey('plan_id', $response); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_create_a_subscription_with_fixed_installments() | ||
{ | ||
$this->client->setAccessToken([ | ||
'access_token' => self::$access_token, | ||
'token_type' => 'Bearer', | ||
]); | ||
|
||
$this->client->setClient( | ||
$this->mock_http_client( | ||
$this->mockCreateCatalogProductsResponse() | ||
) | ||
); | ||
|
||
$start_date = Carbon::now()->addDay()->toDateString(); | ||
|
||
$this->client = $this->client->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE'); | ||
|
||
$this->client->setClient( | ||
$this->mock_http_client( | ||
$this->mockCreatePlansResponse() | ||
) | ||
); | ||
|
||
$this->client = $this->client->addPlanTrialPricing('DAY', 7) | ||
->addMonthlyPlan('Demo Plan', 'Demo Plan', 100, 12); | ||
|
||
$this->client->setClient( | ||
$this->mock_http_client( | ||
$this->mockCreateSubscriptionResponse() | ||
) | ||
); | ||
|
||
$response = $this->client->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') | ||
->setupSubscription('John Doe', '[email protected]', $start_date); | ||
|
||
$this->assertNotEmpty($response); | ||
$this->assertArrayHasKey('id', $response); | ||
$this->assertArrayHasKey('plan_id', $response); | ||
} | ||
} |