Skip to content

Commit

Permalink
Merge pull request #53 from cassianogf/master
Browse files Browse the repository at this point in the history
Suporte às notificações das Assinaturas
  • Loading branch information
fernandobandeira authored May 30, 2017
2 parents 64b41e8 + e985da2 commit f34dfc8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Artistas/PagSeguroClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,25 @@ public function startSession()
}

/**
* Retorna a transação da notoficação.
* Retorna a transação da notificação.
*
* @param string $notificationCode
*
* @return \SimpleXMLElement
*/
public function notification($notificationCode)
public function notification($notificationCode, $notificationType = 'transaction')
{
return $this->sendTransaction([
'email' => $this->email,
'token' => $this->token,
], $this->url['notifications'].$notificationCode, false);
if ($notificationType == 'transaction') {
return $this->sendTransaction([
'email' => $this->email,
'token' => $this->token,
], $this->url['notifications'].$notificationCode, false);
} elseif ($notificationType == 'preApproval') {
return $this->sendTransaction([
'email' => $this->email,
'token' => $this->token,
], $this->url['preApprovalNotifications'].$notificationCode, false);
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Artistas/PagSeguroConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private function setUrl()
'preApprovalRequest' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/pre-approvals/request',
'preApproval' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/pre-approvals',
'preApprovalCancel' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/pre-approvals/cancel/',
'preApprovalNotifications' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/pre-approvals/notifications/',
'session' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/sessions',
'transactions' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v2/transactions',
'notifications' => 'https://ws.'.$sandbox.'pagseguro.uol.com.br/v3/transactions/notifications/',
Expand Down

0 comments on commit f34dfc8

Please sign in to comment.