Skip to content

reject_agreement_payment_request async

reject_agreement_payment_request(
    payment_request_id: PaymentRequestId,
    agreement_id: AgreementId,
    *,
    config_overrides: Optional[AsyncMarketplaceAgreementClientConfig] = None,
    rejection_reason: Optional[PaymentRequestRejectionReason] = None,
) -> RejectAgreementPaymentRequestOutput

Allows buyers (acceptors) to reject a payment request that is in PENDING_APPROVAL status. Once rejected, the payment request transitions to REJECTED status and cannot be accepted. Buyers can optionally provide a reason for the rejection.

Only payment requests in PENDING_APPROVAL status can be rejected. 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 reject.

  • agreement_id (AgreementId) –

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

  • rejection_reason (Optional[PaymentRequestRejectionReason], default: None ) –

    An optional reason for rejecting the payment request (1-250 characters). This message is visible to the seller.

Raises:

Source code in docs_src/capo_marketplace_agreement/_services/async_marketplace_agreement.py
async def reject_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[AsyncMarketplaceAgreementClientConfig] = None,
    rejection_reason: Optional[
        "capo_marketplace_agreement.types.payment_request_rejection_reason.PaymentRequestRejectionReason"
    ] = None,
) -> "capo_marketplace_agreement.types.reject_agreement_payment_request_output.RejectAgreementPaymentRequestOutput":
    """<p>Allows buyers (acceptors) to reject a payment request that is in <code>PENDING_APPROVAL</code> status. Once rejected, the payment request transitions to <code>REJECTED</code> status and cannot be accepted. Buyers can optionally provide a reason for the rejection.</p> <note> <p>Only payment requests in <code>PENDING_APPROVAL</code> status can be rejected. 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 reject.</p>
        agreement_id: <p>The unique identifier of the agreement associated with the payment request.</p>
        rejection_reason: <p>An optional reason for rejecting the payment request (1-250 characters). This message is visible to the seller.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_marketplace_agreement.types.reject_agreement_payment_request_input.RejectAgreementPaymentRequestInput]",
    ) -> AsyncOperationResponse[
        "capo_marketplace_agreement.types.reject_agreement_payment_request_output.RejectAgreementPaymentRequestOutput"
    ]:
        import capo_marketplace_agreement._operations.awsmp_commerce_service_v20200301.reject_agreement_payment_request

        (
            output,
            http_response,
        ) = await capo_marketplace_agreement._operations.awsmp_commerce_service_v20200301.reject_agreement_payment_request.async_reject_agreement_payment_request(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

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

        return capo_marketplace_agreement.types.reject_agreement_payment_request_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "RejectAgreementPaymentRequest", redact_output=_redact_output
        ),
    )
    input_: capo_marketplace_agreement.types.reject_agreement_payment_request_input.RejectAgreementPaymentRequestInput = {
        "payment_request_id": payment_request_id,
        "agreement_id": agreement_id,
    }
    if rejection_reason is not None:
        input_["rejection_reason"] = rejection_reason

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output