Skip to content

cancel_agreement_payment_request

cancel_agreement_payment_request(
    payment_request_id: PaymentRequestId,
    agreement_id: AgreementId,
    *,
    config_overrides: Optional[MarketplaceAgreementClientConfig] = None,
) -> CancelAgreementPaymentRequestOutput

Allows sellers (proposers) to cancel a payment request that is in PENDING_APPROVAL status. Once cancelled, the payment request transitions to CANCELLED status and can no longer be accepted or rejected by the buyer.

Only payment requests in PENDING_APPROVAL status can be cancelled. A ConflictException is thrown if the payment request is in any other status.

Parameters:

  • payment_request_id (PaymentRequestId) –

    The unique identifier of the payment request to cancel.

  • agreement_id (AgreementId) –

    The unique identifier of the agreement associated with the payment request.

Raises:

Source code in docs_src/capo_marketplace_agreement/_services/marketplace_agreement.py
def cancel_agreement_payment_request(
    self,
    payment_request_id: "capo_marketplace_agreement.types.payment_request_id.PaymentRequestId",
    agreement_id: "capo_marketplace_agreement.types.agreement_id.AgreementId",
    *,
    config_overrides: Optional[MarketplaceAgreementClientConfig] = None,
) -> "capo_marketplace_agreement.types.cancel_agreement_payment_request_output.CancelAgreementPaymentRequestOutput":
    """<p>Allows sellers (proposers) to cancel a payment request that is in <code>PENDING_APPROVAL</code> status. Once cancelled, the payment request transitions to <code>CANCELLED</code> status and can no longer be accepted or rejected by the buyer.</p> <note> <p>Only payment requests in <code>PENDING_APPROVAL</code> status can be cancelled. A <code>ConflictException</code> is thrown if the payment request is in any other status.</p> </note>

    Args:
        payment_request_id: <p>The unique identifier of the payment request to cancel.</p>
        agreement_id: <p>The unique identifier of the agreement associated with the payment request.</p>

    Raises:
        capo_marketplace_agreement.errors.access_denied_exception.AccessDeniedException: <p>User does not have sufficient access to perform this action.</p>
        capo_marketplace_agreement.errors.conflict_exception.ConflictException: <p>Request was denied due to a resource conflict.</p>
        capo_marketplace_agreement.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of request.</p>
        capo_marketplace_agreement.errors.resource_not_found_exception.ResourceNotFoundException: <p>Request references a resource which does not exist.</p>
        capo_marketplace_agreement.errors.throttling_exception.ThrottlingException: <p>Request was denied due to request throttling.</p>
        capo_marketplace_agreement.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_marketplace_agreement.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_marketplace_agreement.types.cancel_agreement_payment_request_input.CancelAgreementPaymentRequestInput]",
    ) -> OperationResponse[
        "capo_marketplace_agreement.types.cancel_agreement_payment_request_output.CancelAgreementPaymentRequestOutput"
    ]:
        import capo_marketplace_agreement._operations.awsmp_commerce_service_v20200301.cancel_agreement_payment_request

        output, http_response = (
            capo_marketplace_agreement._operations.awsmp_commerce_service_v20200301.cancel_agreement_payment_request.cancel_agreement_payment_request(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_marketplace_agreement.types.cancel_agreement_payment_request_output.CancelAgreementPaymentRequestOutput",
    ) -> dict[str, Any]:
        import capo_marketplace_agreement.types.cancel_agreement_payment_request_output

        return capo_marketplace_agreement.types.cancel_agreement_payment_request_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CancelAgreementPaymentRequest", redact_output=_redact_output
        ),
    )
    input_: capo_marketplace_agreement.types.cancel_agreement_payment_request_input.CancelAgreementPaymentRequestInput = {
        "payment_request_id": payment_request_id,
        "agreement_id": agreement_id,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output