コード例 #1
0
 /**
  * Creates a txt file containing all parameters for each IPN.
  *
  * @param PayboxResponseEvent $event
  */
 public function onPayboxIpnResponse(PayboxResponseEvent $event)
 {
     $path = sprintf('%s/../data/%s', $this->rootDir, date('Y\\/m\\/d\\/'));
     $this->filesystem->mkdir($path);
     $content = sprintf('Signature verification : %s%s', $event->isVerified() ? 'OK' : 'KO', PHP_EOL);
     foreach ($event->getData() as $key => $value) {
         $content .= sprintf("%s:%s%s", $key, $value, PHP_EOL);
     }
     file_put_contents(sprintf('%s%s.txt', $path, time()), $content);
 }
コード例 #2
0
 /**
  * Handle paybox Response listener
  *
  * @param PayboxResponseEvent $event
  */
 public function onPayboxIpnResponse(PayboxResponseEvent $event)
 {
     if ($event->isVerified()) {
         $this->logger->info('Verified Ipn received, payment is stored.');
         $ipnData = new IpnData($event->getData());
         $payment = new Payment();
         $payment->setAutorisation($ipnData->getAuthorisationId())->setTransaction($ipnData->getTransactionId())->setResponseCode($ipnData->getErrorCode())->setResponse($ipnData->getData())->setStatus($this->normalizer->normalize($ipnData->getErrorCode()));
         // On attache le paiement à l'intent
         $this->intentManager->attachPayment($ipnData->getIntentId(), $payment);
         return;
     }
     //unverified ipn... we just log it as warning
     //@TODO do something smartter to keep track of thoses
     $this->logger->warning('Unverified Ipn received, content is ignored.');
 }