Class GatewayProvider
- Namespace
- Dynamicweb.Ecommerce.Orders.Gateways
- Assembly
- Dynamicweb.Ecommerce.dll
Base class for creating a setting page for the payment gateway.
[Obsolete]
public class GatewayProvider : ConfigurableAddIn
- Inheritance
-
GatewayProvider
- Inherited Members
Examples
using System.Globalization;
using Dynamicweb.Ecommerce.Orders.Gateways;
using Dynamicweb.Rendering;
namespace Dynamicweb.Ecommerce.Examples.Orders.Gateways
{
#if !DW10
class GatewaySample : GatewayProvider
{
public override void Render(Template template, string tagPreFix)
{
base.Render(template, tagPreFix);
template.SetTag(tagPreFix + ".Email", Email);
template.SetTag(tagPreFix + ".Price", Order.Price.Price.ToString("0.00", CultureInfo.InvariantCulture));
}
public string Email { get; set; }
}
#endif
}
Public Class MyGateway Inherits GatewayProvider
Public Overrides Sub Render(ByVal template As Rendering.Template, ByVal TagPreFix As String)
MyBase.Render(template, TagPreFix)
template.SetTag(TagPreFix + ".Email", Email)
template.SetTag(TagPreFix + ".Price", Order.Price.Price.ToString("0.00", CultureInfo.InvariantCulture))
End Sub
Private _Email As String
Public Property Email() As String
Get
Return _Email
End Get
Set(ByVal Value As String)
_Email = Value
End Set
End Property
End Class
Properties
Merchant
Gets or sets the merchant.
[AddInParameter("Merchant")]
[AddInParameterEditor(typeof(TextParameterEditor), "")]
public virtual string Merchant { get; set; }
Property Value
- string
- The merchant.
Order
Gets or sets the order object.
public virtual Order Order { get; set; }
Property Value
- Order
- The order.
PageView
Gets or sets the page view object.
public virtual PageView PageView { get; set; }
Property Value
- PageView
- The page view.
Template
Gets or sets the HTML template for gateway payment page.
[AddInParameter("Template")]
[AddInParameterEditor(typeof(TemplateParameterEditor), "folder=templates/eCom/Gateway")]
public virtual string Template { get; set; }
Property Value
- string
- The template.
Methods
GetAvailableGatewayPaymentStates()
Gets the list of available gateway payment states.
public virtual List<string> GetAvailableGatewayPaymentStates()
Returns
Examples
public override List<String> GetAvailableGatewayPaymentStates()
{
List<String> list = new List<String >();
list.Add(GatewayPaymentStatus.ChargedBack)
list.Add(GatewayPaymentStatus.ClosedSuccess)
list.Add(GatewayPaymentStatus.ClosedCanceled)
list.Add(GatewayPaymentStatus.Paid)
list.Add(GatewayPaymentStatus.Started)
return list
}
GetGatewayFromPayment(Payment)
Gets the gateway from payment.
public static GatewayProvider GetGatewayFromPayment(Payment payment)
Parameters
payment
Payment- The payment.
Returns
Examples
Dynamicweb.eCommerce.Orders.Order order = New Dynamicweb.eCommerce.Orders.Order(Dynamicweb.Context.Current.Request("orderID"))
Dynamicweb.eCommerce.Orders.Gateways.GatewayProvider gateway = Dynamicweb.eCommerce.Orders.Gateways.GatewayProvider.GetGatewayFromPayment(New Dynamicweb.eCommerce.Orders.Payment(order.PaymentMethodID))
GetGatewayFromPaymentId(string)
Gets the gateway from payment ID.
public static GatewayProvider GetGatewayFromPaymentId(string paymentId)
Parameters
paymentId
string- The payment ID.
Returns
Remarks
See also GetGatewayFromPayment function
GetGatewayPaymentStatusXslt()
Gets the gateway payment status XSLT.
public virtual string GetGatewayPaymentStatusXslt()
Returns
GetReturnValuesFromUrl(Order)
Gets the return values from URL. Executed when we get result from gateway
public virtual void GetReturnValuesFromUrl(Order order)
Parameters
order
Order- The order.
Examples
public override void GetReturnValuesFromUrl(Order order)
{
String txn_id = Dynamicweb.Context.Current.Request("txn_id");
String paymentStatus = Dynamicweb.Context.Current.Request("payment_status");
order.GatewayResult = String.Format("<{0}>{1}</{0}>", "result", paymentStatus );
order.TransactionNumber = transnum;
order.UpdateGatewayResult(true);
}
LogError(Exception, string, params object[])
protected void LogError(Exception ex, string message, params object[] args)
Parameters
LogError(string, params object[])
protected void LogError(string message, params object[] args)
Parameters
LogEvent(string, params object[])
protected void LogEvent(string message, params object[] args)
Parameters
OnBeforeRenderStep5()
Called before rendering of step5 (before redirect to gateway site).
public virtual void OnBeforeRenderStep5()
Examples
public overrides void OnBeforeRenderStep5()
{
order.GatewayUniqueID = Dynamicweb.eCommerce.Common.NumberGenerator.GetNumber("ORDERGATEWAYUNIQUEID");
order.Save();
}
Render(Template, string)
Renders the specified template.
public virtual void Render(Template template, string tagPreFix)
Parameters
Examples
public override void Render(Rendering.Template template, String TagPreFix)
{
base.Render(template, TagPreFix);
template.SetTag(TagPreFix + ".Email", Email);
template.SetTag(TagPreFix + ".Price", order.Price.Price.ToString("0.00", CultureInfo.InvariantCulture));
}
SetOrderComplete(Order, string, string)
Mark the order as complete.
public void SetOrderComplete(Order order, string transactionId, string gatewayResult)