the method is called when an external payment handler returns successfully.
348586
public function PostProcessExternalPaymentHandlerHook()
    {
        $bPaymentTransmitOk = parent::PostProcessExternalPaymentHandlerHook();
        if ($bPaymentTransmitOk) {
            $oGlobal = TGlobal::instance();
            $aUserData = $oGlobal->GetUserData();

            // check if return data is ok...
            $aReqFields = array('merchid', 'orderid', 'amount', 'currency', 'result', 'timestamp', 'psphash');
            foreach ($aReqFields as $sFieldName) {
                $bPaymentTransmitOk = ($bPaymentTransmitOk && array_key_exists($sFieldName, $aUserData));
            }
            if ($bPaymentTransmitOk && 'success' == $aUserData['result'] && (0 == strcmp($this->GetMontradaResponseHash($aUserData), $aUserData['psphash']))) {
                // all good... we can continue to our order confirm page
                // need to fetch the transaction id
                $aResult = $this->ExecuteRequestCall('txnresult', array('orderid' => $aUserData['orderid']));
                $this->sMontradaTransactionId = $aResult['trefnum'];
                $this->aCheckoutDetails = $aUserData;
            }
        }

        return $bPaymentTransmitOk;
    }
21316
def answer
      if request.post?
        if ipn_notify.acknowledge
          LolitaPaypal::Transaction.create_transaction(ipn_notify, payment_from_ipn, request)
        end
        render nothing: true
      else
        if payment_from_ipn
          redirect_to payment_from_ipn.paypal_return_path
        else
          render text: I18n.t('lolita_paypal.wrong_request'), status: 400
        end
      end
    ensure
      LolitaPaypal.logger.info("[#{session_id}][#{payment_from_ipn && payment_from_ipn.id}][answer] #{params}")
    end
1044835
public function processPaymentAction()
    {
        $order = $this->checkRequest();

        return $this->getDebugPayment()->processCallback($order, $this->getCurrentRequest()->get('action'));
    }
45996
function(){
					console.log("handleOnlinePrivatePayment queued, will wait for "+key);
					eventBus.once(key, function(bValid){
						if (!bValid)
							return cancelAllKeys();
						assocValidatedByKey[key] = true;
						if (bParsingComplete)
							checkIfAllValidated();
						else
							console.log('parsing incomplete yet');
					});
					cb();
				}
