1: <?php
2:
3: 4: 5:
6: class DonationInfo {
7: public $dateCreated;
8: public $amount;
9: public ;
10: public $nonProfitCampaignGuid;
11: public $publisherCampaignGuid;
12: public ;
13: public $publisherGuid;
14: public $donorAccountGuid;
15: public $donorGuid;
16: public $publisherTransactionId;
17:
18: 19: 20: 21: 22: 23:
24: public function __construct($properties=array()) {
25: $this->dateCreated = gmdate('Y-m-d\\TG:i:s\\Z', time());
26: $this->bind($properties);
27: }
28:
29: 30: 31: 32: 33: 34: 35: 36: 37:
38: public function setDonation($amount, $nonProfitCampaignGuid, $publisherCampaignGuid, $donorAccountGuid, $donorGuid) {
39: $this->amount = $amount;
40: $this->nonProfitCampaignGuid = $nonProfitCampaignGuid;
41: $this->publisherCampaignGuid = $publisherCampaignGuid;
42: $this->donorAccountGuid = $donorAccountGuid;
43: $this->donorGuid = $donorGuid;
44: }
45:
46: 47: 48: 49: 50:
51: public function bind($properties=array()) {
52: foreach ($properties as $key => $value) {
53: $this->$key = $value;
54: }
55: }
56:
57: public function validate() {
58: return !empty($this->amount) &&
59: !empty($this->nonProfitCampaignGuid) &&
60: !empty($this->publisherCampaignGuid) &&
61: !empty($this->donorAccountGuid) &&
62: !empty($this->donorGuid);
63: }
64: }
65:
66: 67: 68:
69: class DonorInfo {
70:
71: public $username;
72:
73: public $screenName;
74: public $sharePersonalInfo;
75: public $firstName;
76: public $lastName;
77: public $billingAddress1;
78: public $billingAddress2;
79: public $city;
80: public $state;
81: public $zip;
82: public $country;
83: public $cellPhoneNumber;
84: public $homePhoneNumber;
85: public $workPhoneNumber;
86:
87: 88: 89: 90: 91: 92:
93: public function __construct($properties=array()) {
94: $this->bind($properties);
95: }
96:
97: 98: 99: 100: 101: 102:
103: public function setUser($username, $screenname=null) {
104: if ($screenname == null) $screenname = $username;
105:
106: $this->username = $username;
107: $this->screenName = $screenname;
108: }
109:
110: 111: 112: 113: 114:
115: public function bind($properties=array()) {
116: foreach ($properties as $key => $value) {
117: $this->$key = $value;
118: }
119: }
120:
121: public function validate() {
122: return !empty($this->screenName) &&
123: !empty($this->username);
124: }
125: }
126:
127: 128: 129:
130: class AccountContactInfo {
131: public $billingAddress1;
132: public $billingAddress2;
133: public $billingCity;
134: public $billingState;
135: public $billingZip;
136: public $billingCountry;
137:
138: 139: 140: 141: 142:
143: public function bind($properties=array()) {
144: foreach ($properties as $key => $value) {
145: $this->$key = $value;
146: }
147: }
148: }
149:
150: 151: 152:
153: class AccountInfo {
154: public $donorGuid;
155: public $paymentMethod;
156: public $creditCardNumber;
157: public $cwCode;
158: public $expirationMonth;
159: public $expirationYear;
160: public $accountNumber;
161: public $routingNumber;
162: public $accountHolderName;
163:
164: public $contactInfo;
165:
166: 167: 168: 169: 170: 171:
172: public function __construct($properties=array()) {
173: $this->contactInfo = new AccountContactInfo();
174: $this->bind($properties);
175: $this->contactInfo->bind($properties);
176: }
177:
178: 179: 180: 181: 182: 183:
184: public function setDonorInformation($donorGuid, $contactInfo=array()) {
185: $this->donorGuid = $donorGuid;
186: $this->contactInfo->bind($contactInfo);
187: }
188:
189: 190: 191: 192: 193: 194: 195: 196:
197: public function setCreditCard($ccnum, $cwcode, $expirationMonth, $expirationYear) {
198: $this->paymentMethod = 'creditCard';
199: $this->creditCardNumber = $ccnum;
200: $this->cwCode = $cwcode;
201: $this->expirationMonth = $expirationMonth;
202: $this->expirationYear = $expirationYear;
203: }
204:
205: 206: 207: 208: 209: 210: 211:
212: public function setACH($account, $routing, $accountName) {
213: $this->paymentMethod = 'ach';
214: $this->accountNumber = $account;
215: $this->routingNumber = $routing;
216: $this->accountHolderName = $accountName;
217: }
218:
219: 220: 221: 222: 223:
224: public function bind($properties=array()) {
225: foreach ($properties as $key => $value) {
226: $this->$key = $value;
227: }
228: }
229:
230: public function validate() {
231: return !empty($this->donorGuid) &&
232: !empty($this->paymentMethod) &&
233: !empty($this->contactInfo->billingAddress1) &&
234: !empty($this->contactInfo->billingState);
235: }
236: }
237: ?>
238: