<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="3dodemeapiIyzico.aspx.vb" Inherits="._3dodemeapiIyzico" %> <%@ Import Namespace="IyzipayClient.Ecom.Approval.Requests" %> <%@ Import Namespace="IyzipayClient.Basic.Payment.Requests" %> <%@ Import Namespace="IyzipayClient" %> <%@ Import Namespace="Newtonsoft.Json" %> <%@ Import Namespace="Newtonsoft.Json.Linq" %> <%@ Import Namespace="Newtonsoft.Json.Serialization" %> <%@ Import Namespace="System.Collections.Generic" %> <%@ Import Namespace="IyzipayClient.Ecom.Payment.Dtos" %> <%@ Import Namespace="IyzipayClient.Ecom.Payment.Requests" %> <%@ Import Namespace="IyzipayClient.Services.Impl" %> <%@ Import Namespace="IyzipayClient.Services" %> <%@ Import Namespace="IyzipayClient.Configuration" %> <%@ Import Namespace="System.Xml" %> <% Dim paymentid As String = Request.Form.Get("paymentId") Dim conId As String = Session("NextOrderId") Dim configuration As New ClientConfiguration(Session("GetwayId"), Session("GetwayUserName"), "https://api.iyzipay.com/") Dim client As EcomPaymentServiceClient = New EcomPaymentServiceClientImpl(configuration) Dim req As New EcomPaymentThreeDSRequest() With { _ .ConversationId = conId, _ .Locale = "tr", _ .ConversationData = "", _ .PaymentId = paymentid.ToString() _ } Console.ForegroundColor = ConsoleColor.Yellow Console.WriteLine(JsonConvert.SerializeObject(req, New JsonSerializerSettings() With { _ .Formatting = Newtonsoft.Json.Formatting.Indented _ })) Console.ForegroundColor = ConsoleColor.Green Dim response2 = client.ThreeDSAuth(req) Console.WriteLine(JsonConvert.SerializeObject(response2, New JsonSerializerSettings() With { _ .Formatting = Newtonsoft.Json.Formatting.Indented _ })) Dim ToSendMail As String = _portalsettings.Email If ConfigurationManager.AppSettings("SmtpMailOrders") <> "" Then ToSendMail = ConfigurationManager.AppSettings("SmtpMailOrders") End If '{status=failure&paymentId=&conversationData=&conversationId=11DA261E_00000000000&mdStatus=0} Dim res As String = response2.ErrorMessage Dim result As String = Request.Form.Get("mdStatus") Dim errorcode As String = response2.ErrorCode Dim errormessage As String = response2.ErrorMessage If response2.Status = "success" Then Dim configuration4 As New ClientConfiguration(Session("GetwayId"), Session("GetwayUserName"), "https://api.iyzipay.com/") For Each item As IyzipayClient.Ecom.Payment.Dtos.EcomPaymentItemTransactionDto In response2.ItemTransactions Dim client4 As EcomPaymentServiceClient = New EcomPaymentServiceClientImpl(configuration4) Dim request4 As New ApprovalRequest() With { _ .ConversationId = conId, _ .PaymentTransactionId = item.PaymentTransactionId.ToString() _ } Console.ForegroundColor = ConsoleColor.Yellow Console.WriteLine(JsonConvert.SerializeObject(request4, New JsonSerializerSettings() With { _ .Formatting = Newtonsoft.Json.Formatting.Indented})) Console.ForegroundColor = ConsoleColor.Green Dim response4 = client4.Approve(request4) Console.WriteLine(JsonConvert.SerializeObject(response4, New JsonSerializerSettings() With { _ .Formatting = Newtonsoft.Json.Formatting.Indented _ })) Console.ForegroundColor = ConsoleColor.Yellow Console.WriteLine(JsonConvert.SerializeObject(request4, New JsonSerializerSettings() With { _ .Formatting = Newtonsoft.Json.Formatting.Indented _ })) Next Session("SonucKodu") = "00" Dim sb As New StringBuilder() sb.AppendLine("") Response.Write(sb.ToString()) Else Session("SonucKodu") = errorcode Session("SonucAciklamasi") = errormessage Response.Write("
3D Doğrulama İşlemi Başarısız

") Response.Write("Hata Kodu:" & errorcode & "
") Response.Write("Hata Mesajı:" & errormessage & "
") Dim _portalSettings As PortalSettings _portalSettings = CType(HttpContext.Current.Items("PortalSettings"), PortalSettings) Dim tmpOrder As ASPNetPortal.TempOrder Dim UserId As String = "" Dim UserName As String = "" Dim mail As New webmail If Session("TempOrder") Is Nothing Then tmpOrder = New ASPNetPortal.TempOrder Else tmpOrder = Session("TempOrder") End If Try If HttpContext.Current.User.Identity.IsAuthenticated() Then UserId = Context.User.Identity.Name.Split("|")(0) If IsNumeric(UserId) Then Dim ua As New ASPNetPortal.UsersDB Dim dr As SqlDataReader dr = ua.GetUserIndirim(UserId) dr.Read() UserName = ChkNullString(dr(3)) dr.Close() End If End If ' log error Dim py As New PaymentsDB py.AddPayment(tmpOrder, UserId, "
Banka 3D mesajı :" & errormessage) If Not ConfigurationManager.AppSettings("SendFailedPayments") = "False" Then mail.SendMail(_portalSettings.Email, ToSendMail, "Ödeme Onayı Alınamadı(3D)", "İşlem Sonucu : " & errorcode & "
Banka:IyzicoApi
Taksit:peşin UserId:" & UserId & "
UserName:" & UserName & "Toplam:" & tmpOrder.Pricess.KargoDahilWireCardToplam & " TL
Teslimat Adı: " & tmpOrder.ShippingInfo.RecipientName & "
Teslimat Tel: " & tmpOrder.ShippingInfo.PhoneNo & "
Teslmat Gsm: " & tmpOrder.ShippingInfo.MobilePhone & "
Fatura Adı:" & tmpOrder.BillingInfo.CompanyName & "
Banka 3D mesajı :" & errormessage) End If Catch ' log error Dim py As New PaymentsDB py.AddPayment(tmpOrder, UserId, "
Banka 3D mesajı :" & errormessage) If Not ConfigurationManager.AppSettings("SendFailedPayments") = "False" Then mail.SendMail(_portalSettings.Email, ToSendMail, "Ödeme Onayı Alınamadı(3D)", "İşlem Sonucu : " & errorcode & "
Banka 3D mesajı :" & errormessage) End If End Try Dim sb As New StringBuilder() sb.AppendLine("") Response.Write(sb.ToString()) End If %>