コード例 #1
0
        public virtual async Task <PaymentRequestData> UpdatePaymentRequest(string storeId, string paymentRequestId,
                                                                            UpdatePaymentRequestRequest request, CancellationToken token = default)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }
            var response = await _httpClient.SendAsync(
                CreateHttpRequest($"api/v1/stores/{storeId}/payment-requests/{paymentRequestId}", bodyPayload : request,
                                  method : HttpMethod.Put), token);

            return(await HandleResponse <PaymentRequestData>(response));
        }
コード例 #2
0
        public async Task <IActionResult> UpdatePaymentRequest(string storeId,
                                                               string paymentRequestId, [FromBody] UpdatePaymentRequestRequest request)
        {
            var validationResult = Validate(request);

            if (validationResult != null)
            {
                return(validationResult);
            }

            var pr = await _paymentRequestRepository.FindPaymentRequests(
                new PaymentRequestQuery()
            {
                StoreId = storeId, Ids = new[] { paymentRequestId }
            });

            if (pr.Total == 0)
            {
                return(NotFound());
            }

            var updatedPr = pr.Items.First();

            updatedPr.SetBlob(request);

            return(Ok(FromModel(await _paymentRequestRepository.CreateOrUpdatePaymentRequest(updatedPr))));
        }
コード例 #3
0
        public async Task <IActionResult> UpdatePaymentRequest(string storeId,
                                                               string paymentRequestId, [FromBody] UpdatePaymentRequestRequest request)
        {
            var validationResult = Validate(request);

            if (validationResult != null)
            {
                return(validationResult);
            }
            request.Currency ??= StoreData.GetStoreBlob().DefaultCurrency;
            var pr = await _paymentRequestRepository.FindPaymentRequests(
                new PaymentRequestQuery()
            {
                StoreId = storeId, Ids = new[] { paymentRequestId }
            });

            if (pr.Length == 0)
            {
                return(PaymentRequestNotFound());
            }

            var updatedPr = pr.First();

            updatedPr.SetBlob(request);

            return(Ok(FromModel(await _paymentRequestRepository.CreateOrUpdatePaymentRequest(updatedPr))));
        }