public void OrderVoidPayment()
        {
            // 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, "IK008", 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 voidRequest = new CreateVoidRequest(50);

            var response = instance.OrderVoid(authorization, id, "IK009", voidRequest);

            Assert.IsInstanceOf <VoidOrder>(response, "response is VoidOrder");
        }
示例#2
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 <VoidOrder> OrderVoidWithHttpInfo(string id, CreateVoidRequest body = null)
        {
            var    localVarPath         = GetBasePath() + "/Order/" + id + "/void";
            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 <VoidOrder>(localVarStatusCode,
                                               localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                               (VoidOrder)Configuration.ApiClient.Deserialize(localVarResponse, typeof(VoidOrder))));
        }
示例#3
0
        public VoidOrder OrderVoid(AccessToken accessToken, string id, string idempotencyKey = null, CreateVoidRequest body = null)
        {
            Configuration.AddApiKey("Authorization", accessToken.Token);
            Configuration.AddApiKeyPrefix("Authorization", "Bearer");

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

            ApiResponse <VoidOrder> localVarResponse = OrderVoidWithHttpInfo(id, body);

            return(localVarResponse.Data);
        }