Skip to content

accept_agreement_payment_request async

accept_agreement_payment_request(
    payment_request_id: PaymentRequestId,
    agreement_id: AgreementId,
    *,
    config_overrides: Optional[AsyncMarketplaceAgreementClientConfig] = None,
    purchase_order_reference: Optional[PurchaseOrderReference] = None,
) -> AcceptAgreementPaymentRequestOutput

Allows buyers (acceptors) to accept a payment request that is in PENDING_APPROVAL status. Once accepted, the payment request transitions to APPROVED status and the charge will be processed. Buyers can optionally provide a purchase order reference for their internal tracking.

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

  • agreement_id (AgreementId) –

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

  • purchase_order_reference (Optional[PurchaseOrderReference], default: None ) –

    An optional purchase order reference that buyers can provide to associate the payment request with their internal purchase order system.

Raises:

Source code in docs_src/capo_marketplace_agreement/_services/async_marketplace_agreement.py
async def accept_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,
    purchase_order_reference: Optional[
        "capo_marketplace_agreement.types.purchase_order_reference.PurchaseOrderReference"
    ] = None,
) -> "capo_marketplace_agreement.types.accept_agreement_payment_request_output.AcceptAgreementPaymentRequestOutput":
    """<p>Allows buyers (acceptors) to accept a payment request that is in <code>PENDING_APPROVAL</code> status. Once accepted, the payment request transitions to <code>APPROVED</code> status and the charge will be processed. Buyers can optionally provide a purchase order reference for their internal tracking.</p> <note> <p>Only payment requests in <code>PENDING_APPROVAL</code> status can be accepted. 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 accept.</p>
        agreement_id: <p>The unique identifier of the agreement associated with the payment request.</p>
        purchase_order_reference: <p>An optional purchase order reference that buyers can provide to associate the payment request with their internal purchase order system.</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.accept_agreement_payment_request_input.AcceptAgreementPaymentRequestInput]",
    ) -> AsyncOperationResponse[
        "capo_marketplace_agreement.types.accept_agreement_payment_request_output.AcceptAgreementPaymentRequestOutput"
    ]:
        import capo_marketplace_agreement._operations.awsmp_commerce_service_v20200301.accept_agreement_payment_request

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

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

        return capo_marketplace_agreement.types.accept_agreement_payment_request_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "AcceptAgreementPaymentRequest", redact_output=_redact_output
        ),
    )
    input_: capo_marketplace_agreement.types.accept_agreement_payment_request_input.AcceptAgreementPaymentRequestInput = {
        "payment_request_id": payment_request_id,
        "agreement_id": agreement_id,
    }
    if purchase_order_reference is not None:
        input_["purchase_order_reference"] = purchase_order_reference

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