Permalink
Browse files

updates

  • Loading branch information...
1 parent 4e62e8c commit d86bc98fa43a34075da6cb68349174a190ee5a13 @akshayrawat committed Jan 28, 2012
Showing with 9 additions and 6 deletions.
  1. +1 −1 Gemfile
  2. +2 −0 Gemfile.lock
  3. +5 −4 app/models/inr_to_usd.rb
  4. +1 −1 app/views/payments/new.html.haml
View
2 Gemfile
@@ -6,7 +6,7 @@ gem 'simple_form'
gem 'haml'
gem 'httparty'
gem 'sqlite3'
-gem 'yajl'
+gem 'yajl-ruby'
group :production do
gem 'pg'
View
2 Gemfile.lock
@@ -99,6 +99,7 @@ GEM
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.31)
+ yajl-ruby (1.1.0)
PLATFORMS
ruby
@@ -112,3 +113,4 @@ DEPENDENCIES
sqlite3
stripe
thin
+ yajl-ruby
View
9 app/models/inr_to_usd.rb
@@ -2,12 +2,13 @@ class INRToUSD
include HTTParty
base_uri "openexchangerates.org"
- def self.to_usd inr
- (@amount / current_rate).ceil
+ def self.to_usd amount_in_paisa
+ puts "Current rate: #{current_rate}"
+ ((amount_in_paisa.to_i * 100) / current_rate).ceil
end
def self.current_rate
- response = self.class.get "/latest.json"
- (response.parsed_response['rates']['INR'] * 10_000_000).to_i
+ response = self.get "/latest.json"
+ response.parsed_response['rates']['INR'] * 100
end
end
View
2 app/views/payments/new.html.haml
@@ -26,7 +26,7 @@
:javascript
$(function(){
$('a.prefill').click(function(){
- $('#payment_amount').val('200');
+ $('#payment_amount').val('3000');
$('#payment_card_name, #payment_card_address_line1, #payment_card_address_line2, #payment_card_address_state, #payment_card_address_country').val('foobar');
$('#payment_card_exp_year, #payment_card_address_zip').val("2020");
$('#payment_card_exp_month').val("12");

0 comments on commit d86bc98

Please sign in to comment.