Check and update refund details for made refunds
@throws Exception
424614
protected function _updateRefundDetails()
    {
        $sQuery = "SELECT BESTITAMAZONREFUNDID
            FROM bestitamazonrefunds
            WHERE STATE = 'Pending'
              AND BESTITAMAZONREFUNDID != ''";

        $aResult = $this->_getContainer()->getDatabase()->getAll($sQuery);

        foreach ($aResult as $aRow) {
            $oData = $this->_getContainer()->getClient()->getRefundDetails($aRow['BESTITAMAZONREFUNDID']);

            if (isset($oData->GetRefundDetailsResult->RefundDetails->RefundStatus->State)) {
                $this->_addToMessages(
                    "Refund ID: {$oData->GetRefundDetailsResult->RefundDetails->RefundReferenceId} - "
                    ."Status: {$oData->GetRefundDetailsResult->RefundDetails->RefundStatus->State}<br/>"
                );
            }
        }
    }
921416
public Boolean refund(RefundDetail refundDetail){
        try {
            String url = Alipay.GATEWAY + "_input_charset=" + alipay.inputCharset;
            Map<String, String> refundParams = buildRefundParams(refundDetail);
            String resp = Http.get(url).params(refundParams).request();
            XmlReaders reader = XmlReaders.create(resp);
            String isSuccess = reader.getNodeStr("is_success");
            if ("T".equals(isSuccess)){
                return Boolean.TRUE;
            }
        } catch (XmlException e){
            // ignore xml parse error
        } catch (Exception e){
            throw new AliPayException(e);
        }
        return Boolean.FALSE;
    }
392497
private function checkProperties()
    {
        if (!isset($this->listId)) {
            throw new \Exception('[listId] is not set', 1);
        }

        if (!isset($this->installationUrl)) {
            throw new \Exception('[installationUrl] is not set', 1);
        }

        if (!isset($this->apiKey)) {
            throw new \Exception('[apiKey] is not set', 1);
        }
    }
835697
def get_refund_details(
      amazon_refund_id,
      merchant_id: @merchant_id,
      mws_auth_token: nil
    )

      parameters = {
        'Action' => 'GetRefundDetails',
        'SellerId' => merchant_id,
        'AmazonRefundId' => amazon_refund_id
      }

      optional = {
        'MWSAuthToken' => mws_auth_token
      }

      operation(parameters, optional)
    end
757657
function refundPayment(id, callback) {
    var client = new this.clients.Payments();
    client.refund(id, callback);
  }
324736
public function commit()
    {
        if ($this->_active && $this->_db->getActive()) {
            $this->_db->getPdoInstance()->commit();
            $this->_active = false;
        } else {
            throw new Exception('"Transaction"尚属未激活状态，不能执行"commit"和"rollback"操作', 101300601);
        }
    }
255089
public function refundOrder($orderCode = false, $amount = null)
    {
        if (empty($orderCode) || !is_string($orderCode)) {
            Error::throwError('ip', Error::$errors['refund']['ordercode']);
        }
        OrderService::refundOrder($orderCode, $amount);
    }
1227128
def get_refund_transaction(self):
        
        try:
            url = self._refund_transaction_url
        except AttributeError:
            raise ValueError("No refund transaction is available for this transaction")

        resp, elem = self.element_for_url(url)
        value = self.value_for_element(elem)
        return value
130498
public function rollBackTransaction() {
        // check that a transaction is really active
        if (!$this->getConnection(false)->inTransaction())
            throw new \Exception("Not inside a DB transaction. Cannot commit.");

        try {
            $this->getConnection(false)->rollBack();
        } catch (Exception $_e) {
            throw new \Exception("Error while rolling back DB transaction: ".$pe->getMessage());
        }
    }
699399
def admin_refund
      return if !user_is_allowed('orders', 'edit')
    
      response = Caboose::StdClass.new({
        'refresh' => nil,
        'error' => nil,
        'success' => nil
      })
    
      order = Order.find(params[:id])
    
      if order.financial_status != 'captured'
        response.error = "This order hasn't been captured yet, you will need to void instead"
      else
        if PaymentProcessor.refund(order)
          order.update_attributes(
            :financial_status => 'refunded',
            :status => 'cancelled'
          )
          
          response.success = 'Order refunded successfully'
        else
          response.error = 'Error refunding order'
        end
        
        #if order.calculate_net < (order.amount_discounted || 0) || PaymentProcessor.refund(order)
        #  order.financial_status = 'refunded'
        #  order.status = 'refunded'
        #  order.save
        #  
        #  if order.discounts.any?
        #    discount = order.discounts.first
        #    amount_to_refund = order.calculate_net < order.amount_discounted ? order.calculate_net : order.amount_discounted
        #    discount.update_attribute(:amount_current, amount_to_refund + discount.amount_current)
        #  end
        #  
        #  response.success = "Order refunded successfully"
        #else
        #  response.error = "Error refunding order."
        #end
      end
    
      render json: response
      
      # return if !user_is_allowed('orders', 'edit')
      #     
      # response = Caboose::StdClass.new({
      #   'refresh' => nil,
      #   'error' => nil,
      #   'success' => nil
      # })
      #     
      # order = Order.find(params[:id])
      #     
      # if order.financial_status != 'captured'
      #   response.error = "This order hasn't been captured yet, you will need to void instead"
      # else
      #   if PaymentProcessor.refund(order)
      #     order.financial_status = 'refunded'
      #     order.status = 'refunded'
      #     order.save
      #     
      #     # Add the variant quantities ordered back
      #     order.cancel
      #     
      #     response.success = "Order refunded successfully"
      #   else
      #     response.error = "Error refunding order."
      #   end
      # end
      #     
      # render :json => response
    end
