From ec4cf4dea9c88a7805afb274324ad46a84798c31 Mon Sep 17 00:00:00 2001
From: Will Bradley
+ <%= attr.first.to_s %>:
+ <%= @ipn.attributes[attr.first] %>
+
+ <% if @ipn.payment.present? %>
+ <%= link_to "Payment", @ipn.payment %>
+ <% else %>
+ Couldn't link '<%= @ipn.payer_email %>' or payment amount '<%= @ipn.payment_gross.to_i %>' not a valid membership level. Please create payment manually.
+ <% end %>
+
+
+
diff --git a/app/views/ipns/new.html.erb b/app/views/ipns/new.html.erb
new file mode 100644
index 0000000..3322347
--- /dev/null
+++ b/app/views/ipns/new.html.erb
@@ -0,0 +1,123 @@
+ <%= form_tag('/ipns') do |f| %>
+
+
+
+
+
+ <% @ipns.reverse!.each do |ipn| %>
+ Date
+ Name
+ Item
+ Amount
+
+
+ <% end %>
+ <%= ipn.payment_date %>
+ <%= ipn.first_name %> <%= ipn.last_name %>
+ <%= ipn.item_name %>
+ <%= ipn.payment_gross %>
+
+ <% if ipn.payment.present? %>
+ <%= link_to "Linked Payment", ipn.payment %>
+ <% else %>
+ <%= link_to "Try to link email '#{ipn.payer_email}' at membership level '#{ipn.payment_gross.to_i}'", link_ipn_path(ipn) %>
+ <% end %>
+
+ <%= link_to "Details", ipn %>
+ IPN Details
+
+<% @ipn.attributes.except("data","payment_id").each do |attr| %>
+
<%= f.date_select :date, :default => (DateTime.now - 1.month) %>
+
+ <%= f.number_field :amount %>
+
User
Paid for month
+
beginningAmount
@@ -15,6 +16,7 @@
diff --git a/app/views/payments/show.html.erb b/app/views/payments/show.html.erb
index 59906ce..c735823 100644
--- a/app/views/payments/show.html.erb
+++ b/app/views/payments/show.html.erb
@@ -8,9 +8,19 @@
<%= @payment.date %>
<%= link_to payment.user.name_with_payee_and_member_level, payment.user unless payment.user.blank? %>
<%= payment.human_date %>
+ <%= payment.amount %>
<%= link_to 'Details', payment %>
<%= link_to 'Edit', edit_payment_path(payment) %>
+ Amount: + <%= @payment.amount %> +
+Last Modified by: - <%= user = @users.find{|u| u.id == @payment.created_by}; link_to user.name, user unless user.blank? %> + <% user = @users.find{|u| u.id == @payment.created_by} %> + <% if user.blank? %> + n/a + <% else %> + <%= link_to user.name, user %> + <% end %>
@@ -23,6 +33,13 @@ <%= @payment.updated_at %>
+<% if @payment.ipn.present? %> ++ <%= link_to "Paid via PayPal", @payment.ipn %> +
+<% end %> + + <%= link_to 'Edit', edit_payment_path(@payment) %> | <%= link_to 'Destroy', @payment, :confirm => 'Are you sure you want to destroy this payment?', :method => :delete if can? :destroy, @payment %> | diff --git a/config/routes.rb b/config/routes.rb index 518a30a..6c64774 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,6 @@ Dooraccess::Application.routes.draw do + resources :ipns + match 'ipns/:id/link' => 'ipns#link', :as => :link_ipn resources :payments diff --git a/db/migrate/20130824062334_create_ipns.rb b/db/migrate/20130824062334_create_ipns.rb new file mode 100644 index 0000000..fad43b4 --- /dev/null +++ b/db/migrate/20130824062334_create_ipns.rb @@ -0,0 +1,24 @@ +class CreateIpns < ActiveRecord::Migration + def change + create_table :ipns do |t| + t.integer :payment_id + t.text :data + t.string :txn_id + t.string :txn_type + t.string :first_name + t.string :last_name + t.string :payer_business_name + t.string :payer_email + t.string :payer_id + t.string :auth_amount + t.string :payment_date + t.string :payment_fee + t.string :payment_gross + t.string :payment_status + t.string :item_name + t.string :payment_type + + t.timestamps + end + end +end diff --git a/db/migrate/20130824072157_add_amount_to_payments.rb b/db/migrate/20130824072157_add_amount_to_payments.rb new file mode 100644 index 0000000..37b65e6 --- /dev/null +++ b/db/migrate/20130824072157_add_amount_to_payments.rb @@ -0,0 +1,5 @@ +class AddAmountToPayments < ActiveRecord::Migration + def change + add_column :payments, :amount, :decimal + end +end diff --git a/db/schema.rb b/db/schema.rb index 19fced1..915b9a5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -10,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130212083412) do +ActiveRecord::Schema.define(:version => 20130824072157) do create_table "cards", :force => true do |t| t.string "card_number" @@ -35,6 +36,27 @@ ActiveRecord::Schema.define(:version => 20130212083412) do t.datetime "updated_at", :null => false end + create_table "ipns", :force => true do |t| + t.integer "payment_id" + t.text "data" + t.string "txn_id" + t.string "txn_type" + t.string "first_name" + t.string "last_name" + t.string "payer_business_name" + t.string "payer_email" + t.string "payer_id" + t.string "auth_amount" + t.string "payment_date" + t.string "payment_fee" + t.string "payment_gross" + t.string "payment_status" + t.string "item_name" + t.string "payment_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "mac_logs", :force => true do |t| t.string "mac" t.string "ip" @@ -64,6 +86,7 @@ ActiveRecord::Schema.define(:version => 20130212083412) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "created_by" + t.decimal "amount" end add_index "payments", ["user_id"], :name => "index_payments_on_user_id" diff --git a/test/fixtures/ipns.yml b/test/fixtures/ipns.yml new file mode 100644 index 0000000..6d2f6e4 --- /dev/null +++ b/test/fixtures/ipns.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + data: MyText + +two: + data: MyText diff --git a/test/functional/ipn_controller_test.rb b/test/functional/ipn_controller_test.rb new file mode 100644 index 0000000..0d5ac04 --- /dev/null +++ b/test/functional/ipn_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class IpnControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/ipn_helper_test.rb b/test/unit/helpers/ipn_helper_test.rb new file mode 100644 index 0000000..be0cbae --- /dev/null +++ b/test/unit/helpers/ipn_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class IpnHelperTest < ActionView::TestCase +end diff --git a/test/unit/ipn_test.rb b/test/unit/ipn_test.rb new file mode 100644 index 0000000..fbdc7fa --- /dev/null +++ b/test/unit/ipn_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class IpnTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From eb782f11d52d9c9e8db7442e5c7063f71fef6eda Mon Sep 17 00:00:00 2001 From: Will BradleyUser: - <%= @payment.user.name_with_payee_and_member_level unless @payment.user.blank? %> + <%= link_to @payment.user.name_with_payee_and_member_level, @payment.user unless @payment.user.blank? %>
diff --git a/config/routes.rb b/config/routes.rb
index 6c64774..4a4f563 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,7 @@
Dooraccess::Application.routes.draw do
resources :ipns
match 'ipns/:id/link' => 'ipns#link', :as => :link_ipn
+ match 'ipns/:id/validate' => 'ipns#validate', :as => :validate_ipn
resources :payments
From f111769b20a263d0942924f90df1d342a0e17fdf Mon Sep 17 00:00:00 2001
From: Will Bradley Px#24YJ`L;(2!n*a<%my&4!000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iyo6
z2{SA4`Yka400I?BL_t(I%bk-!Y>QzS$A9nlwf)-lvo1wxn4-b5M35!TC>G%$IP}0A
zwy={(c32RJ*ogxXM~SG$iHo>lmrW)SVTltF*+>nsh?S|9eqFWS
+ Certified Users:
+ <%= link_to "Click Here", user_certifications_path %>
+
User:
- <%= @user_certification.user.name %>
+ <%= link_to @user_certification.user.name, @user_certification.user %>
From 18bc427eb3dc578756d0980866a84925ad196945 Mon Sep 17 00:00:00 2001
From: Will Bradley
diff --git a/public/copper-coin.png b/public/copper-coin.png
new file mode 100644
index 0000000000000000000000000000000000000000..809bbbb0a7a45f9c7b754fd8bfb4fcab48c145ad
GIT binary patch
literal 1317
zcmV+=1={+FP)
- <% @certification_users.each do |user| %>
-
+
- Card: + Card:<%= link_to "+ Add", (new_card_path+"?user="+@user.id.to_s), :class => 'btn' if can? :create, Card %> <% if current_user.admin? then %> <% @user.cards.each do |c| %> <%= link_to c.card_number, c %><%= "," unless c == @user.cards.last %> @@ -84,7 +84,7 @@ <% end %>
-Certifications: +Certifications:<%= link_to "+ Add", (new_user_certification_path+"?user="+@user.id.to_s), :class => 'btn' if can? :create, UserCertification %>