In the suggestion topic at  https://www.nopcommerce.com/boards/postnew.aspx?topicid=8958 I made a suggestion to add an Adyen payment method, but rather than just hoping that someone would eventually build this payment method for nopCommerce, I would be willing to give it a try.

First, has anyone done an Adyen payment module for nopCommerce?  If not, I'll give it try, but I will need some guidance.   From looking at the current modules I see a return.aspx.cs class that is called by return.aspx.  The return.aspx.designer.cs appears to be auto-generated on build.  

Not being familiar with nopCommerce design, plus the large amount of DI and inheritance I am not sure where to start.  I see I have to create the Adyen classes, rebuild the solution, then somehow register them in NopCommerce as a resource (which seems to be the key to extending anything in nopCommerce) that is called by the CheckoutPaymentMethod,  so they show up in the payment screen etc...

So where to I start?  And what part of the the Ayden code examples below do I need to include in the Ayden payment method?   Obviously I have to create or perhaps just create a return classes template from the with Adyen data. Rebuild.  Register the resource? How?  Could someone please point the way?  

Any guidance would be greatly appreciated.  

Here is a sample of the Ayden connection string:

<input type="hidden" name="merchantReference" value="Internet Order 12345" />
<input type="hidden" name="paymentAmount" value="10000" />
<input type="hidden" name="currencyCode" value="GBP" />
<input type="hidden" name="shipBeforeDate" value="2007-10-20" />
<input type="hidden" name="skinCode" value="4aD37dJA" />
<input type="hidden" name="merchantAccount" value="TestMerchant" />
<input type="hidden" name="shopperLocale" value="en_GB" />
<input type="hidden" name="orderData"
value="H4sIAAAAAAAAALMpsOPlCkssyswvLVZIz89PKVZIzEtRKE4tKstMTi3W4+Wy0S+wAwDOGUCXJgAAAA==" />
<input type="hidden" name="sessionValidity" value="2007-10-11T11:00:00Z" />
<input type="hidden" name="merchantSig" value="33syARtfsxD47jeXzOlEyZ0j3pg=" />        


Here is a sample of Adyen payment generation code:

<%@ Page Language="C#" src="Default.aspx.cs" Inherits="Projects.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
  <title>Default</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <script type="text/javascript">
  function replaceAction() {
    // if merchantSig has a value, we are ready to pay
    if(document.forms[0].merchantSig.value != "") {
      document.forms[0].action="http://localhost:8080/hpp/select.shtml";
      document.getElementById("startagain").style.display = "inline";
    }
  }
  window.onload = replaceAction;
  </script>
</head>
<body>
    <h1>Test ASP.NET Page</h1>
    
  <form id="form1" runat="server">
  <table>
    <tr>
      <td>Signature</td>
      <td><asp:TextBox Size="80" id="merchantSig" runat="server"/>  (generated when you press "Submit") </td>
    </tr>    
    <tr>
      <td>Session Valid Till</td>
      <td><asp:TextBox Size="50" id="sessionValidity" runat="server"/></td>
    </tr>
    <tr>
      <td>Ship Before Date</td>
      <td><asp:TextBox Size="50" id="shipBeforeDate" runat="server"/></td>
    </tr>
    <tr>
      <td>Shopper's Locale</td>
      <td><asp:TextBox Size="9" id="shopperLocale" runat="server"/> (e.g. nl, en_GB, de....)</td>
    </tr>
    <tr>
      <td>Merchant Account</td>
      <td><asp:TextBox Size="30" id="merchantAccount" runat="server"/></td>
    </tr>
    <tr>
      <td>Payment Amount</td>
      <td><asp:TextBox Size="10" id="paymentAmount" runat="server"/></td>
    </tr>
    <tr>
      <td>Currency Code</td>
      <td><asp:TextBox Size="4" id="currencyCode" runat="server"/></td>
    </tr>
    <tr>
      <td>Skin Code</td>
      <td><asp:TextBox Size="10" id="skinCode" runat="server"/></td>
    </tr>
    <tr>
      <td>Merchant Reference</td>
      <td><asp:TextBox Size="40" id="merchantReference" runat="server"/></td>
    </tr>
    <tr>
      <td>Shopper Email Address</td>
      <td><asp:TextBox Size="40" id="shopperEmail" runat="server"/></td>
    </tr>
    <tr>
      <td colspan="2" style="text-align: right">
      <span id="startagain" style="display: none">[<a href=""> Reset </a>]</span>
      <asp:Button id="button1" Text="Submit" runat="server" OnClick="onButtonClick"/>
      </td>
    </tr>
  </form>
  
