1: <?php
2:
3: namespace mcfedr\Paypal\Exceptions;
4:
5: /**
6: * Paypal indicates a problem with an api call
7: */
8: abstract class ACKException extends Exception {
9:
10: private $response;
11:
12: /**
13: *
14: * @param array $response
15: */
16: public function __construct($response) {
17: $this->response = $response;
18: parent::__construct("{$response['ACK']} {$response['L_SHORTMESSAGE0']} {$response['L_LONGMESSAGE0']}", $response['ACK']);
19: }
20:
21: /**
22: * The complete response
23: *
24: * @return array
25: */
26: public function getResponse() {
27: return $this->response;
28: }
29:
30: /**
31: * Long message from paypal
32: *
33: * @return string
34: */
35: public function getLongMessage() {
36: return $this->response['L_LONGMESSAGE0'];
37: }
38:
39: /**
40: * Short message from paypal
41: *
42: * @return string
43: */
44: public function getShortMessage() {
45: return $this->response['L_SHORTMESSAGE0'];
46: }
47:
48: }
49: