Пример #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            // Script that lets us use the Tokenizer API (see https://sandbox.gotnpgateway.com/docs/tokenizer/)
            RockPage.AddScriptSrcToHead(this.Page, "gotnpgatewayTokenizer", $"{GatewayBaseUrl}/tokenizer/tokenizer.js");

            // Script that contains the initializeTokenizer scripts for us to use on the client
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myWellGatewayTokenizerBlock", Scripts.gatewayTokenizer, true);

            System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "myWellGatewayTokenizerStartup", $"initializeTokenizer('{this.ClientID}');", true);

            base.OnInit(e);
        }
Пример #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            // Script that lets us use the CollectJS API (see https://secure.tnbcigateway.com/merchants/resources/integration/integration_portal.php?#cjs_methodology)
            var additionalAttributes = new Dictionary <string, string>();

            additionalAttributes.Add("data-tokenization-key", this.TokenizationKey);
            additionalAttributes.Add("data-variant", "inline");
            RockPage.AddScriptSrcToHead(this.Page, "nmiCollectJS", $"https://secure.tnbcigateway.com/token/Collect.js", additionalAttributes);
            RockPage.AddStyleToHead(this.Page, "nmiCollectJSCSS", Css.gatewayCollect);

            // Script that contains the initializeTokenizer scripts for us to use on the client
            if (!Page.IsPostBack)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "nmiGatewayCollectJSBlock", Scripts.gatewayCollectJS, true);
            }

            ScriptManager.RegisterStartupScript(this, this.GetType(), "nmiGatewayCollectJSStartup", $"Rock.NMI.controls.gatewayCollectJS.initialize('{this.ClientID}');", true);

            base.OnInit(e);
        }