killbill-litle 1.9.4 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -27,9 +27,6 @@ Gemfile.lock
27
27
  # Build directory
28
28
  killbill-litle/
29
29
 
30
- # Config file
31
- litle.yml
32
-
33
30
  # Testing database
34
31
  test.db
35
32
 
data/NEWS CHANGED
@@ -1,3 +1,6 @@
1
+ 1.9.5
2
+ Bug fixes for currency transaformation
3
+
1
4
  1.9.4
2
5
  Fix bugs in payment/refunds introduced during currency conversion
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.4
1
+ 1.9.5
data/lib/litle/api.rb CHANGED
@@ -57,14 +57,14 @@ module Killbill::Litle
57
57
  def process_refund(kb_account_id, kb_payment_id, amount, currency, call_context = nil, options = {})
58
58
  amount_in_cents = (amount * 100).to_i
59
59
 
60
- litle_transaction = LitleTransaction.find_candidate_transaction_for_refund(kb_payment_id, amount_in_cents)
61
-
62
- # Set a default report group
63
- options[:merchant] ||= report_group_for_currency(currency)
64
-
65
60
  # Check for currency conversion
66
61
  actual_amount, actual_currency = convert_amount_currency_if_required(amount_in_cents, currency, kb_payment_id)
67
62
 
63
+ litle_transaction = LitleTransaction.find_candidate_transaction_for_refund(kb_payment_id, actual_amount)
64
+
65
+ # Set a default report group
66
+ options[:merchant] ||= report_group_for_currency(actual_currency)
67
+
68
68
  # Go to Litle
69
69
  gateway = Killbill::Litle.gateway_for_currency(actual_currency)
70
70
  litle_response = gateway.credit actual_amount, litle_transaction.litle_txn_id, options
@@ -178,15 +178,15 @@ module Killbill::Litle
178
178
 
179
179
  kb_payment = @kb_apis.payment_api.get_payment(kb_payment_id, false, @kb_apis.create_context)
180
180
 
181
- currency_conversion = @kb_apis.currency_conversion_api.get_currency_conversion(input_currency, kb_payment.effective_date)
181
+ currency_conversion = @kb_apis.currency_conversion_api.get_currency_conversion(converted_currency, kb_payment.effective_date)
182
182
  rates = currency_conversion.rates
183
183
  found = rates.select do |r|
184
- r.currency.to_s.upcase.to_sym == converted_currency.to_s.upcase.to_sym
184
+ r.currency.to_s.upcase.to_sym == input_currency.to_s.upcase.to_sym
185
185
  end
186
186
 
187
187
  if found.nil? || found.empty?
188
188
  @logger.warn "Failed to find converted currency #{converted_currency} for input currency #{input_currency}"
189
- return [input_amount, input_currency] if converted_currency.nil?
189
+ return [input_amount, input_currency]
190
190
  end
191
191
 
192
192
  # conversion rounding ?
@@ -209,8 +209,9 @@ module Killbill::Litle
209
209
 
210
210
  def account_currency(kb_account_id)
211
211
  account = @kb_apis.account_user_api.get_account_by_id(kb_account_id, @kb_apis.create_context)
212
- converted_currency = Killbill::Litle.converted_currency(account.currency)
213
- converted_currency
212
+ #Killbill::Litle.converted_currency(account.currency)
213
+ # Use original currency on the account when creating the payment method
214
+ account.currency
214
215
  end
215
216
 
216
217
  def report_group_for_currency(currency)
@@ -89,7 +89,7 @@ module Killbill::Litle
89
89
  def to_killbill_response(type)
90
90
  if litle_transaction.nil?
91
91
  amount_in_cents = nil
92
- currency = nill
92
+ currency = nil
93
93
  created_date = created_at
94
94
  first_payment_reference_id = nil
95
95
  second_payment_reference_id = nil
data/litle.yml ADDED
@@ -0,0 +1,16 @@
1
+ :litle:
2
+ :test: True
3
+ :log_file: /var/tmp/litle.log
4
+ :username: YOYO
5
+ :password: certFoo
6
+ :merchant_id:
7
+ :USD: '064400'
8
+ :EUR: '064401'
9
+
10
+ :database:
11
+ :adapter: sqlite3
12
+ :database: test.db
13
+
14
+ :currency_conversions:
15
+ :BRL: 'USD'
16
+
data/pom.xml CHANGED
@@ -25,7 +25,7 @@
25
25
  <groupId>com.ning.killbill.ruby</groupId>
26
26
  <artifactId>litle-plugin</artifactId>
27
27
  <packaging>pom</packaging>
28
- <version>1.9.4</version>
28
+ <version>1.9.5</version>
29
29
  <name>litle-plugin</name>
30
30
  <url>http://github.com/killbill/killbill-litle-plugin</url>
31
31
  <description>Plugin for accessing Litle as a payment gateway</description>
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: killbill-litle
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.9.4
5
+ version: 1.9.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kill Bill core team
@@ -234,6 +234,7 @@ files:
234
234
  - lib/litle/models/litle_transaction.rb
235
235
  - lib/litle/private_api.rb
236
236
  - lib/litle/views/paypage.erb
237
+ - litle.yml
237
238
  - pom.xml
238
239
  - release.sh
239
240
  - spec/litle/base_plugin_spec.rb