Performs actions when a payment is canceled
323665
protected function cancelPurchase()
    {
        $this->controller->setMessage($this->controller->text('Payment has been canceled'), 'warning');
        $gateway_message = $this->response->getMessage();
        if (!empty($gateway_message)) {
            $this->controller->setMessage($gateway_message, 'warning');
        }
    }
1121725
def orderExecuted(self, orderId):
        '''  '''
        if orderId == self.__stopOrderId:
            LOG.debug("smaStrategy stop order canceled %s" % orderId)
            # stop order executed
            self.__clearStopOrder()
1322127
public function callback($request)
    {
        $this->extend('onBeforeCallback');
        
        $data = $this->request->postVars();
        $status = "error";
        $order_id = 0;
        $payment_id = 0;

        $error_url = Controller::join_links(
            Director::absoluteBaseURL(),
            Payment_Controller::config()->url_segment,
            'complete',
            'error'
        );

        // Check if CallBack data exists and install id matches the saved ID
        if (isset($data) && isset($data['custom']) && isset($data['payment_status'])) {
            $order_id = $data['custom'];
            $paypal_request = 'cmd=_notify-validate';
            $final_response = "";
            
            // If the transaction ID is set, keep it
            if (array_key_exists("txn_id", $data)) {
                $payment_id = $data["txn_id"];
            }
            
            $listener = new PaypalIPN();
            
            if (Director::isDev()) {
                $listener->useSandbox();
            }

            try {
                $verified = $listener->verifyIPN();
            } catch (Exception $e) {
                error_log("Unable to verify IPN: " . $e->getMessage());
                return $this->httpError(500);
            }

            if ($verified) {
                // IPN response was "VERIFIED"
                switch ($data['payment_status']) {
                    case 'Canceled_Reversal':
                        $status = "canceled";
                        break;
                    case 'Completed':
                        $status = "paid";
                        break;
                    case 'Denied':
                        $status = "failed";
                        break;
                    case 'Expired':
                        $status = "failed";
                        break;
                    case 'Failed':
                        $status = "failed";
                        break;
                    case 'Pending':
                        $status = "pending";
                        break;
                    case 'Processed':
                        $status = "pending";
                        break;
                    case 'Refunded':
                        $status = "refunded";
                        break;
                    case 'Reversed':
                        $status = "canceled";
                        break;
                    case 'Voided':
                        $status = "canceled";
                        break;
                }
            } else {
                error_log("Invalid payment status");
                return $this->httpError(500);
            }
        } else {
            error_log("No payment details set");
            return $this->httpError(500);
        }
        
        $payment_data = ArrayData::array_to_object(array(
            "OrderID" => $order_id,
            "PaymentProvider" => "PayPal",
            "PaymentID" => $payment_id,
            "Status" => $status,
            "GatewayData" => $data
        ));
        
        $this->setPaymentData($payment_data);
        
        $this->extend('onAfterCallback');
        
        return $this->httpError(200);
    }
679889
def on_consumer_cancelled(self, method_frame):
        
        _logger.info('Consumer was cancelled remotely, shutting down: %r', method_frame)
        if self._channel:
            self._channel.close()
783076
def cancel(self, order_id):
        """"""

        response = self.request(E.cancelSslCertRequest(
            E.id(order_id)
        ))

        return int(response.data.id)
1060111
def canceled_during(self, year, month):
		""""""
		return self.canceled().filter(canceled_at__year=year, canceled_at__month=month)
198952
def handle_cancellation(session: CommandSession):
    

    def control(value):
        if _is_cancellation(value) is True:
            session.finish(render_expression(
                session.bot.config.SESSION_CANCEL_EXPRESSION))
        return value

    return control
1092863
private void cancelPendingSlotRequest(PendingSlotRequest pendingSlotRequest) {
		CompletableFuture<Acknowledge> request = pendingSlotRequest.getRequestFuture();

		returnPendingTaskManagerSlotIfAssigned(pendingSlotRequest);

		if (null != request) {
			request.cancel(false);
		}
	}