735961
public function processPayment(StripeMethod $paymentMethod, $amount)
    {
        /**
         * check and set payment data.
         */
        $chargeParams = $this->prepareData(
            $paymentMethod,
            $amount
        );

        /**
         * make payment.
         */
        $transaction = $this
            ->transactionFactory
            ->create($chargeParams);

        /**
         * Payment paid done.
         *
         * Paid process has ended ( No matters result )
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderDone(
                $this->paymentBridge,
                $paymentMethod
            );

        /**
         * when a transaction is successful, it is marked as 'closed'.
         */
        if ($transaction['paid'] != 1) {

            /**
             * Payment paid failed.
             *
             * Paid process has ended failed
             */
            $this
                ->paymentEventDispatcher
                ->notifyPaymentOrderFail(
                    $this->paymentBridge,
                    $paymentMethod
                );

            throw new PaymentException();
        }

        $paymentMethod
            ->setTransactionId($transaction['id'])
            ->setTransactionStatus('paid')
            ->setTransactionResponse($transaction);

        /**
         * Payment paid successfully.
         *
         * Paid process has ended successfully
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderSuccess(
                $this->paymentBridge,
                $paymentMethod
            );

        return $this;
    }
713798
function Process(PaymentRequest $req)
	{
		$resp = new PaymentResponse();
		$resp->OrderNumber = $req->OrderNumber;

		// before bothering with contacting the processor, check for some basic fields
		if ($req->CCNumber == '')
		{
			$resp->IsSuccess = false;
			$resp->ResponseCode = "0";
			$resp->ResponseMessage = "No Credit Card Number Provided";
			return $resp;
		}

		if ($req->CustomerFirstName == '')
		{
			$resp->IsSuccess = false;
			$resp->ResponseCode = "0";
			$resp->ResponseMessage = "No Cardholder Name Provided";
			return $resp;
		}

		// post to paypal service
		// Set request-specific fields.
		$paymentType = $req->TransactionType == PaymentRequest::$TRANSACTION_TYPE_AUTH_CAPTURE
			? urlencode('Sale')
			: urlencode('Authorization') ;
		$firstName = urlencode($req->CustomerFirstName);
		$lastName = urlencode($req->CustomerLastName);
		$creditCardType = urlencode( trim($req->CCType) );
		$creditCardNumber = urlencode( trim($req->CCNumber) );

		// month needs to be two digits - padded with leading zero if necessary
		$padDateMonth = urlencode( trim(str_pad($req->CCExpMonth, 2, '0', STR_PAD_LEFT)) );

		// year needs to be full 4-digit
		$expDateYear = urlencode( $this->GetFullYear( trim($req->CCExpYear) ) );

		$email = (urlencode($req->CustomerEmail));
		$invoiceNum = (urlencode($req->InvoiceNumber));
		$orderDesc = (urlencode($req->OrderDescription));
		$cvv2Number = urlencode($req->CCSecurityCode);
		$address1 = urlencode($req->CustomerStreetAddress);
		$address2 = urlencode($req->CustomerStreetAddress2);
		$city = urlencode($req->CustomerCity);
		$state = urlencode($req->CustomerState);
		$zip = urlencode($req->CustomerZipCode);
		$amount = urlencode($req->TransactionAmount);
		$currencyID = urlencode($req->TransactionCurrency);		// or other currency ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')

		// soft descriptor can only be a max of 22 chars with no non-alphanumeric characters
		$softdescriptor = urlencode(substr(preg_replace("/[^a-zA-Z0-9\s]/", "", $req->SoftDescriptor),0,22 ));

		// legit country code list: https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_country_codes
		$country = urlencode( strtoupper($req->CustomerCountry) );	// US or other valid country code
		if ($country == "USA") $country = "US";


		// Add request-specific fields to the request string.
		$nvpStr = "&PAYMENTACTION=$paymentType&AMT=$amount&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber".
					"&EXPDATE=$padDateMonth$expDateYear&CVV2=$cvv2Number&FIRSTNAME=$firstName&LASTNAME=$lastName".
					"&STREET=$address1&CITY=$city&STATE=$state&ZIP=$zip&COUNTRYCODE=$country&CURRENCYCODE=$currencyID".
					"&DESC=$orderDesc&INVNUM=$invoiceNum&EMAIL=$email&SOFTDESCRIPTOR=$softdescriptor";

		// make the post - use a try/catch in case of network errors
		try
		{
			$resp->RawResponse = $this->PPHttpPost('DoDirectPayment', $nvpStr);

			if ("SUCCESS" == strtoupper($resp->RawResponse["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($resp->RawResponse["ACK"]))
			{
				$resp->IsSuccess = true;
				$resp->TransactionId = urldecode( $this->GetArrayVal($resp->RawResponse,"TRANSACTIONID") );
				$resp->ResponseCode = urldecode( "AVSCODE=" . $this->GetArrayVal($resp->RawResponse,"AVSCODE") . ",CVV2MATCH=" . $this->GetArrayVal($resp->RawResponse,"CVV2MATCH"));
				$resp->ResponseMessage = urldecode( "Charge of " . $this->GetArrayVal($resp->RawResponse,"AMT") . " Posted" );
			}
			else
			{
				// for error descriptions, refrer to https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_errorcodes
				$resp->IsSuccess = false;
				$resp->ResponseCode = urldecode( $this->GetArrayVal($resp->RawResponse,"L_ERRORCODE0") );
				$resp->ResponseMessage = $this->GetErrorMessage($resp->RawResponse);

			}

			$resp->ParsedResponse = "";
			$delim = "";
			foreach (array_keys($resp->RawResponse) as $key)
			{
				$resp->ParsedResponse .= $delim . $key . "='" . urldecode( $resp->RawResponse[$key]) . "'";
				$delim = ", ";
			}

		}
		catch (Exception $ex)
		{
			// this means we had a connection error talking to the gateway
			$resp->IsSuccess = false;
			$resp->ResponseCode = $ex->getCode();
			$resp->ResponseMessage = $ex->getMessage();
		}



		return $resp;
	}
943613
private void postProcess(ProcessMethodCallback callback, TransactionContext txContext,
                           InputDatum input, ProcessMethod.ProcessResult result) {
    InputContext inputContext = input.getInputContext();
    Throwable failureCause = null;
    FailureReason.Type failureType = FailureReason.Type.IO_ERROR;
    try {
      if (result.isSuccess()) {
        // If it is a retry input, force the dequeued entries into current transaction.
        if (input.getRetry() > 0) {
          input.reclaim();
        }
        txContext.finish();
      } else {
        failureCause = result.getCause();
        failureType = FailureReason.Type.USER;
        txContext.abort();
      }
    } catch (Throwable e) {
      LOG.error("Transaction operation failed: {}", e.getMessage(), e);
      failureType = FailureReason.Type.IO_ERROR;
      if (failureCause == null) {
        failureCause = e;
      }
      try {
        if (result.isSuccess()) {
          txContext.abort();
        }
      } catch (Throwable ex) {
        LOG.error("Fail to abort transaction: {}", inputContext, ex);
      }
    }

    try {
      if (failureCause == null) {
        callback.onSuccess(result.getEvent(), inputContext);
      } else {
        callback.onFailure(result.getEvent(), inputContext,
                           new FailureReason(failureType, failureCause.getMessage(), failureCause),
                           createInputAcknowledger(input));
      }
    } catch (Throwable t) {
      LOG.error("Failed to invoke callback.", t);
    }
  }
4988
def on_success(self, fn, *args, **kwargs):
        

        self._callbacks.append((fn, args, kwargs))

        result = self._resulted_in
        if result is not _NOTHING_YET:
            self._succeed(result=result)
508387
def success_response(self, method_resp, **kw):
        
        resp = {
            'status': True,
            'indexing': config.is_indexing(self.working_dir),
            'lastblock': virtualchain_hooks.get_last_block(self.working_dir),
        }

        resp.update(kw)
        resp.update(method_resp)
        
        if self.is_stale():
            # our state is stale
            resp['stale'] = True
            resp['warning'] = 'Daemon has not reindexed since {}'.format(self.last_indexing_time)

        return resp
859907
def get_payment_status(external_reference)
      response = send_search_request({external_reference: external_reference, access_token: access_token})

      if response['results'].empty?
        "pending"
      else
        response['results'][0]['collection']['status']
      end
    end
248754
private IAsyncResultHandler<IApiConnectionResponse> createApiConnectionResponseHandler() {
        return (IAsyncResult<IApiConnectionResponse> result) -> {
            if (result.isSuccess()) {
                requestMetric.setApiEnd(new Date());
                // The result came back. NB: still need to put it through the response chain.
                apiConnectionResponse = result.getResult();
                ApiResponse apiResponse = apiConnectionResponse.getHead();
                context.setAttribute("apiman.engine.apiResponse", apiResponse); //$NON-NLS-1$

                // Execute the response chain to evaluate the response.
                responseChain = createResponseChain((ApiResponse response) -> {
                    // Send the api response to the caller.
                    final EngineResultImpl engineResult = new EngineResultImpl(response);
                    engineResult.setConnectorResponseStream(apiConnectionResponse);

                    resultHandler.handle(AsyncResultImpl.create(engineResult));

                    // We've come all the way through the response chain successfully
                    responseChain.bodyHandler(buffer -> {
                        requestMetric.setBytesDownloaded(requestMetric.getBytesDownloaded() + buffer.length());
                        engineResult.write(buffer);
                    });

                    responseChain.endHandler(isEnd -> {
                        engineResult.end();
                        finished = true;
                        metrics.record(requestMetric);
                    });

                    // Signal to the connector that it's safe to start transmitting data.
                    apiConnectionResponse.transmit();
                });

                // Write data from the back-end response into the response chain.
                apiConnectionResponse.bodyHandler(buffer -> responseChain.write(buffer));

                // Indicate back-end response is finished to the response chain.
                apiConnectionResponse.endHandler(isEnd -> responseChain.end());

                responseChain.doApply(apiResponse);
            } else {
                resultHandler.handle(AsyncResultImpl.create(result.getError()));
            }
        };
    }
492689
private void completeCall(ClientResponseImpl response) {
        // if we're keeping track, calculate result size
        if (m_perCallStats.samplingProcedure()) {
            m_perCallStats.setResultSize(response.getResults());
        }
        m_statsCollector.endProcedure(response.getStatus() == ClientResponse.USER_ABORT,
                                      (response.getStatus() != ClientResponse.USER_ABORT) &&
                                      (response.getStatus() != ClientResponse.SUCCESS),
                                      m_perCallStats);
        // allow the GC to collect per-call stats if this proc isn't called for a while
        m_perCallStats = null;

        // send the response to the caller
        // must be done as IRM to CI mailbox for backpressure accounting
        response.setClientHandle(m_clientHandle);
        InitiateResponseMessage irm = InitiateResponseMessage.messageForNTProcResponse(m_ciHandle,
                                                                                       m_ccxn.connectionId(),
                                                                                       response);
        m_mailbox.deliver(irm);

        m_ntProcService.handleNTProcEnd(ProcedureRunnerNT.this);
    }
1007881
@Override
    public IPromise<T> onResult(Consumer<T> resultHandler) {
        return then( (r,e) -> {
            if ( e == null ) {
                resultHandler.accept((T) r);
            }
        });
    }
226858
public void pay(PayReq requ, final PayHandler handler) {
        HMSAgentLog.i("pay:requ=" + StrUtils.objDesc(requ) + "  handler=" + StrUtils.objDesc(handler));

        if (payReq != null) {
            HMSAgentLog.e("pay:has already a pay to dispose");
            if (handler != null) {
                new Handler(Looper.getMainLooper()).post(new CallbackResultRunnable<PayResultInfo>(handler, HMSAgent.AgentResultCode.REQUEST_REPEATED, null));
            }
            return;
        }

        this.payReq = requ;
        this.handler = handler;
        retryTimes = MAX_RETRY_TIMES;
        connect();
    }
555551
def online(cls, payload, ip, req_sig):
        

        from getpaid.models import Payment

        params = json.loads(payload)
        order_data = params.get('order', {})
        pos_id = order_data.get('merchantPosId')
        payment_id = order_data.get('extOrderId')

        key2 = cls.get_backend_setting('key2')

        if pos_id != cls.get_backend_setting('pos_id'):
            logger.warning('Received message for different pos: {}'.format(pos_id))
            return 'ERROR'

        req_sig_dict = cls.parse_payu_sig(req_sig)
        sig = cls.compute_sig(payload, key2, algorithm=req_sig_dict.get('algorithm', 'md5'))

        if sig != req_sig_dict['signature']:
            logger.warning('Received message with malformed signature. Payload: {}'.format(payload))
            return 'ERROR'

        try:
            payment = Payment.objects.get(id=payment_id)
        except Payment.DoesNotExist:
            logger.warning('Received message for nonexistent payment: {}.\nPayload: {}'.format(payment_id, payload))
            return 'ERROR'
        status = order_data['status']
        if payment.status != 'paid':
            if status == 'COMPLETED':
                payment.external_id = order_data['orderId']
                payment.amount = Decimal(order_data['totalAmount']) / Decimal(100)
                payment.amount_paid = payment.amount
                payment.currenct = order_data['currencyCode']
                payment.paid_on = pendulum.parse(params['localReceiptDateTime']).in_tz('utc')
                payment.description = order_data['description']
                payment.change_status('paid')

            elif status == 'PENDING':
                payment.change_status('in_progress')
            elif status in ['CANCELED', 'REJECTED']:
                payment.change_status('cancelled')
        return 'OK'
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")
169109
public function processPayment()
    {
        $paymentMethod = $this
            ->methodFactory
            ->create();

        /**
         * At this point, order must be created given a card, and placed in
         * PaymentBridge.
         *
         * So, $this->paymentBridge->getOrder() must return an object
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderLoad(
                $this->paymentBridge,
                $paymentMethod
            );

        /**
         * Order exists right here.
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderCreated(
                $this->paymentBridge,
                $paymentMethod
            );

        /**
         * Payment paid done.
         *
         * Paid process has ended (No matters result)
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderDone(
                $this->paymentBridge,
                $paymentMethod
            );

        /**
         * Payment paid successfully.
         *
         * Paid process has ended successfully
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderSuccess(
                $this->paymentBridge,
                $paymentMethod
            );

        return $this;
    }