public async Task <Shipment> CreateAsync(int saleId, ShipmentRequest request, CancellationToken cancellationToken)
        {
            var createShipmentLink = await _linkFactory.CreateLinkAsync($"sales/{saleId}/shipments").ConfigureAwait(_halClient);

            var shipment = await _halClient.PutAsync <Shipment>(createShipmentLink, null, request, cancellationToken)
                           .ConfigureAwait(_halClient);

            // Work-around an issue in the API where the first request's shipment
            // isn't populated with links and embedded addresses
            return(await _halClient.PutAsync <Shipment>(createShipmentLink, null, request, cancellationToken)
                   .ConfigureAwait(_halClient));
        }
Exemple #2
0
 private Task <PaymentMethod> PutPaymentMethodAsync(
     int paymentMethodId,
     NewPaymentMethod paymentMethod,
     Func <PaymentMethod, Link> getLinkFunc)
 {
     return(GetPaymentMethodAndFollowLinkAsync(
                paymentMethodId,
                getLinkFunc,
                putLink => _halClient.PutAsync <PaymentMethod>(putLink, paymentMethod)));
 }
Exemple #3
0
        public async Task <ListingConstraints> GetConstraintsForEventAsync(NewRequestedEvent @event, ListingConstraintsRequest request)
        {
            var constraintsLink = await _linkFactory.CreateLinkAsync($"listingconstraints").ConfigureAwait(_halClient);

            return(await _halClient.PutAsync <ListingConstraints>(constraintsLink, @event, request).ConfigureAwait(_halClient));
        }