Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 3D Secure sales operation and test #3

Merged
merged 2 commits into from
Jul 8, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update 3D Secure sales operation and test
-Add selfhost debug description
-Update new test card information
-Add Refresh and Lang optional properties
-Update some form parameter names
-Add GVPSException
-Add get incoming form data extension for empty post
-Add FormElementAttribute (not required)
  • Loading branch information
enig committed Jul 4, 2017
commit f1db370a738309602b360df57a11d52d657efc8e
435 changes: 251 additions & 184 deletions GarantiVP/GVPSClient.cs

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions GarantiVP/GVPSExcetion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Runtime.Serialization;

namespace GarantiVP
{
[Serializable]
public class GVPSExcetion : Exception
{
public GVPSExcetion()
{
}

public GVPSExcetion(string message) : base(message)
{
}

public GVPSExcetion(string message, Exception innerException) : base(message, innerException)
{
}

protected GVPSExcetion(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
10 changes: 10 additions & 0 deletions GarantiVP/GVPSHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
Expand All @@ -9,6 +10,15 @@ namespace GarantiVP
{
public static class GVPSHelpers
{
public static string Get(this IDictionary<string, string[]> dic, string key)
{
string ret = null;
if (dic == null)
throw new ArgumentNullException("dic");
if (dic.ContainsKey(key))
ret = dic[key].FirstOrDefault();
return ret;
}
public static XmlElement AddInput(this XmlElement xe, string name, string val, string type = "hidden")
{
var xeNew = xe.OwnerDocument.CreateElement("input");
Expand Down
22 changes: 22 additions & 0 deletions GarantiVP/GVPSObjects/FormElementAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace GarantiVP
{
public class FormElementAttribute : Attribute
{
private string[] names;

public FormElementAttribute(params string[] names)
{
this.names = names;
}

public string[] Names
{
get
{
return names;
}
}
}
}
11 changes: 11 additions & 0 deletions GarantiVP/GVPSObjects/GVPSAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class GVPSAddress
/// <para>Size alfanumeric 1 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddresstype")]
public GVPSAddressTypeEnum Type { get; set; }

/// <summary>
Expand All @@ -29,6 +30,7 @@ public class GVPSAddress
/// <para lang="tr">Alıcı soyadı</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddresslastname")]
public string LastName { get; set; }

/// <summary>
Expand All @@ -37,6 +39,7 @@ public class GVPSAddress
/// <para lang="tr">Firma bilgileri</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddresscompany")]
public string Company { get; set; }

/// <summary>
Expand All @@ -45,6 +48,7 @@ public class GVPSAddress
/// <para lang="tr">Adres metini</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddresstext")]
public string Text { get; set; }

/// <summary>
Expand All @@ -53,6 +57,7 @@ public class GVPSAddress
/// <para lang="tr">Semt adı</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddressdistrict")]
public string District { get; set; }

/// <summary>
Expand All @@ -61,6 +66,7 @@ public class GVPSAddress
/// <para lang="tr">Şehir adı</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddresscity")]
public string City { get; set; }

/// <summary>
Expand All @@ -69,6 +75,7 @@ public class GVPSAddress
/// <para lang="tr">Posta kodu</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddresspostalcode")]
public string PostalCode { get; set; }

/// <summary>
Expand All @@ -77,6 +84,7 @@ public class GVPSAddress
/// <para lang="tr">Telefon numarası</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddressphonenumber")]
public string PhoneNumber { get; set; }

/// <summary>
Expand All @@ -85,6 +93,7 @@ public class GVPSAddress
/// <para lang="tr">Cep telefonu numarası</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddressgsmnumber")]
public string GSMNumber { get; set; }

/// <summary>
Expand All @@ -93,6 +102,7 @@ public class GVPSAddress
/// <para lang="tr">Faks numarası</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddressfaxnumber")]
public string FaxNumber { get; set; }

/// <summary>
Expand All @@ -101,6 +111,7 @@ public class GVPSAddress
/// <para lang="tr">Ülke</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddresscountry")]
public string Country { get; set; }
}
}
1 change: 1 addition & 0 deletions GarantiVP/GVPSObjects/GVPSAddressList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class GVPSAddressList
///
/// </summary>
[XmlElement("Address", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddresscount")]
public GVPSAddress[] Address { get; set; }
}
}
4 changes: 4 additions & 0 deletions GarantiVP/GVPSObjects/GVPSCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class GVPSCard
/// <para lang="tr">Kart numarası</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("cardnumber")]
public string Number { get; set; }

/// <summary>
Expand All @@ -24,6 +25,7 @@ public class GVPSCard
/// <para lang="tr">Kart son kullanım tarihi. AAYY biçiminde olmalı.</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("cardexpiredatemonth", "cardexpiredateyear")]
public string ExpireDate { get; set; }

/// <summary>
Expand All @@ -32,13 +34,15 @@ public class GVPSCard
/// <para lang="tr">Kart CVV numarası</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("cardcvv2")]
public string CVV2 { get; set; }

/// <summary>
/// Cardholder name
/// <para lang="tr">Kart sahibi adı</para>
/// </summary>
[XmlElement()]
[FormElement("cardholder")]
public string CardHolder { get; set; }
}
}
2 changes: 2 additions & 0 deletions GarantiVP/GVPSObjects/GVPSComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class GVPSComment
/// <para>But the virtual pos must be sent in the defined and defined order in the screens.</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("ordercommentnumber")]
public uint Number { get; set; }


Expand All @@ -22,6 +23,7 @@ public class GVPSComment
/// <para>Size 20 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("ordercommenttext")]
public string Text { get; set; }
}
}
1 change: 1 addition & 0 deletions GarantiVP/GVPSObjects/GVPSCommentList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class GVPSCommentList
///
/// </summary>
[XmlElement("Comment", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderaddresscount")]
public GVPSComment[] Comment { get; set; }
}
}
2 changes: 2 additions & 0 deletions GarantiVP/GVPSObjects/GVPSCustomer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class GVPSCustomer
/// <para lang="tr">Müşteri IP Adresi</para>
/// </summary>
[XmlElement]
[FormElement("customeripaddress")]
public string IPAddress { get; set; }

