createProcurementPortalPreference method

Future<CreateProcurementPortalPreferenceResponse> createProcurementPortalPreference({
  1. required BuyerDomain buyerDomain,
  2. required String buyerIdentifier,
  3. required List<Contact> contacts,
  4. required bool einvoiceDeliveryEnabled,
  5. required ProcurementPortalName procurementPortalName,
  6. required bool purchaseOrderRetrievalEnabled,
  7. required SupplierDomain supplierDomain,
  8. required String supplierIdentifier,
  9. String? clientToken,
  10. EinvoiceDeliveryPreference? einvoiceDeliveryPreference,
  11. String? procurementPortalInstanceEndpoint,
  12. String? procurementPortalSharedSecret,
  13. List<ResourceTag>? resourceTags,
  14. ProcurementPortalPreferenceSelector? selector,
  15. TestEnvPreferenceInput? testEnvPreference,
})

This feature API is subject to changing at any time. For more information, see the Amazon Web Services Service Terms (Betas and Previews).

Creates a procurement portal preference configuration for e-invoice delivery and purchase order retrieval. This preference defines how invoices are delivered to a procurement portal and how purchase orders are retrieved.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter buyerDomain : The domain identifier for the buyer in the procurement portal.

Parameter buyerIdentifier : The unique identifier for the buyer in the procurement portal.

Parameter contacts : List of contact information for portal administrators and technical contacts responsible for the e-invoice integration.

Parameter einvoiceDeliveryEnabled : Indicates whether e-invoice delivery is enabled for this procurement portal preference. Set to true to enable e-invoice delivery, false to disable.

Parameter procurementPortalName : The name of the procurement portal.

Parameter purchaseOrderRetrievalEnabled : Indicates whether purchase order retrieval is enabled for this procurement portal preference. Set to true to enable PO retrieval, false to disable.

Parameter supplierDomain : The domain identifier for the supplier in the procurement portal.

Parameter supplierIdentifier : The unique identifier for the supplier in the procurement portal.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure idempotency of the request.

Parameter einvoiceDeliveryPreference : Specifies the e-invoice delivery configuration including document types, attachment types, and customization settings for the portal.

Parameter procurementPortalInstanceEndpoint : The endpoint URL where e-invoices will be delivered to the procurement portal. Must be a valid HTTPS URL.

Parameter procurementPortalSharedSecret : The shared secret or authentication credential used to establish secure communication with the procurement portal. This value must be encrypted at rest.

Parameter resourceTags : The tags to apply to this procurement portal preference resource. Each tag consists of a key and an optional value.

Parameter testEnvPreference : Configuration settings for the test environment of the procurement portal. Includes test credentials and endpoints that are used for validation before production deployment.

Implementation

Future<CreateProcurementPortalPreferenceResponse>
    createProcurementPortalPreference({
  required BuyerDomain buyerDomain,
  required String buyerIdentifier,
  required List<Contact> contacts,
  required bool einvoiceDeliveryEnabled,
  required ProcurementPortalName procurementPortalName,
  required bool purchaseOrderRetrievalEnabled,
  required SupplierDomain supplierDomain,
  required String supplierIdentifier,
  String? clientToken,
  EinvoiceDeliveryPreference? einvoiceDeliveryPreference,
  String? procurementPortalInstanceEndpoint,
  String? procurementPortalSharedSecret,
  List<ResourceTag>? resourceTags,
  ProcurementPortalPreferenceSelector? selector,
  TestEnvPreferenceInput? testEnvPreference,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'Invoicing.CreateProcurementPortalPreference'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'BuyerDomain': buyerDomain.value,
      'BuyerIdentifier': buyerIdentifier,
      'Contacts': contacts,
      'EinvoiceDeliveryEnabled': einvoiceDeliveryEnabled,
      'ProcurementPortalName': procurementPortalName.value,
      'PurchaseOrderRetrievalEnabled': purchaseOrderRetrievalEnabled,
      'SupplierDomain': supplierDomain.value,
      'SupplierIdentifier': supplierIdentifier,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (einvoiceDeliveryPreference != null)
        'EinvoiceDeliveryPreference': einvoiceDeliveryPreference,
      if (procurementPortalInstanceEndpoint != null)
        'ProcurementPortalInstanceEndpoint':
            procurementPortalInstanceEndpoint,
      if (procurementPortalSharedSecret != null)
        'ProcurementPortalSharedSecret': procurementPortalSharedSecret,
      if (resourceTags != null) 'ResourceTags': resourceTags,
      if (selector != null) 'Selector': selector,
      if (testEnvPreference != null) 'TestEnvPreference': testEnvPreference,
    },
  );

  return CreateProcurementPortalPreferenceResponse.fromJson(
      jsonResponse.body);
}