Skip to content

Instantly share code, notes, and snippets.

@phillipsj
Created February 27, 2015 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phillipsj/219e37df1cc1efef51ba to your computer and use it in GitHub Desktop.
Save phillipsj/219e37df1cc1efef51ba to your computer and use it in GitHub Desktop.
DirectPostForm Extension
public static class FormExtensions
{
private class DirectPostForm : IDisposable
{
private readonly HtmlHelper _helper;
public DirectPostForm(HtmlHelper helper, string apiLogin, string transactionKey, decimal amount,
string returnUrl, bool isTest)
{
_helper = helper;
_helper.ViewContext.Writer.Write(DPMFormGenerator.OpenForm(apiLogin, transactionKey, amount, returnUrl,
isTest));
}
public void Dispose()
{
_helper.ViewContext.Writer.Write(DPMFormGenerator.EndForm());
}
}
public static IDisposable BeginDirectPostForm(this HtmlHelper helper, string apiLogin, string transactionKey,
decimal amount,
string returnUrl, bool isTest)
{
return new DirectPostForm(helper, apiLogin, transactionKey, amount, returnUrl, isTest);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment