-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pecunix integration should be working
- Loading branch information
David FRANCOIS
committed
Feb 1, 2011
1 parent
7b8f708
commit 59d4648
Showing
14 changed files
with
120 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
<form id="pecunix-sci-form" action="https://pri.pecunix.com/money.refined" method="post"> | ||
<input type="hidden" name="PAYEE_ACCOUNT" value="<%= config["account"] %>" /> | ||
<input name="PAYMENT_AMOUNT" value="" /> | ||
<input name="PAYMENT_AMOUNT" value="<%= amount %>" /> | ||
|
||
<input type="hidden" name="PAYMENT_URL" value="<%= config["payment_url"] %>" /> | ||
<input type="hidden" name="PAYMENT_URL_METHOD" value="POST" /> | ||
|
||
<input type="hidden" name="NOPAYMENT_URL" value="<%= config["no_payment_url"] %>" /> | ||
<input type="hidden" name="NOPAYMENT_URL_METHOD" value="POST" /> | ||
<input type="hidden" name="NOPAYMENT_URL_METHOD" value="GET" /> | ||
|
||
<input type="hidden" name="STATUS_URL" value="<%= config["status_url"] %>" /> | ||
<input type="hidden" name="STATUS_TYPE" value="FORM" /> | ||
|
||
<input type="hidden" name="INPUT_HASH" value="F9834F5C15191E9DDF60CA783682E3D030E7F23F" /> | ||
|
||
<input type="hidden" name="INPUT_HASH" value="<%= hash %>" /> | ||
|
||
<input type="hidden" name="PAYMENT_UNITS" value="GAU" /> | ||
<input type="hidden" name="WHO_PAYS_FEES" value="PAYER" /> | ||
<input type="hidden" name="PAYMENT_ID" value="" /> | ||
<input type="hidden" name="PAYMENT_ID" value="<%= payment_id %>" /> | ||
|
||
<input type="hidden" name="SUGGESTED_MEMO" value="MEMO" /> | ||
<input type="hidden" name="SUGGESTED_MEMO" value="Transfer funds to account <%= @current_user.account %>" /> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
$("div#pecunix-sci-form-container").html("<%= escape_javascript(render(:partial => "transfers/px_sci_form.html", :locals => { :config => @pecunix_config })).html_safe %>"); | ||
$("div#pecunix-sci-form-container").html("<%= escape_javascript(render(:partial => "transfers/px_sci_form.html", :locals => { :config => @config, :hash => @hash, :amount => @amount, :payment_id => @payment_id })).html_safe %>"); | ||
$("#pecunix-sci-form").submit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class AddPecunixFields < ActiveRecord::Migration | ||
def self.up | ||
add_column :transfers, :px_tx_id, :string | ||
add_column :transfers, :px_payer, :string | ||
end | ||
|
||
def self.down | ||
remove_column :transfers, :px_tx_id | ||
remove_column :transfers, :px_payer | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'test_helper' | ||
|
||
class ThirdPartyCallbacksControllerTest < ActionController::TestCase | ||
test "should create a pecunix deposit if nicely asked" do | ||
params = { | ||
"PAYEE_ACCOUNT" => "support@bitcoin-central.net", | ||
"PAYMENT_AMOUNT" => "1000.00", | ||
"PAYMENT_UNITS" => "GAU", | ||
"PAYMENT_REC_ID" => "000014568", | ||
"PAYER_ACCOUNT" => "customer@gold-cart.com", | ||
"PAYMENT_HASH" => "EC764D0A216D875269B24003C48297037583BA1A", | ||
"PAYMENT_GRAMS" => "1000.0000", | ||
"PAYMENT_ID" => users(:trader1).id.to_s, | ||
"PAYMENT_FEE" => "0.0002", | ||
"TXN_DATETIME" => "2002-04-10 10:14:54", | ||
"SUGGESTED_MEMO" => "Payment Bitcoin Central", | ||
} | ||
|
||
assert !Transfer.find_by_px_tx_id("000014568") | ||
assert users(:trader1).balance(:pgau).zero? | ||
|
||
assert_difference "Transfer.count" do | ||
post :px_status, params | ||
assert_response :success | ||
end | ||
|
||
# Posting the same data a second time should not result in any transfer | ||
# being created | ||
assert_no_difference "Transfer.count" do | ||
post :px_status, params | ||
assert_response :success | ||
end | ||
|
||
assert_equal 1000.0, users(:trader1).balance(:pgau) | ||
assert Transfer.find_by_px_tx_id("000014568") | ||
assert Transfer.find_by_px_payer("customer@gold-cart.com") | ||
end | ||
end |