Ejemplo n.º 1
0
 /**
  * Once all conditions are validated, process the transaction.
  *
  * @return array [0] => log type (payment, cancel, info), [1] => log message
  */
 public function processTransaction()
 {
     switch ($this->_filtered['type']) {
         case self::PAYMENT_CHARGE_BACK:
             if ($this->_upgradeRecord) {
                 $this->_upgradeModel->downgradeUserUpgrade($this->_upgradeRecord);
                 return array('cancel', 'OK');
             }
             break;
         default:
             $this->_upgradeRecordId = $this->_upgradeModel->upgradeUser($this->_user['user_id'], $this->_upgrade);
             return array('payment', 'OK');
     }
     $this->alreadyprocessed = true;
     return array('info', 'OK, no action');
 }
Ejemplo n.º 2
0
 /**
  * Once all conditions are validated, process the transaction.
  *
  * @return array [0] => log type (payment, cancel, info), [1] => log message
  */
 public function processTransaction()
 {
     switch ($this->_filtered['txn_type']) {
         case 'web_accept':
         case 'subscr_payment':
             if ($this->_filtered['payment_status'] == 'Completed') {
                 $this->_upgradeRecordId = $this->_upgradeModel->upgradeUser($this->_user['user_id'], $this->_upgrade);
                 return array('payment', 'Payment received, upgraded/extended');
             }
             break;
     }
     if ($this->_filtered['payment_status'] == 'Refunded' || $this->_filtered['payment_status'] == 'Reversed') {
         if ($this->_upgradeRecord) {
             $this->_upgradeModel->downgradeUserUpgrade($this->_upgradeRecord);
             return array('cancel', 'Payment refunded/reversed, downgraded');
         }
     }
     return array('info', 'OK, no action');
 }
Ejemplo n.º 3
0
 /**
  * Once all conditions are validated, process the transaction.
  *
  * @return array [0] => log type (payment, cancel, info), [1] => log message
  */
 public function processTransaction()
 {
     switch ($this->_filtered['txn_type']) {
         case 'web_accept':
         case 'subscr_payment':
             if ($this->_filtered['payment_status'] == 'Completed') {
                 $this->_upgradeRecordId = $this->_upgradeModel->upgradeUser($this->_user['user_id'], $this->_upgrade, !empty($this->_filtered['parent_txn_id']));
                 return array('payment', 'Payment received, upgraded/extended');
             }
             break;
     }
     if ($this->_filtered['payment_status'] == 'Refunded' || $this->_filtered['payment_status'] == 'Reversed') {
         if ($this->_upgradeRecord) {
             $this->_upgradeModel->downgradeUserUpgrade($this->_upgradeRecord, false);
             return array('cancel', 'Payment refunded/reversed, downgraded');
         }
     } else {
         if ($this->_filtered['payment_status'] == 'Canceled_Reversal' && $this->_upgradeRecord) {
             $this->_upgradeRecordId = $this->_upgradeModel->upgradeUser($this->_user['user_id'], $this->_upgrade, true, isset($this->_upgradeRecord['original_end_date']) ? $this->_upgradeRecord['original_end_date'] : $this->_upgradeRecord['end_date']);
             return array('payment', 'Reversal cancelled, upgrade reactivated');
         }
     }
     return array('info', 'OK, no action');
 }