Promotage has been selected as one of the 20 finalists for Seedcamp Mumbai 2010

We are glad that Promotage has been selected as one of the 20 finalists for Seedcamp Mumbai 2010. Seedcamp Mumbai is a one day event aiming to connect the 20 best web-tech, mobile and software talent with some of the leading entrepreneurs, developers, and experts from the Indian, Asian, and European tech ecosystems.

Here is the link to the list of other startups that have been selected.

Congratulations to the team. Its been a great ride so far and we are hoping to make it bigger.

We are also thrilled to see three other companies from Chennai making it to the final list. Looking forward to meeting them at Seedcamp.

Cheers,

Keyan

Posted in ByteAlly | Tagged , , | Leave a comment

Calculating future gmt datetime with Ruby on Rails

created_at, updated_at. Is there any table without those two columns when it comes to applications?. We usually store the GMT for such fields. Storing the datetime in GMT makes internationalization a cake walk. Sometimes there might be a need to calculate future dates too. And here is how you do it using RoR(ruby on rails).

Calculating the current GMT


time_stamp = Time.now()
gmt_stamp = time_stamp.gmtime
gmt = Time.gm(gmt_stamp.year,gmt_stamp.month,gmt_stamp.day, gmt_stamp.hour, gmt_stamp.min)
"#{gmt.strftime('%Y-%m-%d %H:%M:%S')}"

The above function returns the gmt in a format that is supported by some of the major SQL databases(mySQL, MS SQL)

Now, calculating a future datetime in GMT


 time_stamp = Time.now()
 gmt_stamp = time_stamp.gmtime
 future_gmt = Time.gm(gmt_stamp.year,gmt_stamp.month,gmt_stamp.day, gmt_stamp.hour, gmt_stamp.min) + length.to_i.months
 # to calculate by days + length.to_i.days
 # by hours + length.to_i.hours#minutes length.to_i.minutes
 "#{future_gmt.strftime('%Y-%m-%d %H:%M:%S')}"
Posted in Programming | Tagged , , , , | 1 Comment

Finding Verification status of a paypal account , Ruby on Rails, PayPal Adaptive Accounts GetVerifiedStatus

We recently had a requirement where we had to find the “verification” status of any given paypal account. This might be very useful to reduce the risk of online frauds. I was searching for a Ruby on rails plugin for PayPal’s adaptive accounts API. Neither did i have the time nor the patience to go through the search results. Looking at the GetVerifiedStatus Adaptive Accounts API it looked damn straight forward. So i went ahead to implement it with my own code.

Its pretty simple. I used the httpclient gem, which is pretty cool, to make the http request. You can install it by doing

 gem install httpclient

I also use the xmlsimple gem to process the response from the API. Makes things a lot easier.

 gem install xml-simple

Once you have the gems installed, these are the parameters you got to watch out for

The end point for Sandbox is

https://svcs.sandbox.paypal.com/AdaptiveAccounts/GetVerifiedStatus

And the production end point is

https://svcs.paypal.com/AdaptiveAccounts/GetVerifiedStatus

The entire code. Here you go!

def verify_paypal
   #include the gems needed
    require 'httpclient'
    require 'xmlsimple'
   #set the header of the request
    header =  {"X-PAYPAL-SECURITY-USERID" => "tok261_biz_api.abc.com",
               "X-PAYPAL-SECURITY-PASSWORD" => "1244612379",
               "X-PAYPAL-SECURITY-SIGNATURE" => "lkfg9groingghb4uw5",
               "X-PAYPAL-REQUEST-DATA-FORMAT" => "NV",
               "X-PAYPAL-RESPONSE-DATA-FORMAT" => "XML",
               "X-PAYPAL-APPLICATION-ID" =>  "APP-80W284485P519543T"
                }
    #data to be sent in the request
    data = {"emailAddress" => params[:paypal],
           "firstName"=> current_user.first_name,
           "lastName" => current_user.last_name,
           "matchCriteria"=> "NAME",
           "requestEnvelope.errorLanguage" => "en_US"}
    #initialize the request
    clnt = HTTPClient.new
    #API end point(sandbox)
    uri = "https://svcs.sandbox.paypal.com/AdaptiveAccounts/GetVerifiedStatus"
    #make the post
    res = clnt.post(uri, data, header)
   #if the request is successfull parse the XML
   if res.status == 200
     @xml = XmlSimple.xml_in(res.content)
     #check if the status node exists in the xml
     if @xml['accountStatus']!=nil
       account_status = @xml['accountStatus'][0]
       #its pretty obvious from here init?
         if account_status.to_s() == "VERIFIED"
            render :text => "Account verified"
        else
            render :text => "Oopsy! Yet to be verified"
        end

    else
       render :text => "Gee! sorry! something went seriously wrong"
    end

  end

 end

Breaking it down. First the request header. PayPal expects the following parameters in the request header

