Skip to content

Commit

Permalink
Improving Listener updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksnellockdt committed Oct 22, 2018
1 parent 4609582 commit 19d2a85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Messages/CompletePurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ public function sendData($data)
$scpSimpleQueryResponse = $scpClient->scpSimpleQuery($data);
} catch (\Throwable $t) {
foreach ($this->getGateway()->getListeners() as $listener) {
$listener->update('completeException', $t);
$listener->update('completeExceptionSend', $scpClient->__getLastRequest());
$listener->update('completeExceptionRcv', $scpClient->__getLastResponse());
}
error_log($t->getMessage().' '.$t->getTraceAsString());
return $this->response = new CompletePurchaseResponse($this, $t);
}

foreach ($this->getGateway()->getListeners() as $listener) {
$listener->update('completeReceive', $scpSimpleQueryResponse);
$listener->update('completeExceptionSend', $scpClient->__getLastRequest());
$listener->update('completeExceptionRcv', $scpClient->__getLastResponse());
}

return $this->response = new CompletePurchaseResponse($this, $scpSimpleQueryResponse);
Expand Down
5 changes: 4 additions & 1 deletion src/Messages/PurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,16 @@ public function sendData($data)
} catch (\Throwable $t) {
error_log($t->getMessage().' '.$t->getTraceAsString());
foreach ($this->getGateway()->getListeners() as $listener) {
$listener->update('receiveException', $t);
$listener->update('receiveExceptionSend', $scpClient->__getLastRequest());
$listener->update('receiveExceptionRcv', $scpClient->__getLastResponse());
}
return $this->response = new PurchaseResponse($this, $t);
}

foreach ($this->getGateway()->getListeners() as $listener) {
$listener->update('purchaseReceive', $scpSimpleInvokeResponse);
$listener->update('receiveExceptionSend', $scpClient->__getLastRequest());
$listener->update('receiveExceptionRcv', $scpClient->__getLastResponse());
}

return $this->response = new PurchaseResponse($this, $scpSimpleInvokeResponse);
Expand Down

0 comments on commit 19d2a85

Please sign in to comment.