Abort a payment from its id.

        :param payment: The payment id or payment object
        :type payment: string|Payment

        :return: The payment resource
        :rtype: resources.Payment
540315
def abort(payment):
        
        if isinstance(payment, resources.Payment):
            payment = payment.id

        http_client = HttpClient()
        response, __ = http_client.patch(routes.url(routes.PAYMENT_RESOURCE, resource_id=payment), {'abort': True})
        return resources.Payment(**response)
654755
public function cancel_payment($id) {
        $request = array(
            "uri" => "/v1/payments/{$id}",
            "params" => array(
                "access_token" => $this->get_access_token()
            ),
            "data" => array(
                "status" => "cancelled"
            )
        );

        $response = MPRestClient::put($request);
        return $response;
    }
1034474
def retry(self):
		

		if not self.paid and not self.forgiven and not self.closed:
			stripe_invoice = self.api_retrieve()
			updated_stripe_invoice = (
				stripe_invoice.pay()
			)  # pay() throws an exception if the charge is not successful.
			type(self).sync_from_stripe_data(updated_stripe_invoice)
			return True
		return False
91920
def cancel(id)
      have_key?
      address = @url_privat + "/api/exchange/orders/" + id
      body = { }
      h = delete_ssl_with_sign(address, body)
      {
        "success" => h["success"],
      }
    end
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
1310792
def abort(self, transaction, headers=None, **keyword_headers):
        
        assert transaction is not None, "'transaction' is required"
        headers = utils.merge_headers([headers, keyword_headers])
        headers[HDR_TRANSACTION] = transaction
        self.send_frame(CMD_ABORT, headers)
972641
def check_payment(self, payment):
        
        validation = ""
        required = ["name", "IBAN", "BIC", "amount", "description"]

        for config_item in required:
            if config_item not in payment:
                validation += config_item.upper() + "_MISSING "

        if not isinstance(payment['amount'], int):
            validation += "AMOUNT_NOT_INTEGER "

        if 'execution_date' in payment:
            if not isinstance(payment['execution_date'], datetime.date):
                validation += "EXECUTION_DATE_INVALID_OR_NOT_DATETIME_INSTANCE"
            payment['execution_date'] = payment['execution_date'].isoformat()

        if validation == "":
            return True
        else:
            raise Exception('Payment did not validate: ' + validation)
1085815
def cancel_id(cls, id):
        
        conn = Qubole.agent()
        data = {"status": "kill"}
        return conn.put(cls.element_path(id), data)
1204609
def stop(self, id):
        
        path = partial(_path, self.adapter)
        path = path(id)
        return self._delete(path)
792812
def payment_mode(self, payment_mode):
        
        allowed_values = ["authorize", "capture"]
        if payment_mode is not None and payment_mode not in allowed_values:
            raise ValueError(
                "Invalid value for `payment_mode` ({0}), must be one of {1}"
                .format(payment_mode, allowed_values)
            )

        self._payment_mode = payment_mode
537352
def update
      @payment_method = PaymentMethod.find params[:payment_method_id]
      data = JSON.parse Base64.strict_decode64 params[:data]
      render text: "Bad signature\n", status: 401 and return unless @payment_method.check_signature params[:data], params[:signature]
      @order = Order.find data['order_id']

      raise ArgumentError unless @order.payments.completed.empty? &&
        data['currency'] == @order.currency &&
        BigDecimal(data['amount']) == @order.total &&
        data['type'] == 'buy' &&
        (data['status'] == 'success' || (@payment_method.preferred_test_mode && data['status'] == 'sandbox'))

      payment = @order.payments.create amount: @order.total, payment_method: @payment_method
      payment.complete!

      render text: "Thank you.\n"
    end
1109474
def transaction_abort(self, transaction_id, **kwargs):
        
        if transaction_id not in self.__transactions:
            raise workflows.Error("Attempting to abort unknown transaction")
        self.log.debug("Aborting transaction %s", transaction_id)
        self.__transactions.remove(transaction_id)
        self._transaction_abort(transaction_id, **kwargs)
577858
def make_payment(options = {})
      response = JSON.parse(@client.patch("items/#{send(:id)}/make_payment", options).body)
      @attributes = response['items']
      true
    end
1352987
public Result processPayment(Payment payment) throws PaytrailException {
		try {
			String data = marshaller.objectToString(payment);
			String url = serviceUrl + "/api-payment/create";
			
			IOHandlerResult requestResult = postJsonRequest(url, data);
			
			if (requestResult.getCode() != 201) {
				JsonError jsonError = marshaller.stringToObject(JsonError.class, requestResult.getResponse());
				throw new PaytrailException(jsonError.getErrorMessage());
	  	}
			
			return marshaller.stringToObject(Result.class, requestResult.getResponse());
		} catch (IOException e) {
			throw new PaytrailException(e);
		}
	}
1186162
def abort_transaction(self):
        
        self._check_ended()

        state = self._transaction.state
        if state is _TxnState.NONE:
            raise InvalidOperation("No transaction started")
        elif state is _TxnState.STARTING:
            # Server transaction was never started, no need to send a command.
            self._transaction.state = _TxnState.ABORTED
            return
        elif state is _TxnState.ABORTED:
            raise InvalidOperation("Cannot call abortTransaction twice")
        elif state in (_TxnState.COMMITTED, _TxnState.COMMITTED_EMPTY):
            raise InvalidOperation(
                "Cannot call abortTransaction after calling commitTransaction")

        try:
            self._finish_transaction_with_retry("abortTransaction", False)
        except (OperationFailure, ConnectionFailure):
            # The transactions spec says to ignore abortTransaction errors.
            pass
        finally:
            self._transaction.state = _TxnState.ABORTED
874842
def start_payment(reservation_key)
      path = "reservation/#{reservation_key}/payment"
      result = call(path, http_method: :post)
      if result.code.to_i == 200
        return true
      else
        raise ShakeTheCounterError.new "Payment failed"
      end
    end
528602
def get_payment_method(self, payment_method_id, **params):
        """"""
        response = self._get('v2', 'payment-methods', payment_method_id, params=params)
        return self._make_api_object(response, PaymentMethod)