Subscription.php
2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
namespace Razorpay\Api;
class Subscription extends Entity
{
public function create($attributes = array())
{
return parent::create($attributes);
}
public function fetch($id)
{
return parent::fetch($id);
}
public function all($options = array())
{
return parent::all($options);
}
public function cancel($attributes = array())
{
$relativeUrl = $this->getEntityUrl() . $this->id . '/cancel';
return $this->request('POST', $relativeUrl, $attributes);
}
public function createAddon($attributes = array())
{
$relativeUrl = $this->getEntityUrl() . $this->id . '/addons';
return $this->request('POST', $relativeUrl, $attributes);
}
/**
* Create a Registration Link
* @param array $attributes
* @return array
*/
public function createSubscriptionRegistration($attributes = array())
{
$relativeUrl = 'subscription_registration/auth_links';
return $this->request('POST', $relativeUrl, $attributes);
}
public function update($attributes = array())
{
$relativeUrl = $this->getEntityUrl() . $this->id;
return $this->request('PATCH', $relativeUrl, $attributes);
}
public function pendingUpdate()
{
$relativeUrl = $this->getEntityUrl() . $this->id . '/retrieve_scheduled_changes';
return $this->request('GET', $relativeUrl, null);
}
public function cancelScheduledChanges()
{
$relativeUrl = $this->getEntityUrl() . $this->id . '/cancel_scheduled_changes';
return $this->request('POST', $relativeUrl, null);
}
public function pause($attributes = array())
{
$relativeUrl = $this->getEntityUrl() . $this->id.'/pause';
return $this->request('POST', $relativeUrl, $attributes);
}
public function resume($attributes = array())
{
$relativeUrl = $this->getEntityUrl() . $this->id.'/resume';
return $this->request('POST', $relativeUrl, $attributes);
}
public function deleteOffer($offerId)
{
$relativeUrl = $this->getEntityUrl() . $this->id.'/'.$offerId;
return $this->request('DELETE', $relativeUrl);
}
}