private function makeRefund() { $this->debug('2checkout refund started'); $transaction = new Pap_Db_Transaction(); $transaction->setOrderId($this->getSubscriptionID()); try{ $collection = $transaction->loadCollection(array(Pap_Db_Table_Transactions::ORDER_ID)); } catch (Gpf_Exception $e) { $this->debug('2checkout refund failed - Error in loading transactions: '.$e->getMessage()); return; } if($collection->getSize() == 0) { $this->debug('2checkout refund failed: No transactions with order id: '.$this->getSubscriptionID()); return; } foreach($collection as $transactionDb) { $transaction = new Pap_Common_Transaction(); $transaction->processRefundChargeback($transactionDb->getId(), $transactionDb->getType()); $this->debug('2checkout refunded transaction with id '.$transactionDb->getId()); } }
/** * * @service commission write * @param $fields * @return Gpf_Rpc_Action */ public function deleteCommissionType(Gpf_Rpc_Params $params) { $action = new Gpf_Rpc_Action($params); $action->setErrorMessage($this->_('Failed to delete type, some transactions are connected to this type. Remove them first.')); $action->setInfoMessage($this->_('Commission type successfully removed')); $commTypeId = $action->getParam('commtypeid'); $transaction = new Pap_Db_Transaction(); $transaction->setCommissionTypeId($commTypeId); $collection = $transaction->loadCollection(array(Pap_Db_Table_Transactions::COMMISSIONTYPEID)); if ($collection->getSize() > 0) { $action->addError(); return $action; } $commissionType = new Pap_Db_CommissionType(); $commissionType->setId($commTypeId); $commissionType->delete(); $action->addOk(); return $action; }