Created
February 27, 2015 02:25
-
-
Save phillipsj/219e37df1cc1efef51ba to your computer and use it in GitHub Desktop.
DirectPostForm Extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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