Posts an offline payment on this invoice

 @return [Transaction]
 @raise [Error] If the transaction fails.
768731
def enter_offline_payment(attrs={})
      Transaction.from_response API.post("#{uri}/transactions", attrs.empty? ? nil : Transaction.to_xml(attrs))
    rescue Recurly::API::UnprocessableEntity => e
      raise Invalid, e.message
    end
1309075
private static OfflineData createOfflineData(
      DateTime transactionTime,
      long transactionMicroAmount,
      String transactionCurrency,
      String conversionName,
      List<UserIdentifier> userIdentifiers) {
    StoreSalesTransaction storeSalesTransaction = new StoreSalesTransaction();

    // For times use the format yyyyMMdd HHmmss [tz].
    // For details, see
    // https://developers.google.com/adwords/api/docs/appendix/codes-formats#date-and-time-formats
    storeSalesTransaction.setTransactionTime(transactionTime.toString("yyyyMMdd HHmmss ZZZ"));
    storeSalesTransaction.setConversionName(conversionName);
    storeSalesTransaction.setUserIdentifiers(
        userIdentifiers.toArray(new UserIdentifier[userIdentifiers.size()]));

    Money money = new Money();
    money.setMicroAmount(transactionMicroAmount);

    MoneyWithCurrency moneyWithCurrency = new MoneyWithCurrency();
    moneyWithCurrency.setMoney(money);
    moneyWithCurrency.setCurrencyCode(transactionCurrency);
    storeSalesTransaction.setTransactionAmount(moneyWithCurrency);

    OfflineData offlineData = new OfflineData();
    offlineData.setStoreSalesTransaction(storeSalesTransaction);
    return offlineData;
  }
1204615
def end_transaction(result = nil)
      return nil unless (transaction = current_transaction)

      self.current_transaction = nil

      transaction.done result

      enqueue.call transaction

      transaction
    end
113338
public function postCancelBill()
	{
		$bill_id = Input::get('transaction');
		$provider_id = Input::get('shop');
		$bill = Bill::getBill($bill_id, $provider_id);

		//предполагаем ошибку
		$error = 'Счёт не найден';

		if ($bill) {
			//Если счёт отмеён, то кидаем callback и отдаём успех
			if ($bill->doCancel($bill_id)) {
				$this->sendCallback($bill_id);

				return array(
					'message' => 'Счёт отменён',
				);
			}
			$error = 'Счёт не отменён. Проверьте статус.';
		}

		//Отдаём ошибку
		return array(
			'error'   => true,
			'message' => $error,
		);
	}
432948
def success
      payment.order.next
      flash.notice = Spree.t(:order_processed_successfully)
      flash['order_completed'] = true
      redirect_to spree.order_path(payment.order)
    end
911162
def capture(self, payment_id, amount, data={}, **kwargs):
        "
        url = "{}/{}/capture".format(self.base_url, payment_id)
        data['amount'] = amount
        return self.post_url(url, data, **kwargs)
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;
    }
290986
def submit_offline_reports(self):
        
        smtp_enabled = bool(self._smtp)
        hq_enabled = bool(self._hq)
        offline_reports = self.get_offline_reports()
        logging.info('Submitting %d offline crash reports' % len(offline_reports))
        offline_reports = offline_reports[:self.send_at_most]

        if smtp_enabled:
            try:
                smtp_success = self._smtp_send_offline_reports(*offline_reports)
            except Exception as e:
                logging.error(e)
                smtp_success = [False] * len(offline_reports)
        else:
            smtp_success = [True] * len(offline_reports)

        if hq_enabled:
            try:
                hq_success = self._hq_send_offline_reports(*offline_reports)
            except Exception as e:
                logging.error(e)
                hq_success = [False] * len(offline_reports)
        else:
            hq_success = [True] * len(offline_reports)

        remaining_reports = self.delete_offline_reports()
        success = [s1 and s2 for (s1, s2) in zip(smtp_success, hq_success)]
        logging.info('%d crash reports successfully submitted' % success.count(True))
        logging.info('%d crash reports remain to be submitted' % len(remaining_reports))
        return all(success)
585553
def post(url, req_hash={})
      res = nil
      res = perform_op(:post, req_hash) do
        res = @wrapper.post(url, req_hash)
      end
      return res
    end
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'
431298
def invoice!(attrs={})
      InvoiceCollection.from_response API.post(invoices.uri, attrs.empty? ? nil : Invoice.to_xml(attrs))
    rescue Recurly::API::UnprocessableEntity => e
      raise Invalid, e.message
    end
429551
public function processOffline()
    {
        if (!$this->realTime) {
            // Establish scrub now.
            if ($this->isScrubbed()) {
                // Asynchronous rejection (scrubbed)
                $this->status = Stat::TYPE_SCRUBBED;
                $this->valid  = false;
            } else {
                // Asynchronous acceptance.
                $this->status = Stat::TYPE_ACCEPTED;
                $this->valid  = true;
            }
        }
    }
116738
public function PostProcessExternalPaymentHandlerHook()
    {
        $bPaymentTransmitOk = parent::PostProcessExternalPaymentHandlerHook();
        if ($bPaymentTransmitOk) {
            $oGlobal = TGlobal::instance();
            $aUserData = $oGlobal->GetUserData();
            $bPaymentTransmitOk = $this->GetTransactionStatus($aUserData['PAYID']);
        }

        return $bPaymentTransmitOk;
    }
775610
def set_active_payment
      @payment ||= session[:payment_data][:billing_class].constantize.find(session[:payment_data][:billing_id])
    rescue
      render text: I18n.t('lolita_paypal.wrong_request'), status: 400
    end
477102
def post(url, doc = nil, options = {})
      connection(url, options) do |uri, conn|
        conn.post(uri.request_uri, doc, options)
      end
    end
438440
def payment(*params, &block)
      options = {:query => {}}
      options[:query] = params[0] if params.length > 0
      response = self.class.post '/projects/jobs', options
      yield(response) if block_given?
      response
    end
720974
def send_invoice(self):
		
		from .billing import Invoice

		try:
			invoice = Invoice._api_create(customer=self.id)
			invoice.pay()
			return True
		except InvalidRequestError:  # TODO: Check this for a more specific error message.
			return False