Esempio n. 1
0
        /// <summary>
        /// Method creates DE Direct Debit Transaction Order Request
        /// </summary>
        /// <returns></returns>
        private static String doDEDirectDebitTransactionOrderRequest()
        {
            //DEDirectDebitTransaction
            DEDirectDebitTransactionRequest oDEDirectDebitTransactionRequest = new DEDirectDebitTransactionRequest();
            IPGApiOrderRequest oIPGApiOrderRequest = oDEDirectDebitTransactionRequest.DEDirectDebitTransactionOrderRequest;

            return(SendOrderRequest(oIPGApiOrderRequest));
        }
Esempio n. 2
0
        /// <summary>
        /// Method creates Credit Card Transaction Order Request
        /// </summary>
        /// <returns></returns>
        private static String doCreditCardTransactionOrderRequest()
        {
            //CreditCardTransaction
            CreditCardTransactionRequest oCreditCardTransactionOrderRequest = new CreditCardTransactionRequest();
            IPGApiOrderRequest           oIPGApiOrderRequest = oCreditCardTransactionOrderRequest.CreditCardTransactionOrderRequest;

            return(SendOrderRequest(oIPGApiOrderRequest));
        }
Esempio n. 3
0
        /// <summary>
        /// Method returns string value of IPGApiOrderRequest object
        /// </summary>
        /// <param name="oIPGApiOrderRequest">IPGApiOrderRequest object to create string from</param>
        /// <returns>string value containing all IPGApiOrderRequest values</returns>
        public static string IPGApiOrderRequestToString(this IPGApiOrderRequest oIPGApiOrderRequest)
        {
            if (oIPGApiOrderRequest.Item == null)
            {
                return("");
            }

            return(TransactionToString(oIPGApiOrderRequest.Item));
        }
Esempio n. 4
0
        public DEDirectDebitTransactionRequest()
        {
            Transaction oTransaction = new Transaction();

            DE_DirectDebitTxType oDE_DirectDebitTxType = new DE_DirectDebitTxType();

            oDE_DirectDebitTxType.StoreId = "120995000";
            oDE_DirectDebitTxType.Type    = DE_DirectDebitTxTypeType.sale;

            DE_DirectDebitData oDE_DirectDebitData = new DE_DirectDebitData();

            oDE_DirectDebitData.ItemsElementName     = new ItemsChoiceType2[] { ItemsChoiceType2.BIC, ItemsChoiceType2.IBAN };
            oDE_DirectDebitData.Items                = new String[] { "PBNKDEFFXXX", "DE34500100600032121604" };
            oDE_DirectDebitData.MandateType          = MandateType.SINGLE;
            oDE_DirectDebitData.MandateTypeSpecified = true;
            oDE_DirectDebitData.DateOfMandate        = DateTime.Now.ToString("yyyyMMdd");

            oTransaction.Items = new Object[] { oDE_DirectDebitTxType, oDE_DirectDebitData };

            Payment oPayment = new Payment();

            oPayment.SubTotal                = 10;
            oPayment.ValueAddedTax           = 2;
            oPayment.ValueAddedTaxSpecified  = true;
            oPayment.DeliveryAmount          = 1;
            oPayment.DeliveryAmountSpecified = true;
            oPayment.ChargeTotal             = 13;
            oPayment.Currency                = "978";

            oTransaction.Payment = oPayment;

            Billing oBilling = new Billing();

            oBilling.Name     = "Name";
            oBilling.Address1 = "Address";
            oBilling.City     = "City";
            oBilling.State    = "State";
            oBilling.Zip      = "Zip";
            oBilling.Country  = "Country";

            oTransaction.Billing = oBilling;

            ClientLocale oClientLocale = new ClientLocale();

            oClientLocale.Country  = "UK";
            oClientLocale.Language = "en";

            oTransaction.ClientLocale = oClientLocale;

            DEDirectDebitTransactionOrderRequest      = new IPGApiOrderRequest();
            DEDirectDebitTransactionOrderRequest.Item = oTransaction;
        }
