liberty_reserve_payments 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.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # LibertyReservePayments
2
2
 
3
3
  Receive payments via Liberty Reserve. With this gem the user of your shop
4
- can pay for a digital item (or any type of item) and validate the transaction
4
+ can pay for a digital item (or any type of item) and you can validate the transaction
5
5
  after it was made.
6
6
 
7
7
  ## Installation
@@ -64,8 +64,14 @@ looking like this:
64
64
  def validate_payment
65
65
  handler = LibertyReservePayments::Handler.new LIBERTY_CONFIG
66
66
  if handler.valid?(params)
67
+ order = Order.find(params[:order_id]
67
68
  # The transaction has been validated. You can perform your own
68
- # validations now
69
+ # validations now. You should specifically validate the amount that was paid.
70
+ if order.amount == params[:lr_amnt]
71
+ # Amount matches, you can proceed
72
+ else
73
+ # Log the transaction and inspect it later
74
+ end
69
75
  else
70
76
  # The transaction has been tampered with, you should log it for
71
77
  # later verification.
@@ -9,10 +9,10 @@ module LibertyReservePayments
9
9
  super
10
10
  end
11
11
 
12
- def payment_request_uri(amount, currency = 'LRUSD', comments = '', order_id = '', item_name = '')
12
+ def payment_request_uri(amount, currency, order_id, item_name)
13
13
  endpoint = URI.parse ENDPOINT
14
14
  @query = {lr_acc: self.account_number, lr_store: self.store_name, lr_amnt: amount,
15
- lr_currency: currency, lr_comments: comments, lr_merchant_ref: "OID_#{order_id}",
15
+ lr_currency: currency, lr_merchant_ref: order_id,
16
16
  item_name: item_name, order_id: order_id}
17
17
  endpoint.query = @query.to_query
18
18
  endpoint.to_s
@@ -1,3 +1,3 @@
1
1
  module LibertyReservePayments
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liberty_reserve_payments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-18 00:00:00.000000000 Z
12
+ date: 2013-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec-rails