コード例 #1
0
        public void GPConnectorTestEETPaymentRefund()
        {
            var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID_EET, TestUtils.CLIENT_SECRET_EET);

            var refundedItems = new List <OrderItem>();

            refundedItems.Add(new OrderItem
            {
                Name       = "Pocitac Item1",
                Amount     = 119990,
                Count      = 1,
                VatRate    = VatRate.RATE_4,
                ItemType   = ItemType.ITEM,
                Ean        = "1234567890123",
                ProductURL = @"https://www.eshop123.cz/pocitac"
            });
            refundedItems.Add(new OrderItem
            {
                Name       = "Oprava Item2",
                Amount     = 19960,
                Count      = 1,
                VatRate    = VatRate.RATE_3,
                ItemType   = ItemType.ITEM,
                Ean        = "1234567890189",
                ProductURL = @"https://www.eshop123.cz/pocitac/oprava"
            });

            var eet = new EET
            {
                CelkTrzba = 139950,
                ZaklDan1  = 99165,
                Dan1      = 20825,
                ZaklDan2  = 17357,
                Dan2      = 2603,
                Mena      = Currency.CZK
            };

            var refundObject = new RefundPayment
            {
                Amount = 139950,
                Items  = refundedItems,
                Eet    = eet
            };

            try
            {
                var refundEETPayment = connector.GetAppToken().RefundPayment(3049250113, refundObject);
                Console.WriteLine("EET refund result: {0}", refundEETPayment);
            }
            catch (GPClientException ex)
            {
                Console.WriteLine("EET Payment refund ERROR");
                var err  = ex.Error;
                var date = err.DateIssued;
                foreach (var element in err.ErrorMessages)
                {
                    //
                }
            }
        }
コード例 #2
0
        public void GPConnectorTestNextOnDemandEET()
        {
            var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID_EET, TestUtils.CLIENT_SECRET_EET);

            try
            {
                var nextPayment = new NextPayment
                {
                    OrderNumber      = "EETOnDemand4321",
                    Amount           = 2000,
                    Currency         = Currency.CZK,
                    OrderDescription = "EETOnDemand4321Description"
                };
                nextPayment.Items.Add(new OrderItem
                {
                    Name       = "OnDemand Prodlouzena zaruka",
                    Amount     = 2000,
                    Count      = 1,
                    VatRate    = VatRate.RATE_4,
                    ItemType   = ItemType.ITEM,
                    Ean        = "12345678901234",
                    ProductURL = @"https://www.eshop123.cz/pocitac/prodlouzena_zaruka"
                });

                var eet = new EET
                {
                    CelkTrzba = 2000,
                    ZaklDan1  = 1580,
                    Dan1      = 420,
                    Mena      = Currency.CZK
                };
                nextPayment.Eet = eet;

                var onDemandEETPayment = connector.GetAppToken().CreateRecurrentPayment(3049250282, nextPayment);

                Console.WriteLine("OnDemand payment id: {0}", onDemandEETPayment.Id);
                Console.WriteLine("OnDemand payment gw_url: {0}", onDemandEETPayment.GwUrl);
                Console.WriteLine("OnDemand EET Payment instrument: {0}", onDemandEETPayment.PaymentInstrument);
                Console.WriteLine("OnDemand recurrence: {0}", onDemandEETPayment.Recurrence);
                Console.WriteLine("OnDemand amount: {0}", onDemandEETPayment.Amount);
                Console.Write(onDemandEETPayment.EetCode);
                Console.WriteLine(nextPayment.Eet);
            }
            catch (GPClientException exception)
            {
                Console.WriteLine("Creating next on demand EET payment ERROR");
                var err  = exception.Error;
                var date = err.DateIssued;
                foreach (var element in err.ErrorMessages)
                {
                    //
                }
            }
        }
コード例 #3
0
        public void GPConnectorTestCreateRecurrentEETPayment()
        {
            var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID_EET, TestUtils.CLIENT_SECRET_EET);

            var baseEETPayment = createEETBasePayment();

            /*
             * Recurrence recurrence = new Recurrence()
             * {
             *  Cycle = RecurrenceCycle.WEEK,
             *  Period = 1,
             *  DateTo = new DateTime(2018, 4, 1)
             * };
             * baseEETPayment.Recurrence = recurrence;
             */


            var onDemandRecurrence = new Recurrence
            {
                Cycle  = RecurrenceCycle.ON_DEMAND,
                DateTo = DateTime.Today.AddDays(1)
            };

            baseEETPayment.Recurrence = onDemandRecurrence;


            var eet = new EET
            {
                CelkTrzba = 139950,
                ZaklDan1  = 99165,
                Dan1      = 20825,
                ZaklDan2  = 17357,
                Dan2      = 2603,
                Mena      = Currency.CZK
            };

            baseEETPayment.Eet = eet;

            var result = createEETPaymentObject(connector, baseEETPayment);

            Console.WriteLine(result.Recurrence);
        }
コード例 #4
0
        public void GPConnectorTestCreateEETPayment()
        {
            var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID_EET, TestUtils.CLIENT_SECRET_EET);

            var baseEETPayment = createEETBasePayment();

            var eet = new EET
            {
                CelkTrzba = 139950,
                ZaklDan1  = 99165,
                Dan1      = 20825,
                ZaklDan2  = 17357,
                Dan2      = 2603,
                Mena      = Currency.CZK
            };

            baseEETPayment.Eet = eet;

            var result = createEETPaymentObject(connector, baseEETPayment);
        }