Skip to content

Commit f34dfc8

Browse files
Merge pull request #53 from cassianogf/master
Suporte às notificações das Assinaturas
2 parents 64b41e8 + e985da2 commit f34dfc8

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/Artistas/PagSeguroClient.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,25 @@ public function startSession()
190190
}
191191

192192
/**
193-
* Retorna a transação da notoficação.
193+
* Retorna a transação da notificação.
194194
*
195195
* @param string $notificationCode
196196
*
197197
* @return \SimpleXMLElement
198198
*/
199-
public function notification($notificationCode)
199+
public function notification($notificationCode, $notificationType = 'transaction')
200200
{
201-
return $this->sendTransaction([
202-
'email' => $this->email,
203-
'token' => $this->token,
204-
], $this->url['notifications'].$notificationCode, false);
201+
if ($notificationType == 'transaction') {
202+
return $this->sendTransaction([
203+
'email' => $this->email,
204+
'token' => $this->token,
205+
], $this->url['notifications'].$notificationCode, false);
206+
} elseif ($notificationType == 'preApproval') {
207+
return $this->sendTransaction([
208+
'email' => $this->email,
209+
'token' => $this->token,
210+
], $this->url['preApprovalNotifications'].$notificationCode, false);
211+
}
205212
}
206213

207214
/**

src/Artistas/PagSeguroConfig.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ private function setUrl()
9090
'preApprovalRequest' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/pre-approvals/request',
9191
'preApproval' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/pre-approvals',
9292
'preApprovalCancel' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/pre-approvals/cancel/',
93+
'preApprovalNotifications' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/pre-approvals/notifications/',
9394
'session' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/sessions',
9495
'transactions' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/transactions',
9596
'notifications' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v3/transactions/notifications/',

0 commit comments

Comments
 (0)