7
7
use MercadoPago \PP \Sdk \Interfaces \RequesterEntityInterface ;
8
8
9
9
/**
10
- * Class Notification
10
+ * Handles integration with the Asgard Notification service.
11
+ *
12
+ * Asgard Notification is responsible for handling notifications originating from plugins and platforms.
13
+ * When a payment is initiated that requires asynchronous approval, a notification is generated and processed
14
+ * by this class.
15
+ * This class streamlines the interaction with the Asgard Notification service, allowing the details of a
16
+ * specific notification to be fetched using its ID. It aims to simplify the complexity associated with
17
+ * managing and validating notifications, ensuring that only relevant information is forwarded to
18
+ * platforms and plugins.
11
19
*
12
- * @property string $ip_address
13
20
* @property string $notification_id
14
21
* @property string $notification_url
15
22
* @property string $status
16
- * @property string $external_reference
17
- * @property float $transaction_id
23
+ * @property string $transaction_id
18
24
* @property string $transaction_type
25
+ * @property string $platform_id
26
+ * @property string $external_reference
27
+ * @property string $preference_id
19
28
* @property float $transaction_amount
20
- * @property float $total_pending
21
- * @property float $total_approved
22
29
* @property float $total_paid
23
- * @property float $total_rejected
30
+ * @property float $total_approved
31
+ * @property float $total_pending
24
32
* @property float $total_refunded
33
+ * @property float $total_rejected
25
34
* @property float $total_cancelled
26
35
* @property float $total_charged_back
36
+ * @property string $multiple_payment_transaction_id
27
37
* @property array $payments_metadata
28
- * @property PaymentDetails $payments_details
38
+ * @property PaymentDetailsList $payments_details
39
+ * @property RefundNotifyingList $refunds_notifying
29
40
*
30
41
* @package MercadoPago\PP\Sdk\Entity\Notification
31
42
*/
@@ -49,17 +60,27 @@ class Notification extends AbstractEntity implements RequesterEntityInterface
49
60
/**
50
61
* @var string
51
62
*/
52
- protected $ external_reference ;
63
+ protected $ transaction_id ;
53
64
54
65
/**
55
- * @var float
66
+ * @var string
56
67
*/
57
- protected $ transaction_id ;
68
+ protected $ transaction_type ;
58
69
59
70
/**
60
71
* @var string
61
72
*/
62
- protected $ transaction_type ;
73
+ protected $ platform_id ;
74
+
75
+ /**
76
+ * @var string
77
+ */
78
+ protected $ external_reference ;
79
+
80
+ /**
81
+ * @var string
82
+ */
83
+ protected $ preference_id ;
63
84
64
85
/**
65
86
* @var float
@@ -69,7 +90,7 @@ class Notification extends AbstractEntity implements RequesterEntityInterface
69
90
/**
70
91
* @var float
71
92
*/
72
- protected $ total_pending ;
93
+ protected $ total_paid ;
73
94
74
95
/**
75
96
* @var float
@@ -79,17 +100,17 @@ class Notification extends AbstractEntity implements RequesterEntityInterface
79
100
/**
80
101
* @var float
81
102
*/
82
- protected $ total_paid ;
103
+ protected $ total_pending ;
83
104
84
105
/**
85
106
* @var float
86
107
*/
87
- protected $ total_rejected ;
108
+ protected $ total_refunded ;
88
109
89
110
/**
90
111
* @var float
91
112
*/
92
- protected $ total_refunded ;
113
+ protected $ total_rejected ;
93
114
94
115
/**
95
116
* @var float
@@ -101,16 +122,26 @@ class Notification extends AbstractEntity implements RequesterEntityInterface
101
122
*/
102
123
protected $ total_charged_back ;
103
124
125
+ /**
126
+ * @var string
127
+ */
128
+ protected $ multiple_payment_transaction_id ;
129
+
104
130
/**
105
131
* @var array
106
132
*/
107
133
protected $ payments_metadata ;
108
134
109
135
/**
110
- * @var PaymentDetails
136
+ * @var PaymentDetailsList
111
137
*/
112
138
protected $ payments_details ;
113
139
140
+ /**
141
+ * @var RefundNotifyingList
142
+ */
143
+ protected $ refunds_notifying ;
144
+
114
145
/**
115
146
* Notification constructor.
116
147
*
@@ -120,6 +151,7 @@ public function __construct($manager)
120
151
{
121
152
parent ::__construct ($ manager );
122
153
$ this ->payments_details = new PaymentDetailsList ($ manager );
154
+ $ this ->refunds_notifying = new RefundNotifyingList ($ manager );
123
155
}
124
156
125
157
/**
@@ -153,7 +185,30 @@ public function getHeaders(): array
153
185
public function getUris (): array
154
186
{
155
187
return array (
156
- 'get ' => '/v1/bifrost /notification/status /:id ' ,
188
+ 'get ' => '/v1/asgard /notification/:id ' ,
157
189
);
158
190
}
191
+
192
+ /**
193
+ * Retrieves a notification from the Asgard Transaction service.
194
+ *
195
+ * Upon invoking this method, a request is made to the Asgard Transaction service
196
+ * using the provided notification ID. Authentication is performed using
197
+ * the seller's access token, which should be previously configured in the default headers.
198
+ *
199
+ * Note: This method is inherited from the parent class but specialized for notifications.
200
+ *
201
+ * @param array $params Associative array containing the parameters for the read operation.
202
+ * It expects an "id" key with the notification ID as its value.
203
+ * Example: $notification->read(['id' => 'P-1316643861'])
204
+ *
205
+ * @return mixed The result of the read operation, typically an instance of
206
+ * this Notification class populated with the retrieved data.
207
+ *
208
+ * @throws \Exception Throws an exception if something goes wrong during the read operation.
209
+ */
210
+ public function read (array $ params = [])
211
+ {
212
+ return parent ::read ($ params );
213
+ }
159
214
}
0 commit comments