|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Konsulting\JustGivingApiSdk\ResourceClients; |
|
4
|
|
|
|
|
5
|
|
|
use Konsulting\JustGivingApiSdk\ResourceClients\Models\AuthenticateCharityAccountRequest; |
|
6
|
|
|
use Konsulting\JustGivingApiSdk\ResourceClients\Models\UpdateFundraisingPageAttributionRequest; |
|
7
|
|
|
|
|
8
|
|
|
class CharityClient extends BaseClient |
|
9
|
|
|
{ |
|
10
|
|
|
protected $aliases = [ |
|
11
|
|
|
'getById' => 'GetCharityById', |
|
12
|
|
|
'authenticate' => 'AuthenticateCharityAccount', |
|
13
|
|
|
'getEventsByCharityId' => 'GetEventsByCharityId', |
|
14
|
|
|
'getDonations' => 'GetCharityDonations', |
|
15
|
|
|
'deleteFundraisingPageAttribution' => 'CharityDeleteFundraisingPageAttribution', |
|
16
|
|
|
'updateFundraisingPageAttribution' => 'CharityUpdateFundraisingPageAttribution', |
|
17
|
|
|
'appendFundraisingPageAttribution' => 'CharityAppendToFundraisingPageAttribution', |
|
18
|
|
|
'getFundraisingPageAttribution' => 'CharityGetFundraisingPageAttribution', |
|
19
|
|
|
'categories' => 'GetCharityCategories', |
|
20
|
|
|
]; |
|
21
|
|
|
|
|
22
|
|
|
public function getById($charityId) |
|
23
|
|
|
{ |
|
24
|
|
|
return $this->get("charity/" . $charityId); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function authenticate(AuthenticateCharityAccountRequest $authenticateRequest) |
|
28
|
|
|
{ |
|
29
|
|
|
return $this->post("charity/authenticate", $authenticateRequest); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function getEventsByCharityId($charityId) |
|
33
|
|
|
{ |
|
34
|
|
|
return $this->get("charity/" . $charityId . "/events"); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function getDonations($charityId) |
|
38
|
|
|
{ |
|
39
|
|
|
return $this->get("charity/" . $charityId . "/donations"); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
// Test account does not have permission to edit charity fundraising pages. |
|
43
|
|
|
// @codeCoverageIgnoreStart |
|
44
|
|
|
|
|
45
|
|
|
public function deleteFundraisingPageAttribution($charityId, $pageShortName) |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->delete("charity/" . $charityId . "/pages/" . $pageShortName . "/attribution"); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function updateFundraisingPageAttribution($charityId, $pageShortName, UpdateFundraisingPageAttributionRequest $updateRequest) |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->put("charity/" . $charityId . "/pages/" . $pageShortName . "/attribution", $updateRequest); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function appendFundraisingPageAttribution($charityId, $pageShortName, UpdateFundraisingPageAttributionRequest $updateRequest) |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->Post("charity/" . $charityId . "/pages/" . $pageShortName . "/attribution", $updateRequest); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function getFundraisingPageAttribution($charityId, $pageShortName) |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->get("charity/" . $charityId . "/pages/" . $pageShortName . "/attribution"); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
// @codeCoverageIgnoreEnd |
|
66
|
|
|
|
|
67
|
|
|
public function categories() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->get("charity/categories"); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|