|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ProtoneMedia\LaravelPaddle\Api; |
|
4
|
|
|
|
|
5
|
|
|
class Product |
|
6
|
|
|
{ |
|
7
|
|
|
use HandlesCoupons; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* https://developer.paddle.com/api-reference/product-api/products/getproducts |
|
11
|
|
|
*/ |
|
12
|
|
|
public function listProducts(array $data = []) |
|
13
|
|
|
{ |
|
14
|
|
|
return new Request('/2.0/product/get_products', $data); |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* https://developer.paddle.com/api-reference/product-api/licenses/createlicense |
|
19
|
|
|
*/ |
|
20
|
|
|
public function generateLicense(array $data = []) |
|
21
|
|
|
{ |
|
22
|
|
|
return new Request('/2.0/product/generate_license', $data, [ |
|
23
|
|
|
'product_id' => 'required|numeric', |
|
24
|
|
|
'allowed_uses' => 'required|integer', |
|
25
|
|
|
]); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* https://developer.paddle.com/api-reference/product-api/pay-links/createpaylink |
|
30
|
|
|
*/ |
|
31
|
|
|
public function generatePayLink(array $data = []) |
|
32
|
|
|
{ |
|
33
|
|
|
return new GeneratePayLinkRequest('/2.0/product/generate_pay_link', $data, [ |
|
34
|
|
|
'product_id' => 'numeric', |
|
35
|
|
|
'title' => 'required_without:product_id', |
|
36
|
|
|
'webhook_url' => 'required_without:product_id', |
|
37
|
|
|
'prices' => 'required_without:product_id', |
|
38
|
|
|
'custom_message' => 'max:255', |
|
39
|
|
|
'quantity' => 'min:1|max:100', |
|
40
|
|
|
'recurring_affiliate_limit' => 'min:1', |
|
41
|
|
|
'customer_email' => 'email', |
|
42
|
|
|
'return_url' => 'url', |
|
43
|
|
|
]); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* https://developer.paddle.com/api-reference/product-api/transactions/listtransactions |
|
48
|
|
|
*/ |
|
49
|
|
|
public function listTransactions($entity, $id, array $data = []) |
|
50
|
|
|
{ |
|
51
|
|
|
return new Request(sprintf('/2.0/%s/%s/transactions', $entity, $id), $data); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|