/// <summary>
Expand All @@ -23,6 +24,7 @@ public class GVPSCustomer
/// <para lang="tr">Müşteri e-posta adresi</para>
/// </summary>
[XmlElement]
[FormElement("customeremailaddress")]
public string EmailAddress { get; set; }
}
}
1 change: 1 addition & 0 deletions GarantiVP/GVPSObjects/GVPSGSMUnitInq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class GVPSGSMUnitInq : GVPSTransactionInqBase
/// <para lang="tr">Paket ID, tutar ve benzeri gibi bilgileri içerir.</para>
/// </summary>
[XmlElement]
[FormElement("gsmquantity")]
public string Quantity { get; set; }
}
}
2 changes: 2 additions & 0 deletions GarantiVP/GVPSObjects/GVPSGSMUnitSales.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class GVPSGSMUnitSales : GVPSGSMUnitInq
/// <para lang="tr">Kontör numarası</para>
/// </summary>
[XmlElement]
[FormElement("gsmsalesunitid")]
public string UnitID { get; set; }

/// <summary>
Expand All @@ -23,6 +24,7 @@ public class GVPSGSMUnitSales : GVPSGSMUnitInq
/// <para lang="tr">Tutar</para>
/// </summary>
[XmlElement]
[FormElement("gsmsalesamnt")]
public ulong Amount { get; set; }
}
}
7 changes: 7 additions & 0 deletions GarantiVP/GVPSObjects/GVPSItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,31 @@ public class GVPSItem
/// <para>Size numeric 2 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderitemnumber")]
public uint Number { get; set; }

/// <summary>
/// Product / service reference
/// <para>Size alfanumeric 40 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderitemproductid")]
public string ProductID { get; set; }

/// <summary>
/// Product / service code
/// <para>Size alfanumeric 12 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderitemproductcode")]
public string ProductCode { get; set; }

/// <summary>
/// Purchased quantity information
/// <para>Size 13 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderitemquantity")]
public ulong Quantity { get; set; }

/// <summary>
Expand All @@ -43,6 +47,7 @@ public class GVPSItem
/// <para>Size numeric 19 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderitemprice")]
public ulong Price { get; set; }

/// <summary>
Expand All @@ -51,13 +56,15 @@ public class GVPSItem
/// <para>Size numeric 19 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderitemtotalamount")]
public ulong TotalAmount { get; set; }

/// <summary>
/// Product description
/// <para>Size 20 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderitemdescription")]
public string Description { get; set; }
}
}
1 change: 1 addition & 0 deletions GarantiVP/GVPSObjects/GVPSItemList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class GVPSItemList
///
/// </summary>
[XmlElement("Item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderitemcount")]
public GVPSItem[] Item { get; set; }
}
}
3 changes: 3 additions & 0 deletions GarantiVP/GVPSObjects/GVPSOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ public class GVPSOrder
/// <para>Size 36 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("orderid")]
public string OrderID { get; set; }

/// <summary>
/// Used for reporting.
/// <para>Size 36 Byte</para>
/// </summary>
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[FormElement("ordergroupid")]
public string GroupID { get; set; }

/// <summary>
Expand Down Expand Up @@ -58,6 +60,7 @@ public class GVPSOrder
/// <para lang="tr">Açıklama</para>
/// </summary>
[XmlElement]
[FormElement("orderdescription")]
public string Description { get; set; }

//TODO Create property StartDate
Expand Down
2 changes: 2 additions & 0 deletions GarantiVP/GVPSObjects/GVPSPacked.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class GVPSPacked
/// <para lang="tr">İşlem modu</para>
/// </summary>
[XmlElement]
[FormElement("mode")]
public GVPSRequestModeEnum Mode { get; set; }

/// <summary>
Expand All @@ -41,6 +42,7 @@ public class GVPSPacked
/// <para lang="tr">Kullanılan api sürümü</para>
/// </summary>
[XmlElement]
[FormElement("apiversion")]
public string Version { get; set; }

/// <summary>
Expand Down
Loading