</body>
</html>


And finally here is an example of the Adyen Generate payment script:

<!--#include virtual="/inc/hmac_sha1_js.asp"-->
<%

Response.Write ("<p>Website header</p>")
Response.Write ("<p>Payment form<br/>")
Response.Write GetAdyenForm("orderID_000001",100,"NL","nl","[email protected]","test-order1")
Response.Write ("</p>")
Response.Write ("<p>Website footer</p>")


' Generate Adyen Form
'   merchantReference = a unique reference per transaction
'   paymentAmount = the amount of the payment in minor units!
'   shopperCountry = the country of the shopper, for example NL
'   shopperLanguage = the language of the shopper, for exampl nl
'   shopperEmail = the email address of the shopper
'   shopperReference = a reference for the shopper
Private Function GetAdyenForm(merchantReference, paymentAmount, shopperCountry, shopperLanguage, shopperEmail, shopperReference)
  '--------------------------------------------------------------------------------
  'YOUR ADYEN CONSTANTS
    'Your MERCHANT account code (case sensitive)
  cAdyenMerchantAccount  = ""
    'The Skincode as can be found in the Adyen Customer Area (CA)
  cAdyenSkinCode    = ""
    'The currency code. (You can use multiple)
  cAdyenCurrencyCode    = "EUR"
    'Your secret key as you have entered on the Edit Skin tab in the Adyen Customer Area (CA)
  cAdyenHMACKey    = ""
    'The url to the adyen HPP (test or live)
  cAdyenUrl = "https://test.adyen.com/hpp/pay.shtml"
  '--------------------------------------------------------------------------------

  ' vars
  Dim shipBeforeDate, today, sessionValidity
  Dim strHmacSig, strSigStr

  '
  'Get Relevant Data
  '
  today       = Date
  sessionValidity   = DateAdd("d", 3, today)
  sessionValidity   = Year(sessionValidity) & "-" & Month(sessionValidity) & "-" & Day(sessionValidity) & "T00:00:00Z"
  'Only for an indication to the shopper (Can be hidden in Skin)
  shipBeforeDate    = DateAdd("d", 2, today)
  shipBeforeDate     = Year(shipBeforeDate) & "-" & Month(shipBeforeDate) & "-" & Day(shipBeforeDate)
     
  '
  'Create Form
  '
  sOut = sOut & "<form method=""post"" action=""" & cAdyenUrl & """ name=""frmAdyen"" id=""frmAdyen"" target=""_blank"" >"
    
  sOut = sOut & GetHiddenField("merchantReference", merchantReference)
  sOut = sOut & GetHiddenField("merchantAccount", cAdyenMerchantAccount)
  sOut = sOut & GetHiddenField("currencyCode", cAdyenCurrencyCode)
  sOut = sOut & GetHiddenField("shopperLocale", IIF(shopperLanguage="nl","nl_NL","en_US"))
  sOut = sOut & GetHiddenField("paymentAmount", paymentAmount)  'In minor units (cents)
  sOut = sOut & GetHiddenField("skinCode", cAdyenSkinCode)
  sOut = sOut & GetHiddenField("sessionValidity", sessionValidity)
        sOut = sOut & GetHiddenField("shipBeforeDate", shipBeforeDate)
  sOut = sOut & GetHiddenField("countryCode", shopperCountry)
    
  'Customer info
  sOut = sOut & GetHiddenField("shopperReference", shopperReference)
  sOut = sOut & GetHiddenField("shopperEmail", shopperEmail)
    

  'Calculate the signature    
  strSigStr  = paymentAmount & cAdyenCurrencyCode & shipBeforeDate & merchantReference & cAdyenSkinCode & cAdyenMerchantAccount & sessionValidity & shopperEmail & shopperReference
  strHmacSig = b64_hmac_sha1(cAdyenHMACKey, strSigStr)
  sOut      = sOut & GetHiddenField("merchantSig", strHmacSig)
  sOut = sOut & "<input type=""submit"" name=""submit"" value=""make payment"">"
  sOut = sOut & "</form>"

  GetAdyenForm = sOut
End Function

Private Function GetHiddenField(formFieldName, formFieldValue)
  GetHiddenField = "<input type=""hidden"" name=""" & formFieldName & """ value=""" & formFieldValue & """>"
End Function

%>