Esempio n. 1
0
 /**
  * @Route("/api/postsale",  name="donate_ogone_postsale")
  * @since  2.2.0 this router delegate all business logic to PostSaleManager via a OgoneEvents::POSTSALE event
  */
 public function postsaleAction(Request $request)
 {
     $response = OgoneResponse::createFromRequest($request);
     $postSaleEvent = new PostSaleEvent($response);
     $this->get('event_dispatcher')->dispatch(OgoneEvents::POSTSALE, $postSaleEvent);
     $payment = $postSaleEvent->getPayment();
     //i think this part is optionnal as already done in IntentManager::attachPayment()
     $entityMgr = $this->getDoctrine()->getManager();
     $entityMgr->persist($payment);
     $entityMgr->flush();
     return new JsonResponse(['status' => 'OK']);
 }
Esempio n. 2
0
 /**
  * Extract Intent Id from post-sale orderId
  *
  * @param  Response                        $response
  * @return integer                         the intent Id
  * @throws CannotDetermineOrderIdException If post-sale orderId does not match expected format
  */
 protected function getIntentId(Response $response)
 {
     $orderId = $response->getOrderId();
     $prefix = $this->prefix;
     if (strpos($orderId, $prefix . '-') === 0) {
         return (int) str_replace($prefix . '-', '', $orderId);
     }
     throw new CannotDetermineOrderIdException();
 }
Esempio n. 3
0
 /**
  * Création d'une Réponse à partir d'un tableau
  *
  * @param  array    $data
  * @return Response
  */
 public static function createFromArray(array $data)
 {
     $response = new Response();
     $response->setOrderId($data['ORDERID'])->setAmount($data['AMOUNT'])->setCurrency($data['CURRENCY'])->setPm($data['PM'])->setAcceptance($data['ACCEPTANCE'])->setStatus($data['STATUS'])->setCardNo($data['CARDNO'])->setPayId($data['PAYID'])->setNcError($data['NCERROR'])->setBrand($data['BRAND'])->setEd($data['ED'])->setTrxDate($data['TRXDATE'])->setCn($data['CN'])->setShasign($data['SHASIGN'])->setEci($data['ECI'])->setComplus($data['COMPLUS'])->setIp($data['IP'])->setAlias($data['ALIAS']);
     return $response;
 }