private function createTransaction()
 {
     $this->obj_transaction = PagSeguroNotificationService::checkTransaction($this->obj_credential, $this->notification_code);
     $transaction = $this->isNotNull($this->obj_transaction);
     if (strpos($this->obj_transaction->getReference(), Configuration::get('PAGSEGURO_ID')) === false) {
         throw new Exception("ID_PAGSEGURO_INCOMPATIVEL", 1);
     }
     $this->reference = $transaction ? (int) EncryptionIdPagSeguro::decrypt($this->obj_transaction->getReference()) : null;
 }
 private function isAbandonedOrder($reference)
 {
     if (strpos($reference, Configuration::get('PAGSEGURO_ID')) !== false) {
         $initiated = Util::getPagSeguroStatusName(0);
         $decReference = (int) EncryptionIdPagSeguro::decrypt($reference);
         $orderState = OrderHistory::getLastOrderState($decReference);
         if (strcmp($orderState->name, $initiated) != 0) {
             return false;
         }
     } else {
         return false;
     }
     return true;
 }
Exemplo n.º 3
0
 private function validatePagSeguroId()
 {
     $id = Configuration::get('PAGSEGURO_ID');
     if (empty($id)) {
         $id = EncryptionIdPagSeguro::idRandomGenerator();
         return Configuration::updateValue('PAGSEGURO_ID', $id);
     }
     return true;
 }
Exemplo n.º 4
0
 public function validateOrderAbandoned($params)
 {
     $isValidated = true;
     if (strpos($params['reference'], Configuration::get('PAGSEGURO_ID')) !== false) {
         $initiated = Util::getStatusCMS(0);
         $order_state = OrderHistory::getLastOrderState((int) EncryptionIdPagSeguro::decrypt($params['reference']));
         if (strcmp($order_state->name, $initiated) != 0) {
             $isValidated = false;
         }
     } else {
         $isValidated = false;
     }
     return $isValidated;
 }