Esempio n. 5
0
        public CreditCardTransactionRequest()
        {
            Transaction oTransaction = new Transaction();

            CreditCardTxType oCreditCardTxType = new CreditCardTxType();

            oCreditCardTxType.StoreId = "120995000";
            oCreditCardTxType.Type    = CreditCardTxTypeType.preauth;

            CreditCardData oCreditCardData = new CreditCardData();

            oCreditCardData.Brand            = CreditCardDataBrand.VISA;
            oCreditCardData.BrandSpecified   = true;
            oCreditCardData.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.CardNumber, ItemsChoiceType.ExpMonth, ItemsChoiceType.ExpYear, ItemsChoiceType.CardCodeValue };
            oCreditCardData.Items            = new Object[] { "4035874000424977", "12", "18", "977" };

            oTransaction.Items = new Object[] { oCreditCardTxType, oCreditCardData };

            Payment oPayment = new Payment();

            oPayment.SubTotal                = 10;
            oPayment.ValueAddedTax           = 2;
            oPayment.ValueAddedTaxSpecified  = true;
            oPayment.DeliveryAmount          = 1;
            oPayment.DeliveryAmountSpecified = true;
            oPayment.ChargeTotal             = 13;
            oPayment.Currency                = "978";

            oTransaction.Payment = oPayment;

            Billing oBilling = new Billing();

            oBilling.Address1 = "Address";
            oBilling.City     = "City";
            oBilling.State    = "State";
            oBilling.Zip      = "Zip";
            oBilling.Country  = "Country";

            oTransaction.Billing = oBilling;

            ClientLocale oClientLocale = new ClientLocale();

            oClientLocale.Country  = "UK";
            oClientLocale.Language = "en";

            oTransaction.ClientLocale = oClientLocale;

            CreditCardTransactionOrderRequest      = new IPGApiOrderRequest();
            CreditCardTransactionOrderRequest.Item = oTransaction;
        }
Esempio n. 6
0
        /// <summary>
        /// Method creates IPGAPI Order request, sends it and recieves IPG API Order Response
        /// </summary>
        /// <param name="oIPGApiOrderRequest"></param>
        /// <returns>IPG API Order Response as string</returns>
        private static String SendOrderRequest(IPGApiOrderRequest oIPGApiOrderRequest)
        {
            var cert = CertificateHandler.LoadCertificate(@"c:\certificates\WS120995000._.4.p12", "tester02");

            IPGApiOrderService oIPGApiOrderService    = new IPGApiOrderService();
            String             RequestResponseMessage = "";

            if (cert != null)
            {
                oIPGApiOrderService.ClientCertificates.Add(cert);
                oIPGApiOrderService.Url = @"https://test.ipg-online.com:443/ipgapi/services";

                NetworkCredential nc = new NetworkCredential("WS120995000._.4", "Tester02");
                oIPGApiOrderService.Credentials = nc;

                //set proxy host and port
                IWebProxy webProxy = new WebProxy("host", 8080);
                webProxy.Credentials      = new NetworkCredential("username", "password");
                oIPGApiOrderService.Proxy = webProxy;
                try
                {
                    //send action request and get response
                    IPGApiOrderResponse oResponse = oIPGApiOrderService.IPGApiOrder(oIPGApiOrderRequest);
                    RequestResponseMessage = oResponse.IPGApiOrderResponseToString() ?? "";
                }
                catch (SoapException se)
                {//SoapException: MerchantException or ProcessingException
                    RequestResponseMessage = se.SoapExceptionResponseToString() ?? "";
                }
                catch (Exception e)
                {
                    RequestResponseMessage  = e.Message + Environment.NewLine;
                    RequestResponseMessage += e.InnerException + Environment.NewLine;
                    RequestResponseMessage += e.StackTrace;
                }
            }
            return(RequestResponseMessage);
        }