public void GPCOnnectorTestPaymentStatis() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); var basePayment = createBasePayment(); try { var result = connector.GetAppToken().CreatePayment(basePayment); var payment = connector.GetAppToken().PaymentStatus(result.Id); Assert.NotNull(result); Assert.NotEqual(0, result.Id); Console.WriteLine("Payment id: {0}", payment.Id); Console.WriteLine("Payment state: {0}", payment.State); Console.WriteLine("Payment gw_url: {0}", payment.GwUrl); Console.WriteLine("Payment instrument: {0}", payment.PaymentInstrument); Console.WriteLine(result.Payer.Contact); } catch (GPClientException exception) { Console.WriteLine("Create payment ERROR"); var err = exception.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
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) { // } } }
public void GPConnectorTestEETPReceiptFindByPaymentId() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID_EET, TestUtils.CLIENT_SECRET_EET); try { var receipts = connector.GetAppToken().GetEETReceiptByPaymentId(3049205133); foreach (var currReceipt in receipts) { Console.WriteLine(currReceipt); } Console.WriteLine(receipts.Count); } catch (GPClientException ex) { Console.WriteLine("EET Receipt by payment ID ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
//[TestMethod()] public void GPConnectorTestCreatePreAuthorizedPayment() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); BasePayment basePayment = CreatePaymentTests.createBasePayment(); basePayment.PreAuthorization = true; try { Payment result = connector.GetAppToken().CreatePayment(basePayment); Assert.IsNotNull(result); Assert.IsNotNull(result.Id); Console.WriteLine("Payment id: {0}", result.Id); Console.WriteLine("Payment gw_url: {0}", result.GwUrl); Console.WriteLine("Payment instrument: {0}", result.PaymentInstrument); Console.WriteLine("PreAuthorization: {0}", result.PreAuthorization); } catch (GPClientException exception) { Console.WriteLine("PreAuthorized payment ERROR"); var err = exception.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
private Payment createEETPaymentObject(GPConnector connector, BasePayment baseEETPayment) { Payment result = null; try { result = connector.GetAppToken().CreatePayment(baseEETPayment); Assert.NotNull(result); Assert.NotEqual(0, result.Id); Console.WriteLine("EET Payment id: {0}", result.Id); Console.WriteLine("EET Payment gw_url: {0}", result.GwUrl); Console.WriteLine("EET Payment instrument: {0}", result.PaymentInstrument); Console.WriteLine(baseEETPayment.Eet); } catch (GPClientException exception) { Console.WriteLine("Create EET payment ERROR"); var err = exception.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } throw; } return(result); }
public void GPConnectorTestStatus() { long id = 3049249619; var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); try { var payment = connector.GetAppToken().PaymentStatus(id); Assert.NotEqual(0, payment.Id); Console.WriteLine("Payment id: {0}", payment.Id); Console.WriteLine("Payment gw_url: {0}", payment.GwUrl); Console.WriteLine("Payment state: {0}", payment.State); Console.WriteLine("Payment instrument: {0}", payment.PaymentInstrument); Console.WriteLine("PreAuthorization: {0}", payment.PreAuthorization); Console.WriteLine("Recurrence: {0}", payment.Recurrence); } catch (GPClientException ex) { Console.WriteLine("Payment status ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestCreatePayment() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); connector.IncomingDataEventHandler += incomingDataListener; BasePayment basePayment = createBasePayment(); try { Payment result = connector.GetAppToken().CreatePayment(basePayment); Assert.IsNotNull(result); Assert.IsNotNull(result.Id); Console.WriteLine("Payment id: {0}", result.Id); Console.WriteLine("Payment gw_url: {0}", result.GwUrl); Console.WriteLine("Payment instrument: {0}", result.PaymentInstrument); Console.WriteLine(result.Payer.Contact); } catch (GPClientException exception) { Console.WriteLine("Create payment ERROR"); var err = exception.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestCardTokenPaymentStatus() { long id = 3052269740; var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); try { var payment = connector.GetAppToken().PaymentStatus(id); Assert.IsNotNull(payment.Id); Console.WriteLine("Payment id: {0}", payment.Id); Console.WriteLine("Payment gw_url: {0}", payment.GwUrl); Console.WriteLine("Payment state: {0}", payment.State); Console.WriteLine("PayerCard - card token: {0}", payment.Payer.PaymendCard.CardToken); Console.WriteLine("Payer 3DS Result: {0}", payment.Payer.PaymendCard.ThreeDResult); } catch (GPClientException ex) { Console.WriteLine("Payment status ERROR"); var err = ex.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestEETPReceiptFindByFilter() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID_EET, TestUtils.CLIENT_SECRET_EET); var filter = new EETReceiptFilter { DateFrom = new DateTime(2017, 3, 2), DateTo = new DateTime(2017, 4, 2), IdProvoz = 11 }; try { var receipts = connector.GetAppToken().FindEETReceiptsByFilter(filter); foreach (var currReceipt in receipts) { Console.WriteLine(currReceipt); } Console.WriteLine(receipts.Count); } catch (GPClientException ex) { Console.WriteLine("EET Receipt by filter ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public GPConnector Create(GoPayBaseModel model) { var connector = new GPConnector(_config.GoPayApi, model.ClientId, model.ClientSecret); connector.GetAppToken(); return(connector); }
public void GPConnectorTest() { var connector = new GPConnector(API_URL, CLIENT_ID, CLIENT_SECRET); connector.GetAppToken(); Assert.IsNotNull(connector.AccessToken); Assert.IsNotNull(connector.AccessToken.Token); }
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) { // } } }
public void GPConnectorTest() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); connector.GetAppToken(); Console.WriteLine("Token expires in: {0}", connector.AccessToken.ExpiresIn); Assert.NotNull(connector.AccessToken); Assert.NotNull(connector.AccessToken.Token); }
public void GPConnectorTestStatus() { long id = 3044158975; var connector = new GPConnector(API_URL, CLIENT_ID, CLIENT_SECRET); try { var payment = connector.GetAppToken().PaymentStatus(id); Assert.IsNotNull(payment.Id); } catch (GPClientException ex) { // } }
public void GPConnectorTestCreatePayment() { var connector = new GPConnector(API_URL, CLIENT_ID, CLIENT_SECRET); BasePayment payment = new BasePayment() { Currency = Currency.EUR, Lang = "ENG", OrderNumber = "789456167879", Amount = 7500, Target = new Target() { GoId = GOID, Type = Target.TargetType.ACCOUNT }, Callback = new Callback() { NotificationUrl = "https://eshop798456.com/notify", ReturnUrl = "Https://eshop78945.com/return" }, Recurrence = new Recurrence() { Cycle = RecurrenceCycle.ON_DEMAND, DateTo = new DateTime(2020, 12, 12) }, Payer = new Payer() { Contact = new PayerContact() { Email = "*****@*****.**" }, DefaultPaymentInstrument = PaymentInstrument.PAYMENT_CARD } }; try { Payment result = connector.GetAppToken().CreatePayment(payment); Assert.IsNotNull(result); Assert.IsNotNull(result.Id); } catch (GPClientException exception) { var err = exception.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
// [TestMethod()] public void GPConnectorTestRefund() { var connector = new GPConnector(API_URL, CLIENT_ID, CLIENT_SECRET); long id = 3044158975; try { var result = connector.GetAppToken().RefundPayment(id, 7500); Assert.IsNotNull(result); Assert.IsNotNull(result.Id); } catch (GPClientException exception) { var err = exception.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { //Handle } } }
public void GPConnectorTestStatementGenerating() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); var accountStatement = new AccountStatement { DateFrom = new DateTime(2017, 1, 1), DateTo = new DateTime(2017, 2, 27), GoID = TestUtils.GOID, Currency = Currency.CZK, Format = StatementGeneratingFormat.CSV_A }; try { var statement = connector.GetAppToken().GetStatement(accountStatement); Assert.NotNull(statement); var content = Encoding.UTF8.GetString(statement); Console.WriteLine("Content of Array to string: {0}", content); Console.WriteLine( "----------------------------------------------------------------------------------------"); Console.Write("Byte content: "); for (var i = 0; i < statement.Length; i++) { Console.Write(" {0}", statement[i]); } } catch (GPClientException ex) { Console.WriteLine("Generating account statement ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestGetSupercashCouponBatchStatus() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); var batchId = 961667719; try { var result = connector.GetAppToken().GetSupercashCouponBatchStatus(batchId); Assert.NotNull(result); Console.WriteLine(result.ToString()); } catch (GPClientException ex) { Console.WriteLine("Get Supercash Coupon Batch Status ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
//[TestMethod()] public void GPConnectorTestGetSupercashCoupon() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); long couponId = 100154175; try { SupercashPayment result = connector.GetAppToken().GetSupercashCoupon(couponId); Assert.IsNotNull(result); Console.WriteLine(result.ToString()); } catch (GPClientException ex) { Console.WriteLine("Get Supercash Coupon ERROR"); var err = ex.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestCreateSupercashCoupon() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); var couponRequest = new SupercashCouponRequest { GoId = TestUtils.GOID, SubType = SubType.POSTPAID, CustomId = "ID-123457", Amount = 100, OrderNumber = "1", OrderDescription = "Supercash Coupon Test", BuyerEmail = "*****@*****.**", BuyerPhone = "+420777123456", DateValidTo = new DateTime(2018, 12, 31), NotificiationUrl = "http://www.example-notify.cz/supercash" }; try { var result = connector.GetAppToken().CreateSupercashCoupon(couponRequest); Assert.NotNull(result); Console.WriteLine("SC coupon id: {0}", result.SupercashCouponId); Console.WriteLine("SC custom id: {0}", result.CustomId); Console.WriteLine("SC coupon number: {0}", result.SupercashNumber); } catch (GPClientException ex) { Console.WriteLine("Create Supercash Coupon ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestCapturePayment() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); long id = 3049249190; try { var result = connector.GetAppToken().CapturePayment(id); Assert.IsNotNull(result.Id); Console.WriteLine("Capture payment result: {0}", result); } catch (GPClientException exception) { Console.WriteLine("Capture payment ERROR"); var err = exception.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { //Handle } } }
public void GPConnectorTestVoidAuthorization() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); long id = 3049249125; try { var result = connector.GetAppToken().VoidAuthorization(id); Assert.NotEqual(0, result.Id); Console.WriteLine("Void Authorization result: {0}", result); } catch (GPClientException exception) { Console.WriteLine("Void authorization ERROR"); var err = exception.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { //Handle } } }
public void GPConnectorTestFindSupercashCoupons() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); //long[] paymentSessionIds = new long[] { 3050857992, 3050858018 }; long paymentSessionIds = 3050857992; try { var result = connector.GetAppToken().FindSupercashCoupons(TestUtils.GOID, paymentSessionIds); Assert.NotNull(result); Console.WriteLine(result.ToString()); } catch (GPClientException ex) { Console.WriteLine("Find Supercash Coupons ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestPaymentInstrumentRoot() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); try { var instrumentsList = connector.GetAppToken().GetPaymentInstruments(TestUtils.GOID, Currency.CZK); Assert.NotNull(instrumentsList); Console.WriteLine("List of enabled payment instruments for shop with go_id: {0} - OK", TestUtils.GOID); Console.WriteLine(instrumentsList.ToString()); } catch (GPClientException ex) { Console.WriteLine("List of enabled payment instruments ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestOnDemand() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); var basePayment = CreatePaymentTests.createBasePayment(); var onDemandRecurrence = new Recurrence { Cycle = RecurrenceCycle.ON_DEMAND, DateTo = new DateTime(2018, 4, 1) }; basePayment.Recurrence = onDemandRecurrence; try { var result = connector.GetAppToken().CreatePayment(basePayment); Assert.NotNull(result); Assert.NotEqual(0, result.Id); Console.WriteLine("Payment id: {0}", result.Id); Console.WriteLine("Payment gw_url: {0}", result.GwUrl); Console.WriteLine("Payment instrument: {0}", result.PaymentInstrument); Console.WriteLine("Recurrence: {0}", result.Recurrence); Console.WriteLine("Payment amount: {0}", result.Amount); } catch (GPClientException exception) { Console.WriteLine("Creating OnDemand payment ERROR"); var err = exception.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestNextOnDemand() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); try { NextPayment nextPayment = new NextPayment() { OrderNumber = "OnDemand4321", Amount = 4000, Currency = Currency.CZK, OrderDescription = "OnDemand4321Description", }; nextPayment.Items.Add(new OrderItem() { Name = "OnDemand First Item", Amount = 2000, Count = 2 }); Payment onDemandPayment = connector.GetAppToken().CreateRecurrentPayment(3049249957, nextPayment); Console.WriteLine("OnDemand payment id: {0}", onDemandPayment.Id); Console.WriteLine("OnDemand payment gw_url: {0}", onDemandPayment.GwUrl); Console.WriteLine("OnDemand Payment instrument: {0}", onDemandPayment.PaymentInstrument); Console.WriteLine("OnDemand recurrence: {0}", onDemandPayment.Recurrence); Console.WriteLine("OnDemand amount: {0}", onDemandPayment.Amount); } catch (GPClientException exception) { Console.WriteLine("Creating next on demand payment ERROR"); var err = exception.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestCreateRecurrentPayment() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); BasePayment basePayment = CreatePaymentTests.createBasePayment(); Recurrence recurrence = new Recurrence() { Cycle = RecurrenceCycle.WEEK, Period = 1, DateTo = new DateTime(2018, 4, 1) }; basePayment.Recurrence = recurrence; try { Payment result = connector.GetAppToken().CreatePayment(basePayment); Assert.IsNotNull(result); Assert.IsNotNull(result.Id); Console.WriteLine("Payment id: {0}", result.Id); Console.WriteLine("Payment gw_url: {0}", result.GwUrl); Console.WriteLine("Payment instrument: {0}", result.PaymentInstrument); Console.WriteLine("Recurrence: {0}", result.Recurrence); } catch (GPClientException exception) { Console.WriteLine("Recurrent payment ERROR"); var err = exception.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }
public void GPConnectorTestRefund() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); long id = 3049215286; try { var refundResult = connector.GetAppToken().RefundPayment(id, 1000); Assert.IsNotNull(refundResult); Assert.IsNotNull(refundResult.Id); Console.WriteLine("Refund with amount result: {0}", refundResult); } catch (GPClientException exception) { Console.WriteLine("CHYBA refundu"); var err = exception.Error; DateTime date = err.DateIssued; foreach (var element in err.ErrorMessages) { //Handle } } }
public void GPConnectorTestCreateSupercashCouponBatch() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); var batchRequest = new SupercashBatchRequest { GoId = TestUtils.GOID, BatchNotificationUrl = "http://www.notify.cz/super", Defaults = new SupercashBatchItem { SubType = SubType.POSTPAID, Amounts = new List <long> { 300, 400, 500, 600, 700, 800, 900, 1000 }, OrderDescription = "Supercash Coupon Batch Test" }, Coupons = new List <SupercashBatchItem> { new SupercashBatchItem { BuyerEmail = "*****@*****.**", CustomId = "ID-123457", BuyerPhone = "+420777666111", Amounts = new List <long> { 100 } }, new SupercashBatchItem { BuyerEmail = "*****@*****.**", CustomId = "ID-123458", BuyerPhone = "+420777666222", Amounts = new List <long> { 200 } }, new SupercashBatchItem { BuyerEmail = "*****@*****.**", CustomId = "ID-123459", BuyerPhone = "+420777666333", Amounts = new List <long> { 300 } } } }; try { var result = connector.GetAppToken().CreateSupercashCouponBatch(batchRequest); Assert.NotNull(result); Console.WriteLine(result.ToString()); } catch (GPClientException ex) { Console.WriteLine("Create Supercash Coupon Batch ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }