poundpay 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mkd +61 -0
- data/examples/simple_application/config.rb +2 -2
- data/lib/poundpay/elements.rb +3 -1
- data/lib/poundpay/version.rb +1 -1
- data/spec/poundpay/elements_spec.rb +4 -6
- data/spec/poundpay_spec.rb +3 -6
- metadata +4 -4
- data/README +0 -0
data/README.mkd
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
Poundpay
|
2
|
+
========
|
3
|
+
|
4
|
+
|
5
|
+
Install
|
6
|
+
-------
|
7
|
+
gem install poundpay
|
8
|
+
|
9
|
+
|
10
|
+
Configure
|
11
|
+
---------
|
12
|
+
Poundpay.configure(
|
13
|
+
"developer_sid",
|
14
|
+
"auth_token",
|
15
|
+
api_url = "https://api-sandbox.poundpay.com", # Note: Leave out for production
|
16
|
+
)
|
17
|
+
|
18
|
+
|
19
|
+
Creating a payment
|
20
|
+
------------------
|
21
|
+
require 'poundpay'
|
22
|
+
|
23
|
+
payment = Poundpay::Payment.create(
|
24
|
+
:amount => 20000,
|
25
|
+
:payer_fee_amount => 0,
|
26
|
+
:payer_email_address => "fred@example.com",
|
27
|
+
:recipient_fee_amount => 500,
|
28
|
+
:recipient_email_address => "david@example.com",
|
29
|
+
:description => "Beats by Dr. Dre",
|
30
|
+
)
|
31
|
+
|
32
|
+
Serving iframe
|
33
|
+
---------------
|
34
|
+
<script src="https://www.poundpay.com/js/poundpay.js"></script>
|
35
|
+
|
36
|
+
<div id="pound-root"></div>
|
37
|
+
|
38
|
+
<script>
|
39
|
+
function handlePaymentSuccess() {
|
40
|
+
// do something
|
41
|
+
}
|
42
|
+
|
43
|
+
function handlePaymentError() {
|
44
|
+
// handle error
|
45
|
+
}
|
46
|
+
|
47
|
+
PoundPay.init({
|
48
|
+
payment_sid: <%= payment.sid %>,
|
49
|
+
success: handlePaymentSuccess,
|
50
|
+
error: handlePaymentError,
|
51
|
+
cardholder_name: 'Fred Nietzsche', // note: optional
|
52
|
+
phone_number: '4085551234', // note: optional
|
53
|
+
server: 'https://www-sandbox.poundpay.com' // note: exclude this property when in production
|
54
|
+
});
|
55
|
+
</script>
|
56
|
+
|
57
|
+
|
58
|
+
Releasing a payment
|
59
|
+
------------------
|
60
|
+
payment.release
|
61
|
+
payment.save!
|
@@ -4,8 +4,8 @@ class SimpleApplication
|
|
4
4
|
api_url: "https://api-sandbox.poundpay.com",
|
5
5
|
www_url: "https://www-sandbox.poundpay.com",
|
6
6
|
version: "silver",
|
7
|
-
sid: "
|
8
|
-
token: "
|
7
|
+
sid: "DVxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
8
|
+
token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
9
9
|
}
|
10
10
|
}
|
11
11
|
end
|
data/lib/poundpay/elements.rb
CHANGED
@@ -15,7 +15,9 @@ module Poundpay
|
|
15
15
|
unless status == 'ESCROWED'
|
16
16
|
raise PaymentReleaseException.new "Payment status is #{status}. Only ESCROWED payments may be released"
|
17
17
|
end
|
18
|
-
status
|
18
|
+
# Tried setting status with status=, but save still had status == 'ESCROWED'.
|
19
|
+
# Setting the status through the attributes, however, does work.
|
20
|
+
attributes['status'] = 'RELEASED'
|
19
21
|
save
|
20
22
|
end
|
21
23
|
end
|
data/lib/poundpay/version.rb
CHANGED
@@ -11,8 +11,7 @@ describe Developer do
|
|
11
11
|
before (:all) do
|
12
12
|
Poundpay.configure(
|
13
13
|
"DV0383d447360511e0bbac00264a09ff3c",
|
14
|
-
"c31155b9f944d7aed204bdb2a253fef13b4fdcc6ae1540200449cc4526b2381a"
|
15
|
-
)
|
14
|
+
"c31155b9f944d7aed204bdb2a253fef13b4fdcc6ae1540200449cc4526b2381a")
|
16
15
|
end
|
17
16
|
|
18
17
|
describe "#me" do
|
@@ -29,8 +28,7 @@ describe Payment do
|
|
29
28
|
before (:all) do
|
30
29
|
Poundpay.configure(
|
31
30
|
"DV0383d447360511e0bbac00264a09ff3c",
|
32
|
-
"c31155b9f944d7aed204bdb2a253fef13b4fdcc6ae1540200449cc4526b2381a"
|
33
|
-
)
|
31
|
+
"c31155b9f944d7aed204bdb2a253fef13b4fdcc6ae1540200449cc4526b2381a")
|
34
32
|
end
|
35
33
|
|
36
34
|
describe "#release" do
|
@@ -39,12 +37,12 @@ describe Payment do
|
|
39
37
|
expect {@created_payment.release}.to raise_error(PaymentReleaseException)
|
40
38
|
end
|
41
39
|
|
42
|
-
it "should release
|
40
|
+
it "should release an ESCROWED payment" do
|
43
41
|
@escrowed_payment = Payment.new escrowed_payment_attributes
|
44
42
|
@escrowed_payment.should_receive(:save).and_return(Payment.new released_payment_attributes)
|
45
43
|
|
46
44
|
@escrowed_payment.release
|
47
|
-
@escrowed_payment.status.should == '
|
45
|
+
@escrowed_payment.status.should == 'RELEASED'
|
48
46
|
end
|
49
47
|
end
|
50
48
|
end
|
data/spec/poundpay_spec.rb
CHANGED
@@ -6,8 +6,7 @@ describe Poundpay, ".configure" do
|
|
6
6
|
# Pass developer_sid and auth_token in wrong order
|
7
7
|
Poundpay.configure(
|
8
8
|
"c31155b9f944d7aed204bdb2a253fef13b4fdcc6ae1540200449cc4526b2381a",
|
9
|
-
"DV0383d447360511e0bbac00264a09ff3c"
|
10
|
-
)
|
9
|
+
"DV0383d447360511e0bbac00264a09ff3c")
|
11
10
|
}.to raise_error(ArgumentError, /DV/)
|
12
11
|
end
|
13
12
|
|
@@ -25,8 +24,7 @@ describe Poundpay, ".configure" do
|
|
25
24
|
"DV0383d447360511e0bbac00264a09ff3c",
|
26
25
|
"c31155b9f944d7aed204bdb2a253fef13b4fdcc6ae1540200449cc4526b2381a",
|
27
26
|
api_url="https://api-sandbox.poundpay.com",
|
28
|
-
version="gold"
|
29
|
-
)
|
27
|
+
version="gold")
|
30
28
|
Poundpay::Resource.site.to_s.should == "https://api-sandbox.poundpay.com/gold/"
|
31
29
|
end
|
32
30
|
|
@@ -35,8 +33,7 @@ describe Poundpay, ".configure" do
|
|
35
33
|
"DV0383d447360511e0bbac00264a09ff3c",
|
36
34
|
"c31155b9f944d7aed204bdb2a253fef13b4fdcc6ae1540200449cc4526b2381a",
|
37
35
|
api_url="https://api-sandbox.poundpay.com/",
|
38
|
-
version="gold"
|
39
|
-
)
|
36
|
+
version="gold")
|
40
37
|
Poundpay::Resource.site.to_s.should == "https://api-sandbox.poundpay.com/gold/"
|
41
38
|
end
|
42
39
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matin Tamizi
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02-
|
17
|
+
date: 2011-02-14 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -59,7 +59,7 @@ files:
|
|
59
59
|
- .rspec
|
60
60
|
- .rvmrc
|
61
61
|
- Gemfile
|
62
|
-
- README
|
62
|
+
- README.mkd
|
63
63
|
- Rakefile
|
64
64
|
- examples/simple_application/.gems
|
65
65
|
- examples/simple_application/.rvmrc
|
data/README
DELETED
File without changes
|