public async Task <Guid> CreateCaptureAsync(CreateCaptureRequest request)
        {
            if (!await _context.Robots.AnyAsync(x => x.Id == request.RobotId))
            {
                throw new Exception($"Robot {request.RobotId} not exists.");
            }

            var capture = new Capture(request.RobotId);

            await _context.Captures.AddAsync(capture);

            await _context.SaveChangesAsync();

            var createBlobResponse = await _blobService.CreateBlobAsync(new CreateBlobRequest()
            {
                Extension  = request.Extension,
                Base64File = request.Base64File
            });

            capture.Path   = createBlobResponse.Path;
            capture.BlobId = createBlobResponse.BlobId;

            await _context.SaveChangesAsync();

            return(capture.Id);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 场内抓拍上报接口
        /// </summary>
        /// <param name="req"><see cref="CreateCaptureRequest"/></param>
        /// <returns><see cref="CreateCaptureResponse"/></returns>
        public CreateCaptureResponse CreateCaptureSync(CreateCaptureRequest req)
        {
            JsonResponseModel <CreateCaptureResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "CreateCapture");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <CreateCaptureResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
        public void OrderCapturePayment()
        {
            // TODO uncomment below to test the method and replace null with proper value
            string id = null;

            var authorization       = authorizationApi.AuthorizationCreateToken("https://auth-dev.partpay.co.nz");
            var createOrderRequest  = CreateRequest(CreateOrderRequest.PaymentFlowEnum.Authorization);
            var createOrderResponse = instance.OrderCreate(authorization, "IK004", createOrderRequest);

            id = createOrderResponse.OrderId;

            System.Threading.Thread.Sleep(2000); // Give the system time to complete the creation of the order

            var order = instance.OrderGet(authorization, id);

            var capture = new CreateCaptureRequest(id, 50);

            var response = instance.OrderCapture(authorization, id, "IK005", capture);

            Assert.IsInstanceOf <CaptureOrder>(response, "response is Refund");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Create a Order Creates a zipMoney Order.  During the Order process a customer can apply for credit decisioning in real-time. This means the Order needs to represent a good picture of known customer details along with order information and the Order entity represents this as a resource.  For more information on how to Order with zipMoney see the #model:Z2QcrzRGHACY8wM6G guide.
        /// </summary>
        /// <exception cref="MerchantApi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"> (optional)</param>
        /// <returns>ApiResponse of Order</returns>
        public ApiResponse <CaptureOrder> OrderCaptureWithHttpInfo(string id, CreateCaptureRequest body = null)
        {
            var    localVarPath         = GetBasePath() + "/Order/" + id + "/capture";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (body != null && body.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
            }
            else
            {
                localVarPostBody = body; // byte array
            }

            // authentication (Authorization) required
            if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarHeaderParams["Authorization"] = Configuration.GetApiKeyWithPrefix("Authorization");
            }

            // authentication (Idempotency-Key) required
            if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("Idempotency-Key")))
            {
                localVarHeaderParams["Idempotency-Key"] = Configuration.GetApiKeyWithPrefix("Idempotency-Key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath,
                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("OrderCapture", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <CaptureOrder>(localVarStatusCode,
                                                  localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                  (CaptureOrder)Configuration.ApiClient.Deserialize(localVarResponse, typeof(CaptureOrder))));
        }
Exemplo n.º 5
0
        public CaptureOrder OrderCapture(AccessToken accessToken, string id, string idempotencyKey = null, CreateCaptureRequest body = null)
        {
            Configuration.AddApiKey("Authorization", accessToken.Token);
            Configuration.AddApiKeyPrefix("Authorization", "Bearer");

            Configuration.AddApiKey("Idempotency-Key", idempotencyKey);
            Configuration.AddApiKeyPrefix("Idempotency-Key", "Idempotency-Key");

            ApiResponse <CaptureOrder> localVarResponse = OrderCaptureWithHttpInfo(id, body);

            return(localVarResponse.Data);
        }