839615
public function getTransaction() {
        if(!$this->isInTransaction()) {
            throw new \Exception('This transaction has already been rolled back, or committed, or has not began yet');
        }
        $transactions = $this->getTransactions();
        return $transactions[$this->getDbService()];
    }
846804
protected function checkRequest()
    {
        if ('prod' === $this->getKernel()->getEnvironment()) {
            throw new \RuntimeException('Debug Payment is not authorized in production environment.');
        }

        $request = $this->getCurrentRequest();
        $reference = $request->get('reference');

        $order = $this->getOrderManager()->findOneBy(['reference' => $reference]);

        if (!$order) {
            throw new NotFoundHttpException(sprintf('Order with reference "%s" not found.', $reference));
        }

        if ($request->get('check') !== $this->getDebugPayment()->generateUrlCheck($order)) {
            throw new InvalidTransactionException($reference);
        }

        return $order;
    }
322927
public function check()
	{
		// Check if the db connector has been set.
		if (!($this->db instanceof MysqlDriver))
		{
			throw new \Exception('Database connection wrong type.');
		}

		// Check if the tables have been specified.
		if (empty($this->from))
		{
			throw new \Exception('ERROR: No Tables Specified');
		}

		return $this;
	}
1092909
public function run()
    {
        $this->_getOrderReferenceDetails();
        $amazonRefundId = $this->_refundToBuyer(
            $this->queryStringParams["refundAmount"], 
            $this->currencyCode
        );
        $this->_waitUntilRefundProcessingIsCompleted($amazonRefundId);
        $this->_getCaptureDetails();
        print HTML_LB.HTML_LB."Refund Sample is Complete";
    }
935579
private void doUpdateDebug() throws PageException {

	admin.updateDebug(Caster.toBoolean(getString("debug", ""), null), Caster.toBoolean(getString("database", ""), null), Caster.toBoolean(getString("exception", ""), null),
		Caster.toBoolean(getString("tracing", ""), null), Caster.toBoolean(getString("dump", ""), null), Caster.toBoolean(getString("timer", ""), null),
		Caster.toBoolean(getString("implicitAccess", ""), null), Caster.toBoolean(getString("queryUsage", ""), null));

	admin.updateDebugTemplate(getString("admin", action, "debugTemplate"));
	store();
	adminSync.broadcast(attributes, config);
    }
696945
@Override
  public final void process(final Map<String, Object> pRqVs,
    final IRequestData pRqDt) throws Exception {
    Cart cart = this.srvShoppingCart
      .getShoppingCart(pRqVs, pRqDt, false, false);
    if (cart == null) {
      redir(pRqVs, pRqDt);
      return;
    }
    String lnIdStr = pRqDt.getParameter("lnId");
    if (lnIdStr != null) {
      Long lnId = Long.valueOf(lnIdStr);
      CartLn cartLn = null;
      for (CartLn ci : cart.getItems()) {
        if (ci.getItsId().equals(lnId)) {
          if (ci.getDisab()) {
            throw new ExceptionWithCode(ExceptionWithCode.SOMETHING_WRONG,
              "requested_item_disabled");
          }
          cartLn = ci;
          break;
        }
      }
      if (cartLn == null) {
        throw new ExceptionWithCode(ExceptionWithCode.SOMETHING_WRONG,
          "requested_item_not_found");
      }
      if (cartLn.getForc()) {
        throw new ExceptionWithCode(ExceptionWithCode.SOMETHING_WRONG,
          "requested_item_forced");
      }
      AccSettings as = (AccSettings) pRqVs.get("accSet");
      TaxDestination txRules = this.srvShoppingCart.revealTaxRules(pRqVs,
        cart, as);
      this.srvShoppingCart.delLine(pRqVs, cartLn, txRules);
      this.srvShoppingCart.hndCartChan(pRqVs, cart, txRules);
      if (txRules != null) {
        pRqDt.setAttribute("txRules", txRules);
      }
      redir(pRqVs, pRqDt);
    } else {
      throw new ExceptionWithCode(ExceptionWithCode.SOMETHING_WRONG,
        "there_is_no_cart_item_id");
    }
  }
457866
def create_refund(self, refund_deets):
        """"""
        request = self._post('transactions/refunds', refund_deets)
        return self.responder(request)