Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Record email and name from IPN.

  • Loading branch information...
commit 73d1b5aead0f2adf39b37b72189d553f0870ed76 1 parent 02686fe
Hugh Bien authored
Showing with 7 additions and 3 deletions.
  1. +6 −2 lib/boutique.rb
  2. +1 −1  test/model_test.rb
8 lib/boutique.rb
View
@@ -158,6 +158,8 @@ class Purchase
property :counter, Integer, :required => true
property :secret, String, :required => true
property :transaction_id, String
+ property :email, String
+ property :name, String
property :completed_at, DateTime
property :downloads, CommaSeparatedList
@@ -169,8 +171,10 @@ def initialize(attr = {})
super
end
- def complete(txn_id)
+ def complete(txn_id, email, name)
self.transaction_id = txn_id
+ self.email = email
+ self.name = name
self.completed_at = DateTime.now
link_download!
end
@@ -267,7 +271,7 @@ class App < Sinatra::Base
params['txn_id'] &&
params['payment_status'] &&
params['receiver_email'] == Boutique.config.pp_email
- purchase.complete(params[:txn_id])
+ purchase.complete(params['txn_id'], params['payer_email'], params['first_name'])
purchase.save
end
''
2  test/model_test.rb
View
@@ -17,7 +17,7 @@ def test_purchase_create
refute_nil(purchase.secret)
refute(purchase.completed?)
- purchase.complete('1')
+ purchase.complete('1', 'john@mailinator.com', 'John')
purchase.save
assert_equal('1', purchase.transaction_id)
refute_nil(purchase.completed_at)
Please sign in to comment.
Something went wrong with that request. Please try again.