cempehlivan / CP.VPOS

CP.VPOS, Türkiye'deki bankaların sanal POS entegrasyonlarını tek bir .NET kütüphanesiyle kolayca yönetmeyi sağlar.
https://www.nuget.org/packages/CP.VPOS
MIT License
96 stars 25 forks source link

[Question] I'm unable to do payment to GarantiBBVA in the test enviroment #14

Closed wtlgo closed 4 months ago

wtlgo commented 4 months ago

For some reason when I do this

using CP.VPOS;
using CP.VPOS.Enums;
using CP.VPOS.Models;
using CP.VPOS.Services;

var auth = new VirtualPOSAuth
{
    bankCode = BankService.GarantiBBVA,
    // https://dev.garantibbva.com.tr/sanal-pos-ortak-odeme-pesin
    merchantID = "7000679", // MerchantID
    merchantUser = "30691297", // TerminalID
    merchantPassword = "123qweASD/", // ProvisionPassword
    merchantStorekey = "12345678", // StoreKey
    testPlatform = true
};

var customerInfo = new CustomerInfo
{
    taxNumber = "1111111111",
    emailAddress = "test@test.com",
    name = "Test",
    surname = "User",
    phoneNumber = "1111111111",
    addressDesc = "Kadikoy",
    cityName = "Istanbul",
    country = Country.TUR,
    postCode = "34000",
    taxOffice = "Goztepe",
    townName = "Goztepe"
};

var saleRequest = new SaleRequest
{
    invoiceInfo = customerInfo,
    shippingInfo = customerInfo,
    saleInfo = new SaleInfo
    {
        // https://dev.garantibbva.com.tr/test-kartlari
        cardNameSurname = "Test User",
        cardNumber = "9792364832690872",
        cardExpiryDateMonth = 10,
        cardExpiryDateYear = 2029,
        amount = (decimal)100.50,
        cardCVV = "579",
        currency = Currency.TRY,
        installment = 1,
    },
    payment3D = new Payment3D
    {
        confirm = false
    },
    customerIPAddress = "1.1.1.1",
    orderNumber = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds).ToString("X")
};

var resp = VPOSClient.Sale(saleRequest, auth);

Console.WriteLine(resp);

I get the following error:

Unhandled exception. System.Net.WebException: The operation has timed out.
   at System.Net.HttpWebRequest.GetResponse()
   at CP.VPOS.Banks.GarantiBBVA.GarantiBBVAVirtualPOSService.SendHttpRequest(String Host, String Method, String Params)
   at CP.VPOS.Banks.GarantiBBVA.GarantiBBVAVirtualPOSService.Sale(SaleRequest request, VirtualPOSAuth auth)
   at CP.VPOS.VPOSClient.Sale(SaleRequest request, VirtualPOSAuth auth)
   at Program.<Main>$(String[] args)

Am I doing something wrong?

I'm using the last version from NuGet (CP.VPOS 1.8.4) on dotnet 8.0. The system is Windows 10.

wtlgo commented 4 months ago

I also noticed that the library uses sanalposprovtest.garanti.com.tr as the test endpoint, but the documentation says its sanalposprovtest.garantibbva.com.tr

cempehlivan commented 4 months ago

Hello, yes, as you mentioned, the test environment URL has been updated. I have updated the test environment URL and released version 1.8.5.

wtlgo commented 4 months ago

Yes, now it works, thank you