Esempio n. 1
0
        /// <summary>
        /// Create a Test Checkout Request
        /// </summary>
        public OrderDetails CreateCheckoutRequest()
        {
            var phoneNumber = "0200000000";

            var amount   = new Money("37.37", "NZD");
            var consumer = new Consumer(phoneNumber, "Given Name", "Surname", "*****@*****.**");

            var billing  = new Contact("Address Name", "AddressLine1", "AddressLine2", "Area 1", "Area 2", "Region", "9999", "CC", phoneNumber);
            var shipping = new Contact("Address Name", "AddressLine1", "AddressLine2", "Area 1", "Area 2", "Region", "9999", "CC", phoneNumber);

            var courier = new ShippingCourier("2021-01-01T12:00:00", "Courier Name", "Tracking Number", ShippingCourier.PriorityEnum.Standard.ToString());

            var amount1 = new Money("17.17", "NZD");
            var amount2 = new Money("20.20", "NZD");


            string[][] categories1 = { new string[] { "Sporting Goods1", "Climbing Equipment1", "Climbing1" }, new string[] { "Sale1", "Climbing1" } };
            string[][] categories2 = { new string[] { "Sporting Goods2", "Climbing Equipment2", "Climbing2" }, new string[] { "Sale2", "Climbing2" } };

            var item1 = new Item("Item1", "SKU1", 1, "https://www.selectsystems.com.au/afterpay-payment-plugin", "https://www.selectsystems.com.au/afterpay-payment-plugin.image.jpg", amount1, categories1);
            var item2 = new Item("Item2", "SKU2", 2, "https://www.selectsystems.com.au/afterpay-payment-plugin", "https://www.selectsystems.com.au/afterpay-payment-plugin.image.jpg", amount2, categories2);

            var items = new List <Item>();

            items.Add(item1);
            items.Add(item2);

            var discountAmount1 = new Money("1.00", "NZD");
            var discountAmount2 = new Money("2.00", "NZD");

            var discount1 = new Discount("Discount1", discountAmount1);
            var discount2 = new Discount("Discount1", discountAmount1);

            var discounts = new List <Discount>();

            discounts.Add(discount1);
            discounts.Add(discount2);

            string RedirectConfirmUrl = "https://orders.yourwebsite.com/confirm";
            string RedirectCancelUrl  = "https://orders.yourwebsite.com/cancel";

            var merchant = new Merchant(RedirectConfirmUrl, RedirectCancelUrl);

            var merchantReference = "Reference1";

            var taxAmount      = new Money("5.00", "NZD");
            var shippingAmount = new Money("7.00", "NZD");

            var createCheckoutRequest = new OrderDetails(amount, consumer, billing, shipping, courier, items, discounts, merchant, merchantReference, taxAmount, shippingAmount);

            return(createCheckoutRequest);
        }
        /// <summary>
        /// Updates the Merchant Reference for a previously created payment by id.
        /// </summary>
        /// <exception cref="MerchantApi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">Id, required.</param>
        /// <param name="body">ShippingCourier Body, required.</param>
        /// <returns>IRestResponse</returns>
        public IRestResponse PaymentUpdateShippingCourier(string id, ShippingCourier body = null)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling PaymentApi->PaymentUpdateShippingCourier");
            }
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling PaymentApi->PaymentUpdateShippingCourier");
            }

            var localVarResponse = PaymentUpdateShippingCourierWithHttpInfo(id, body);

            return(localVarResponse);
        }
Esempio n. 3
0
        public void PaymentUpdateShippingCourier()
        {
            string paymentToken = null;

            var authorization = authorizationApi.AuthorizationCreateToken();

            paymentToken = "001.u0hglki77ko70iuavgnb31vo2qq4ehold53brkdngfj9l73f";

            var response = instance.PaymentGetByToken(paymentToken);

            var courier = new ShippingCourier("2021-01-16T00:00:00Z", "CourierPost", "AA999999999AA", ShippingCourier.PriorityEnum.Standard.ToString());

            instance.PaymentUpdateShippingCourier(response.Id, courier);

            response = instance.PaymentGetByToken(paymentToken);

            Assert.IsInstanceOf <Payment>(response, "response is Payment");
        }
Esempio n. 4
0
 public void OrderShippingTrackingInstanceTest()
 {
     instance = new ShippingCourier("2021-01-01T12:00:00", "Courier Name", "Tracking Number", ShippingCourier.PriorityEnum.Standard.ToString());
     Assert.IsInstanceOf <ShippingCourier> (instance, "variable 'instance' is a OrderShippingTracking");
 }
        /// <summary>
        /// Updates the Merchant Reference for a previously created payment by id.
        /// </summary>
        /// <exception cref="MerchantApi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">Id, required.</param>
        /// <param name="body">ShippingCourier Body, required.</param>
        /// <returns>IRestResponse</returns>
        public IRestResponse PaymentUpdateShippingCourierWithHttpInfo(string id, ShippingCourier body = null)
        {
            var    localVarPath         = GetBasePath() + "payments/" + id + "/courier";
            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");
            }

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

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(localVarResponse);
        }