Skip to content

Commit 4eb17a3

Browse files
committed
Merge
2 parents 499ccff + 499719d commit 4eb17a3

File tree

10 files changed

+87
-12
lines changed

10 files changed

+87
-12
lines changed

.travis.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ matrix:
1414
env: LARAVEL='5.8.*' TESTBENCH='3.8.*' COMPOSER_FLAGS='--prefer-lowest'
1515
- php: 7.3
1616
env: LARAVEL='5.8.*' TESTBENCH='3.8.*' COMPOSER_FLAGS='--prefer-stable'
17-
- php: 7.4snapshot
17+
- php: 7.4
1818
env: LARAVEL='5.8.*' TESTBENCH='3.8.*' COMPOSER_FLAGS='--prefer-lowest'
19-
- php: 7.4snapshot
19+
- php: 7.4
2020
env: LARAVEL='5.8.*' TESTBENCH='3.8.*' COMPOSER_FLAGS='--prefer-stable'
2121
- php: 7.2
2222
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest'
@@ -26,10 +26,22 @@ matrix:
2626
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest'
2727
- php: 7.3
2828
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable'
29-
- php: 7.4snapshot
29+
- php: 7.4
3030
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest'
31-
- php: 7.4snapshot
31+
- php: 7.4
3232
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable'
33+
- php: 7.2
34+
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-lowest'
35+
- php: 7.2
36+
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-stable'
37+
- php: 7.3
38+
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-lowest'
39+
- php: 7.3
40+
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-stable'
41+
- php: 7.4
42+
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-lowest'
43+
- php: 7.4
44+
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-stable'
3345
fast_finish: true
3446

3547
before_install:

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ All notable changes to `laravel-paddle` will be documented in this file
99
## 1.1.0 - 2020-03-03
1010

1111
- Support for Laravel 7.0
12+
- Fix for the OrderDetails request URL
13+
14+
## 1.0.6 - 2020-01-28
15+
16+
- Added attribute existance check on the event webhook data
17+
18+
## 1.0.5 - 2019-12-04
19+
20+
- Added `OpenSSL` and `illuminate/validation` dependencies
21+
22+
## 1.0.4 - 2019-12-03
23+
24+
- Refactor
1225

1326
## 1.0.1 + 1.0.2 - 2019-12-02
1427

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This package provides an integration with [Paddle.com](https://paddle.com) for L
1111
* Super easy wrapper around the [Paddle.com API](https://developer.paddle.com/api-reference/intro)
1212
* Built-in support for Webhooks and Event handling
1313
* Blade directive to use [Paddle.js](https://paddle.com/docs/paddle-js-overlay-checkout/) in your front-end
14-
* Compatible with Laravel 5.8 and 6.0.
14+
* Compatible with Laravel 5.8, 6.0 and 7.0.
1515
* PHP 7.2, 7.3 or 7.4 required.
1616

1717
## Installation
@@ -183,6 +183,14 @@ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recen
183183

184184
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
185185

186+
## Other Laravel packages
187+
188+
* [`Laravel Analytics Event Tracking`](https://github.com/pascalbaljetmedia/laravel-analytics-event-tracking): Laravel package to easily send events to Google Analytics.
189+
* [`Laravel Blade On Demand`](https://github.com/pascalbaljetmedia/laravel-blade-on-demand): Laravel package to compile Blade templates in memory.
190+
* [`Laravel FFMpeg`](https://github.com/pascalbaljetmedia/laravel-ffmpeg): This package provides an integration with FFmpeg for Laravel. The storage of the files is handled by Laravel's Filesystem.
191+
* [`Laravel Verify New Email`](https://github.com/pascalbaljetmedia/laravel-verify-new-email): This package adds support for verifying new email addresses: when a user updates its email address, it won't replace the old one until the new one is verified.
192+
* [`Laravel WebDAV`](https://github.com/pascalbaljetmedia/laravel-webdav): WebDAV driver for Laravel's Filesystem.
193+
186194
### Security
187195

188196
If you discover any security related issues, please email [email protected] instead of using the issue tracker.

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
"require": {
1919
"php": "^7.2",
2020
"ext-openssl": "*",
21-
"illuminate/support": "5.8.*|^6.0",
22-
"illuminate/validation": "5.8.*|^6.0",
21+
"illuminate/support": "5.8.* || ^6.0 || ^7.0",
22+
"illuminate/validation": "5.8.* || ^6.0 || ^7.0",
2323
"egulias/email-validator": "^2.1.10",
2424
"kitetail/zttp": "^0.6.0"
2525
},
2626
"require-dev": {
27-
"orchestra/testbench": "^3.8 || ^4.0"
27+
"orchestra/testbench": "^3.8 || ^4.0 || ^5.0"
2828
},
2929
"autoload": {
3030
"psr-4": {
@@ -39,7 +39,6 @@
3939
"scripts": {
4040
"test": "vendor/bin/phpunit",
4141
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
42-
4342
},
4443
"config": {
4544
"sort-packages": true
@@ -54,4 +53,4 @@
5453
}
5554
}
5655
}
57-
}
56+
}

src/Api/Checkout.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Checkout
99
*/
1010
public function getOrderDetails(array $data = [])
1111
{
12-
return new Request('/1.0/order', $data, [], Request::METHOD_GET);
12+
return new GetOrderDetailsRequest('/1.0/order', $data, [], Request::METHOD_GET);
1313
}
1414

1515
/**

src/Api/GetOrderDetailsRequest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace ProtoneMedia\LaravelPaddle\Api;
4+
5+
class GetOrderDetailsRequest extends Request
6+
{
7+
public function url(): string
8+
{
9+
return "https://checkout.paddle.com/api{$this->uri}";
10+
}
11+
}

src/Api/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Request
2121
/**
2222
* @var string
2323
*/
24-
private $uri;
24+
protected $uri;
2525

2626
/**
2727
* @var array

src/Events/Event.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ public function __get(string $key)
4747
return $value;
4848
}
4949

50+
/**
51+
* Determine if an attribute exists on the webhook data.
52+
*
53+
* @param string $key
54+
* @return bool
55+
*/
56+
public function __isset($key)
57+
{
58+
return isset($this->webhookData[$key]);
59+
}
60+
5061
/**
5162
* Generates the event class name with the 'alert_name' attribute from
5263
* the data and fires the event with the data.

tests/ApiTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,12 @@ public function it_can_create_an_one_off_chrage()
170170

171171
$this->assertEquals('https://vendors.paddle.com/api/2.0/subscription/123/charge', $request->url());
172172
}
173+
174+
/** @test */
175+
public function it_has_a_custom_host_for_the_order_details_request()
176+
{
177+
$request = (new Api)->checkout()->getOrderDetails();
178+
179+
$this->assertEquals('https://checkout.paddle.com/api/1.0/order', $request->url());
180+
}
173181
}

tests/EventTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ public function it_can_have_payload_that_is_accessible()
2323
$this->assertEquals(['team_id' => 20], $event->passthrough);
2424
}
2525

26+
/** @test */
27+
public function it_can_check_if_payload_key_exists()
28+
{
29+
$event = new SubscriptionCreated([
30+
'product_id' => 10,
31+
]);
32+
33+
$this->assertTrue(isset($event->product_id));
34+
$this->assertFalse(empty($event->product_id));
35+
$this->assertFalse(isset($event->dummy_key));
36+
$this->assertTrue(empty($event->dummy_key));
37+
}
38+
2639
/** @test */
2740
public function it_can_fire_an_event_based_on_the_action_name()
2841
{

0 commit comments

Comments
 (0)