Thursday, August 11, 2011

Monday, January 31, 2011

Recurring payment


Recurring payment

I used iTransact payment in my application for Recurring payment.
There are two mode available in Recurring payment
such as
Recurring Billing
Recurring Post back

Recurring Billing:

We have to save the recurring details in payment control panel

When a transaction is initially submitted for processing, recurring details may be passed as part of the form that will automatically create future recurring charges, based on the details that you provide. In addition, you may also modify previously submitted transactions and mark them as recurring. This is done via the Transaction Listing.
The Recurring Billing Module is quite sophisticated, but is easy to use. There are two aspects to the module, as explained below

The Recipe Builder

The Recipt Builder may be Daily, Monthly or Yearly depending upon the payment provider


Initiating Recurring Transactions


Recurring transactions may be initiated at the time the original transaction is processed. To initially set a transaction as recurring, simply add the following input fields to your order form. In this example we’ll use the "monthly13" recipe from the examples above and we’ll have the transaction recur six times


HTML Example

<input type="hidden" name="recur_recipe" value="monthly13">

<input type="hidden" name="recur_reps" value="6">



XML Example



<RecurringData>

<RecurRecipe>test</RecurRecipe>

<RecurReps>5</RecurReps>

<!-- Optional (For Split Recurring) -->

<RecurTotal>100.00</RecurTotal>

<!-- Optional (For Split Recurring) -->

<RecurDesc>test2</RecurDesc>

<!-- Optional (For Split Recurring) -->

</RecurringData>



Recurring Post back:

If you use the recurring transaction features of the gateway, you may specify a URL to receive transaction postback information. This can be enabled via the "Account Settings" link in the Control Panel.

To use this feature, enter the URL to be used for postback information. Each time a recurring transaction is processed through payment system,
Payment system will post the transaction results to your URL.

Eample:www.kingslin.com/RecurringPmt.aspx

The Transction details will in hidden values , To fetch the post back values We can use this
sample code in .Net

if (Request.Form["xid"] != null)
        {
            X_Id = Request.Form["xid"];
        }
        if (Request.Form["authcode"] != null)
        {
            Authcode = Request.Form["authcode"];
        }

by using this we can get all Transaction Details




Sample code for RemotePost Method in .Net


<script runat="server">

   

    void PostMe(Object sender,EventArgs e){

        RemotePost myremotepost =  new RemotePost();

        myremotepost.Url = "http://www.kingslin.com/RecurringPmt.aspx";

        myremotepost.Add("xid", "12345");

        myremotepost.Add("authcode", "kings");

        myremotepost.Post();

    }

   



    public class RemotePost{

            private System.Collections.Specialized.NameValueCollection Inputs = new System.Collections.Specialized.NameValueCollection();





            public string Url = "";

            public string Method = "post";

            public string FormName = "form1";

           

            public void Add(string name,string value){

                Inputs.Add(name,value);

            }

           

            public void Post(){

                System.Web.HttpContext.Current.Response.Clear();



                System.Web.HttpContext.Current.Response.Write("<html><head>");

               

                System.Web.HttpContext.Current.Response.Write(string.Format("</head><body onload=\"document.{0}.submit()\">",FormName));

                System.Web.HttpContext.Current.Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >",FormName,Method,Url));

                for(int i=0;i< Inputs.Keys.Count;i++){

                    System.Web.HttpContext.Current.Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">",Inputs.Keys[i],Inputs[Inputs.Keys[i]]));

                }

                System.Web.HttpContext.Current.Response.Write("</form>");

                System.Web.HttpContext.Current.Response.Write("</body></html>");



                System.Web.HttpContext.Current.Response.End();

            }

    }

</script>


Saturday, September 18, 2010

Website Thumbnail Image Generator

By using simple predefined class we can make website Thumbnail Image , check c# code here


    Bitmap bmp = WebsiteThumbnailImageGenerator.GetWebSiteThumbnail("http://" + txtadd.Text,800, 600, Int32.Parse(txtWidth.Text), Int32.Parse(txtHeight.Text));
            bmp.Save(Server.MapPath("~") + "/thumbImage.bmp");


         Here txtadd.Text,txtWidth.Text and txtHeight.Text values comes from aspx file

Thursday, August 5, 2010

Build Solution and Rebuild Solution option in VS.Net

We have two options for compiling and creating builds for our application. Such as

1)Build Solution
2)Rebuild Solution

1)Build Solution
The Build Solution option compiles only particular project files and components in the solution that have changed since the last build.
For example: Assume that we have two projects P1 and P2 in our solution WebsiteSolution. When we compile the solution using Build Solution option after making some changes to P1 only Pj1 will be compiled and built but P2 will not be compiled.

2) Rebuild Solution
The Rebuild option builds all project files and components.
For example : Assume that we have two projects P1 and P2 in your solution WebsiteSolution. When you compile the solution using Rebuild Solution option after making some changes to P1, both P1 and P2 will be compiled and built even though there are no changes made to P2.

Tuesday, July 27, 2010

Ranking Functions in SQL server

Let’s add RANK function onto this query, you can see additional column ranking the data.
 For example:
 the  Account Id  of ' kingslin ' are assigned a rank of 1 as they are equal, the Account Id  of Bala are assigned the next rank, stalin the next, etc. This is a simple way of assiging a Account Id   by class or category depending on how we order the data - the rank value of 3 simply means that all data with this rank number is the same.
Here I have used Table name with schema name (Customer.ShippingAddress)
Customer is the schema name for that table.



 select
 RANK() over (order by s_Acc_id) as Rank
, ROW_NUMBER() over (order by s_Acc_id) as RowNumber
, s_Acc_id from Customer.ShippingAddress


1 1    kingslin
 2 2    Bala
 3 3    Rajesh
 4 4    varakulan
 5 5    stalin
5 6    stalin
5 7    stalin
5 8    stalin
 9 9    vasanth
9 10    vasanth

Here Stalin Accound Id has the same values generated by the RANK and ROW_NUMBER functions giving us a very simple way of deduplicating the data.
How its working
•    the 'order by' clauses are used to bring specific sorted list
•    the ROW_NUMBER function gives sequential numbers
•    the RANK function allocates a value to each block of data matching the order criteria

Create CTE table and filter rows

 with AlphaRank(Rank, RowNumber, s_Acc_id) as (
select
  RANK() over (order by s_Acc_id) as Rank
, ROW_NUMBER() over (order by s_Acc_id) as RowNumber
, s_Acc_id
from Customer.ShippingAddress
)
select s_Acc_id from AlphaRank where Rank=RowNumber

output is :

kingslin
Bala
Rajesh
varakulan
stalin
vasanth