#set the headers of the request
 #X-PAYPAL-SECURITY-USERID = <Your API username>
 #X-PAYPAL-SECURITY-PASSWORD = <Your API password>
 #X-PAYPAL-SECURITY-SIGNATURE = <Your API signature>
 #X-PAYPAL-REQUEST-DATA-FORMAT = NV
 #Please note that for sandbox you can use APP-80W284485P519543T
 # as the X-PAYPAL-APPLICATION-ID
 header =  {"X-PAYPAL-SECURITY-USERID" => "tok261_biz_api.abc.com",
 "X-PAYPAL-SECURITY-PASSWORD" => "1244612379",
 "X-PAYPAL-SECURITY-SIGNATURE" => "lkfg9groingghb4uw5",
 "X-PAYPAL-REQUEST-DATA-FORMAT" => "NV",
 "X-PAYPAL-RESPONSE-DATA-FORMAT" => "XML",
 "X-PAYPAL-APPLICATION-ID" =>  "APP-80W284485P519543T"
 }

In the above snippet if you notice, im sending the data as name value pairs in the request.

"X-PAYPAL-REQUEST-DATA-FORMAT" => "NV"

and consuming the response data in XML format.

"X-PAYPAL-RESPONSE-DATA-FORMAT" => "XML"

Please note that paypal sends and accepts data as NV,XML,JSON

Now comes the data to be sent along the request

data = {"emailAddress" => "vindibly@dibly.net",
 "firstName"=> "vin",
 "lastName" => "dibly",
 "matchCriteria"=> "NAME",
 "requestEnvelope.errorLanguage" => "en_US"}

All the parameters are required for GetVerifiedStatus call. firstName, lastName, matchCriteria. The parameter matchCriteria takes only the value “NAME” as of now and this is case sensitive. The API checks if the account is the name of “vin dibly” in case of our example. If that varies, status is returned as unknown. So we got to make sure the user provides or your system has the right first and last name of the user.

The rest of it

clnt = HTTPClient.new

sandbox url

uri = "https://svcs.sandbox.paypal.com/AdaptiveAccounts/GetVerifiedStatus"

Post the data with the header information to the API

res = clnt.post(uri, data, header)

check if the request is succesfull

if res.status == 200

#now parse the response content(which happens to be a XML in our case)

@xml = XmlSimple.xml_in(res.content)

make sure the node isnt nil and check the status value

 if @xml['accountStatus']!=nil

#yep this is where the status sits
 account_status = @xml['accountStatus'][0]

#you know what to do if its a verified account
 if account_status.to_s() == "VERIFIED"

#do your logic
 render :text => "Account verified"
 else
 render :text => "Oopsy! Yet to be verified"
 end

 else
 render :text => "Gee! sorry! something went seriously wrong"
 end
 end
Posted in Programming | Tagged , , , | 4 Comments

First Salute!

It has been an amazing journey fo r us. We have grown rapidly. From being a solely owned business to becoming a private Ltd company. We wanted to rebrand our website and mark a new milestone for ByteAlly. One of the results of it is our new website!

What on earth do these stick figures with super cool hairdos mean!!??! What it is got to do with web development?. Is There a correlation.  These hairdos resemble that of George Harrison, Bob Marley, Elvis Presley, Tutankhamun (not an hairdo exactly, well sort of). Im sure many of you would have recognized it immediately. Well that’s what we are about. Our fundamental rule works in a simple but effective way, as in building global brands doesn’t require complex features but simple reachable solutions.

You do not need herculean power to see through our most striking features!

Its not often easy to recognize that important factor which makes the biggest impact amongst the target users. That’s where we come into play. We not only write chunks of code and come up with layouts and graphical interfaces, we also help you analyze your competition, understand the market, end users and guide you come up with a business product in the end rather than just a web application. To put it simply we know what it takes to make your end user use your product.

Okay, whats so special about us. Well the answer is simple. We are a small team. So during the pre-project  stages you wont be talking  to a so called ‘Project Manager’ who has no clue what ‘PHP’ or ‘Ruby Rails’ or a web server is. From beginning to the end, the communication is neat and straight. Its between you and our programmers. You may ask what a programmer might know about business? Well, at ByteAlly we don’t just hire programmers who knows just how to code, we hire people who can understand the business  side of the application they are building, which we believe is the greatest asset of our team. That’s why we are small, we don’t need that extra guy who tries to tell us what you discussed with him during the initial phases and messes it up. That’s why we choose to be small. And that’s exactly why we end up understanding our customer and his product inside out.

Since we use the word ’small’ very  often, it may make you wonder whether we can handle big projects. Only a small tightly knit team can handle complex projects. Infact we are currently working on a monster of a project.  This way we don’t rely on just technology to communicate. Our small environment and development methodology allows us to discuss and debate our work vigorously during production. Makes work a lot more engaging, does it not?

Most of the credit for our rapid growth goes to the OpenSource community. Imagine  a world without PHP or Ruby Rails or Python? We acknowledge their contribution and would love to give back to the community. That we chose as one of our prime agenda when our business venture became a private company. To share what we learn and give away as much as we take from the Open Source community. We are going to do that through our blog space, applications, and presentations. So please do stop by at our blog and our website when you can.

Cheerio!
Keyan,
Web programmer/Managing Director,
ByteAlly Software Solutions Pvt Ltd

Posted in ByteAlly | Tagged | 5 Comments