コード例 #1
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var clientReferenceInformationObj = new V2paymentsClientReferenceInformation("Testing");
            var amountDetailsObj    = new V2paymentsidcapturesOrderInformationAmountDetails("102.21", "USD");
            var orderInformationObj = new V2paymentsidrefundsOrderInformation(amountDetailsObj);
            var requestBody         = new RefundCaptureRequest(clientReferenceInformationObj, null, null, orderInformationObj);

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/captures/5336232827876732903529/refunds",
                RequestJsonData = JsonConvert.SerializeObject(requestBody)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new RefundApi(configurationSwagger);
                var result = apiInstance.RefundCapture(requestBody, "5336232827876732903529");
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
コード例 #2
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CapturePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "1234567890"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            /*
             * var v2paymentsPointOfSaleInformationObj = new V2paymentsidcapturesPointOfSaleInformation();
             * {
             *  CardPresent = "false",
             *  CatLevel = "6",
             *  TerminalCapability = "4"
             * };
             *
             * requestObj.PointOfSaleInformation = v2paymentsPointOfSaleInformationObj;
             */
            var v2PaymentsOrderInformationObj = new V2paymentsidcapturesOrderInformation();

            var v2PaymentsOrderInformationBillToObj = new V2paymentsidcapturesOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Deo",
                Address1           = "901 Metro Center Blvd",
                PostalCode         = "40500",
                Locality           = "Foster City",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var v2PaymentsOrderInformationAmountDetailsObj = new V2paymentsidcapturesOrderInformationAmountDetails
            {
                TotalAmount = "10",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments/5344021876376240704005/captures",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new CaptureApi(configurationSwagger);
                var result = apiInstance.CapturePayment(requestObj, "5344021876376240704005");
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
コード例 #3
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new RefundCaptureRequest();

            var clientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "TC12345"
            };

            requestObj.ClientReferenceInformation = clientReferenceInformationObj;

            var buyerInformationObj = new V2paymentsidcapturesBuyerInformation
            {
                MerchantCustomerId = "123456abcd"
            };

            requestObj.BuyerInformation = buyerInformationObj;

            var subMerchantObj = new V2paymentsidcapturesAggregatorInformationSubMerchant
            {
                Country            = "US",
                PhoneNumber        = "650-432-0000",
                Address1           = "900 Metro Center",
                PostalCode         = "94404-2775",
                Locality           = "Foster City",
                Name               = "Visa Inc",
                AdministrativeArea = "CA",
                Email              = "*****@*****.**"

                                     // subMerchantObj.CardAcceptorID = "1234567890";
                                     // subMerchantObj.Region = "PEN";
            };

            var aggregatorInformationObj = new V2paymentsidcapturesAggregatorInformation
            {
                SubMerchant  = subMerchantObj,
                Name         = "V-Internatio",
                AggregatorId = "123456789"
            };

            requestObj.AggregatorInformation = aggregatorInformationObj;

            var orderInformationObj = new V2paymentsidrefundsOrderInformation();

            var shippingDetailsObj = new V2paymentsidcapturesOrderInformationShippingDetails
            {
                ShipFromPostalCode = "47404"
            };

            orderInformationObj.ShippingDetails = shippingDetailsObj;

            var billToObj = new V2paymentsidcapturesOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Test",
                PhoneNumber        = "9999999",
                Address2           = "test2credit",
                Address1           = "testcredit",
                PostalCode         = "48104-2201",
                Locality           = "Ann Arbor",
                Company            = "Visa",
                AdministrativeArea = "MI",
                Email = "*****@*****.**"
            };

            orderInformationObj.BillTo = billToObj;

            var invoiceDetailsObj = new V2paymentsidcapturesOrderInformationInvoiceDetails
            {
                PurchaseOrderDate   = "20111231",
                PurchaseOrderNumber = "CREDIT US"
            };

            orderInformationObj.InvoiceDetails = invoiceDetailsObj;

            var amountDetailsObj = new V2paymentsidcapturesOrderInformationAmountDetails
            {
                TotalAmount           = "100",
                ExchangeRate          = "0.5",
                ExchangeRateTimeStamp = "2.01304E+13",
                Currency = "usd"
            };

            orderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = orderInformationObj;

            var merchantInformationObj = new V2paymentsidrefundsMerchantInformation
            {
                CategoryCode = 1234
            };

            requestObj.MerchantInformation = merchantInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/captures/5336232827876732903529/refunds",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new RefundApi(configurationSwagger);
                var result = apiInstance.RefundCapture(requestObj, "5336232827876732903529");
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
コード例 #4
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new RefundPaymentRequest();

            var v2PaymentsOrderInformationObj = new V2paymentsidrefundsOrderInformation();

            var shippingDetailsObj = new V2paymentsidcapturesOrderInformationShippingDetails
            {
                ShipFromPostalCode = "47404"
            };

            v2PaymentsOrderInformationObj.ShippingDetails = shippingDetailsObj;

            var v2PaymentsOrderInformationBillToObj = new V2paymentsidcapturesOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Test",
                PhoneNumber        = "9999999",
                Address2           = "test2",
                Address1           = "test",
                PostalCode         = "48104-2201",
                Locality           = "Ann Arbor",
                Company            = "Visa",
                AdministrativeArea = "MI",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var v2PaymentsOrderInformationAmountDetailsObj = new V2paymentsidcapturesOrderInformationAmountDetails
            {
                TotalAmount           = "100",
                ExchangeRate          = "0.5",
                ExchangeRateTimeStamp = "2.01304E+13",
                Currency = "usd"
            };

            v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;

            var shipToObj = new V2paymentsidcapturesOrderInformationShipTo
            {
                Country            = "US",
                PostalCode         = "48104-2202",
                AdministrativeArea = "MI"
            };

            // shipToObj.Address2 = "test2";
            // shipToObj.Address1 = "test";
            v2PaymentsOrderInformationObj.ShipTo = shipToObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsidrefundsPaymentInformation();

            var v2PaymentsPaymentInformationCardObj = new V2paymentsidrefundsPaymentInformationCard
            {
                ExpirationYear  = "2031",
                Number          = "5555555555554444",
                ExpirationMonth = "12",
                Type            = "002"
            };

            // v2paymentsPaymentInformationCardObj.SecurityCode = "123";
            v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            // var processingInformationObj = new V2paymentsidrefundsProcessingInformation()
            // {
            //     capture = true
            // };
            var lineItemsObj = new V2paymentsidrefundsOrderInformationLineItems()
            {
                UnitPrice               = "100.00",
                DiscountRate            = "0.013",
                Quantity                = 2,
                UnitOfMeasure           = "inch",
                DiscountAmount          = "10",
                TaxAppliedAfterDiscount = "8",
                AmountIncludesTax       = true,
                DiscountApplied         = true,
                ProductName             = "PName0",
                TaxRate       = "0.082",
                TotalAmount   = "1100",
                ProductSku    = "testdl",
                ProductCode   = "clothing",
                CommodityCode = "987654321012",
                TaxAmount     = "20.00"
            };

            var lineItemsList = new List <V2paymentsidrefundsOrderInformationLineItems>
            {
                lineItemsObj
            };

            var v2PaymentsidrefundsOrderInformationObj = new V2paymentsidrefundsOrderInformation()
            {
                LineItems = lineItemsList
            };

            requestObj.OrderInformation = v2PaymentsidrefundsOrderInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments/5337974231586422201013/refunds",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new RefundApi(configurationSwagger);
                var result = apiInstance.RefundPayment(requestObj, "5337974231586422201013");
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }