예제 #1
0
        public static PtsV2PaymentsRefundPost201Response Run()
        {
            ProcessPayment.CaptureTrueForProcessPayment = true;
            var processPaymentId = ProcessPayment.Run().Id;

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation("test_refund_payment");
            var amountDetailsObj    = new Ptsv2paymentsidcapturesOrderInformationAmountDetails("10", "USD");
            var orderInformationObj = new Ptsv2paymentsidrefundsOrderInformation(amountDetailsObj);
            var requestBody         = new RefundPaymentRequest(clientReferenceInformationObj, null, null, orderInformationObj);

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new RefundApi(clientConfig);

                var result = apiInstance.RefundPayment(requestBody, processPaymentId);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
예제 #2
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);
            }
        }
        public static PtsV2PaymentsRefundPost201Response Run()
        {
            var capturePaymentId = CapturePayment.Run().Id;

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation("test_refund_capture");

            var amountDetailsObj = new Ptsv2paymentsidcapturesOrderInformationAmountDetails("102.21", "USD");

            var billToObj = new Ptsv2paymentsidcapturesOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Doe",
                Address1           = "1 Market St",
                PostalCode         = "94105",
                Locality           = "San Francisco",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };
            var orderInformationObj = new Ptsv2paymentsidrefundsOrderInformation(amountDetailsObj, billToObj);

            var bankAccountObj = new Ptsv2paymentsPaymentInformationBankAccount
            {
                Number      = "4100",
                Type        = "C",
                CheckNumber = "123456"
            };

            var bankObj = new Ptsv2paymentsPaymentInformationBank
            {
                Account = bankAccountObj
            };

            bankObj.RoutingNumber = "071923284";

            var paymentInformationObj = new Ptsv2paymentsidrefundsPaymentInformation();

            paymentInformationObj.Bank = bankObj;

            var requestBody = new RefundCaptureRequest(clientReferenceInformationObj, null, paymentInformationObj, orderInformationObj);

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new RefundApi(clientConfig);

                var result = apiInstance.RefundCapture(requestBody, capturePaymentId);

                Console.WriteLine(result.Id);

                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
        public static PtsV2PaymentsRefundPost201Response Run()
        {
            var id = ElectronicCheckDebits.Run().Id;

            string clientReferenceInformationCode = "TC50171_3";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            Ptsv2paymentsidrefundsProcessingInformation processingInformation = new Ptsv2paymentsidrefundsProcessingInformation(
                );

            string paymentInformationPaymentTypeName = "CHECK";
            Ptsv2paymentsPaymentInformationPaymentType paymentInformationPaymentType = new Ptsv2paymentsPaymentInformationPaymentType(
                Name: paymentInformationPaymentTypeName
                );

            Ptsv2paymentsidrefundsPaymentInformation paymentInformation = new Ptsv2paymentsidrefundsPaymentInformation(
                PaymentType: paymentInformationPaymentType
                );

            string orderInformationAmountDetailsTotalAmount = "100";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsidcapturesOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsidcapturesOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsidrefundsOrderInformation orderInformation = new Ptsv2paymentsidrefundsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            var requestObj = new RefundPaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                PaymentInformation: paymentInformation,
                OrderInformation: orderInformation
                );

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);

                var apiInstance = new RefundApi(clientConfig);
                PtsV2PaymentsRefundPost201Response result = apiInstance.RefundPayment(requestObj, id);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        public static PtsV2PaymentsRefundPost201Response Run()
        {
            SimpleAuthorizationInternet.CaptureTrueForProcessPayment = true;
            var id = SimpleAuthorizationInternet.Run().Id;

            string clientReferenceInformationCode = "TC50171_3";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string orderInformationAmountDetailsTotalAmount = "10";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsidcapturesOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsidcapturesOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsidrefundsOrderInformation orderInformation = new Ptsv2paymentsidrefundsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            var requestObj = new RefundPaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                OrderInformation: orderInformation
                );

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);

                var apiInstance = new RefundApi(clientConfig);
                PtsV2PaymentsRefundPost201Response result = apiInstance.RefundPayment(requestObj, id);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
예제 #6
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType   = "GET",
                RequestTarget = "/pts/v2/refunds/5335504389516958903526"
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new RefundApi(configurationSwagger);
                var result = apiInstance.GetRefund("5335504389516958903526");
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
예제 #7
0
        public static void Run()
        {
            var capturePaymentId = CapturePayment.Run().Id;

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation("test_refund_capture");
            var amountDetailsObj    = new Ptsv2paymentsidcapturesOrderInformationAmountDetails("102.21", "USD");
            var orderInformationObj = new Ptsv2paymentsidrefundsOrderInformation(amountDetailsObj);
            var requestBody         = new RefundCaptureRequest(clientReferenceInformationObj, null, null, orderInformationObj);

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new RefundApi(clientConfig);

                var result = apiInstance.RefundCapture(requestBody, capturePaymentId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
 public void Init()
 {
     instance = new RefundApi();
 }
예제 #9
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);
            }
        }
예제 #10
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);
            }
        }