699891
def void
            
      resp = StdClass.new
      t = InvoiceTransaction.where(:invoice_id => self.id, :transaction_type => InvoiceTransaction::TYPE_AUTHORIZE, :success => true).first
      
      if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED
        resp.error = "This invoice has already been captured, you will need to refund instead"
      elsif t.nil?
        resp.error = "This invoice doesn't seem to be authorized."
      else
                
        sc = self.site.store_config
        ot = Caboose::InvoiceTransaction.new(
          :invoice_id => self.id,
          :date_processed => DateTime.now.utc,
          :transaction_type => InvoiceTransaction::TYPE_VOID,
          :payment_processor => sc.pp_name,
          :amount => self.total
        )
        
        case sc.pp_name
          when 'authorize.net'            
            response = AuthorizeNet::SIM::Transaction.new(
              sc.authnet_api_login_id, 
              sc.authnet_api_transaction_key,                      
              self.total,
              :transaction_type => InvoiceTransaction::TYPE_VOID,
              :transaction_id => t.transaction_id,
              :test => sc.pp_testing
            )                    
            self.update_attributes(
              :financial_status => Invoice::FINANCIAL_STATUS_VOIDED,
              :status => Invoice::STATUS_CANCELED
            )
            self.save          
            # TODO: Add the variant quantities invoiceed back        
            resp.success = "Invoice voided successfully"
                        
            ot.success        = response.response_code && response.response_code == '1'            
            ot.transaction_id = response.transaction_id
            #ot.auth_code      = response.authorization_code
            ot.response_code  = response.response_code            
            ot.save
          
          when 'stripe'
            # TODO: Implement void invoice for strip
            
          when 'payscape'
            # TODO: Implement void invoice for payscape
            
        end
        
      end
      return resp      
    end
570171
public function cancel_preapproval_payment($id) {
        $request = array(
            "uri" => "/preapproval/{$id}",
            "params" => array(
                "access_token" => $this->get_access_token()
            ),
            "data" => array(
                "status" => "cancelled"
            )
        );

        $response = MPRestClient::put($request);
        return $response;
    }
470032
def cancel(self):
        
        try:
            self.post("control", action="cancel")
        except HTTPError as he:
            if he.status == 404:
                # The job has already been cancelled, so
                # cancelling it twice is a nop.
                pass
            else:
                raise
        return self
64584
def cancel(self):
        
        self._transaction = False
        try:
            cancel = self._con.cancel
        except AttributeError:
            pass
        else:
            cancel()
913376
public function cancelation(Request $request)
    {
        $em = $this->container->get('doctrine')->getManager();
        if( $request->get('token') != '' ){
            //Search on transaction paymentDetails the $paymentId
            $token = $request->get('token');
            $transaction = $em->getRepository('EcommerceBundle:Transaction')->findOnPaymentDetails($token);
            //UPDATE TRANSACTION
            if($transaction instanceof Transaction){
                $transaction->setStatus(Transaction::STATUS_CANCELLED);
                $em->flush();
            }

            $this->container->get('session')->getFlashBag()->add(
                'danger',
                'transaction.cancel'
            );
            
            return $this->redirect($this->generateUrl('core_profile_index', array('transactions' => true)));
            
        }
    }
651166
function cleanup( $process, $event )
    {
        //__DEBUG__
        $this->logger->writeTimedString("cleanup");
        //___end____

        $paymentObj = eZPaymentObject::fetchByProcessID( $process->attribute( 'id' ) );

        if ( is_object( $paymentObj ) )
        {
            $paymentObj->remove();
        }
    }
1360807
def event_payment(self, date, time, pid, commerce_id, transaction_id, request_ip, token, webpay_server):
        '''
        '''
        raise NotImplementedError("Logging Handler must implement event_payment")
502918
public void stopCharging(String subscriptionId, String serviceContextId) throws Exception {
    // Stop existing timers
    sendUpdatetimer.cancel();
    callDurationTimer.cancel();

    try {
      // Call listener method
      this.listener.creditTerminated();
    }
    catch (Exception e) {
      logger.error("Failure in Listener handling 'creditTerminated' callback.");
    }

    if(logger.isInfoEnabled()) {
      logger.info("(((o))) SERVICE HAS BEEN TERMINATED! (((o)))");
    }

    // Fetch existing Ro session
    ClientCCASession roSession = roSessions.get(serviceContextId);

    // Create and Send CCR (TERMINATION)
    JCreditControlRequest terminateCCR = createCCR(CC_REQUEST_TYPE_TERMINATION, subscriptionId, serviceContextId);
    roSession.sendCreditControlRequest(terminateCCR);

    switchStateMachine(SENT_CCR_TERMINATION);
  }
286331
protected function finishPurchase()
    {
        if ($this->response->isSuccessful()) {
            $this->updateOrderStatus();
            $this->addTransaction();
            $this->redirectSuccess();
        } else if ($this->response->isRedirect()) {
            $this->response->redirect();
        } else {
            $this->redirectError();
        }
    }