killbill-paypal-express 5.0.12 → 5.0.13

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/paypal_express/api.rb +12 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 662ab636b3f13b408a24cc890c312fecb44891b3
4
- data.tar.gz: b63ab021a6c01b74f901270d2860e74f805a6896
3
+ metadata.gz: 54f8a08d21c46e77b8f4bc4a33e2080d97057d41
4
+ data.tar.gz: e6faa116b3e5e1ac45f03d6724cdef59f6f55344
5
5
  SHA512:
6
- metadata.gz: 29f527bc1e09bea7be85fbd94c796207ad5e7efc63958ce1038e49653f4e7bf1af34df19532011c6a380116eda2fcd6e45521bde75b60016451825489126e355
7
- data.tar.gz: e9508bae17347d501a2ce0bc620a0eae0d095a32f5e5488410c2b3d5d683277f442fef4f83b980148e73e18cf43b5b54f7f05983644baf1c59771c66d1e3328a
6
+ metadata.gz: e9e7263c70a43baa8f56ef151f32b24d8891e8263e82907519119157a9cc590e4178a196fca82f96300b3da509806b73e1b2cb6a27bc38d7dcfe7e096a69dc74
7
+ data.tar.gz: 0d84744e2c50defa9a42f4df2858ac1c75a25aa62fbc1afeb20ca6fecc2591168ac39de33d2b71c3ba50fc80cdae565839340d153369c05716eab9e0623b0b13
@@ -301,16 +301,21 @@ module Killbill #:nodoc:
301
301
  response
302
302
  end
303
303
 
304
- def add_required_options(kb_payment_transaction_id, kb_payment_method_id, context, options)
304
+ def add_default_options(kb_payment_transaction_id, options)
305
+ options[:payment_type] ||= 'Any'
306
+ options[:invoice_id] ||= kb_payment_transaction_id
307
+ options[:ip] ||= @ip
308
+ end
309
+
310
+ def add_payment_method_options(kb_account_id, kb_payment_method_id, context, options, properties_hash)
311
+ options[:token] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :token) || find_last_token(kb_account_id, context.tenant_id)
312
+ options[:reference_id] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :baid)
313
+
305
314
  payment_method = @payment_method_model.from_kb_payment_method_id(kb_payment_method_id, context.tenant_id)
306
315
 
307
316
  options[:payer_id] ||= payment_method.paypal_express_payer_id.presence
308
317
  options[:token] ||= payment_method.paypal_express_token.presence
309
318
  options[:reference_id] ||= payment_method.token.presence # baid
310
-
311
- options[:payment_type] ||= 'Any'
312
- options[:invoice_id] ||= kb_payment_transaction_id
313
- options[:ip] ||= @ip
314
319
  end
315
320
 
316
321
  def initiate_express_checkout(kb_account_id, amount, currency, properties, context)
@@ -371,7 +376,8 @@ module Killbill #:nodoc:
371
376
  transaction
372
377
  else
373
378
  options = {}
374
- add_required_options(kb_payment_transaction_id, kb_payment_method_id, context, options)
379
+ add_default_options(kb_payment_transaction_id, options)
380
+ add_payment_method_options(kb_account_id, kb_payment_method_id, context, options, properties_hash)
375
381
  options[:token] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :token) || find_last_token(kb_account_id, context.tenant_id)
376
382
  # Find the payment_processor_id if not provided
377
383
  payment_processor_account_id ||= find_payment_processor_id_from_initial_call(kb_account_id, context.tenant_id, options[:token])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-paypal-express
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.12
4
+ version: 5.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2019-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement