killbill-paypal-express 5.0.14 → 5.0.15

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 +24 -22
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f986a90b244426935eaf2dc513c48f6a27c6b8f
4
- data.tar.gz: 348e81e5bdef89834a83b811c96521e42ae70ed2
3
+ metadata.gz: 94d76dc9e50ed47e45f0d06f190f34779df7a42e
4
+ data.tar.gz: cbf2a9ded0e14f69741e1a78e82d30d532234be5
5
5
  SHA512:
6
- metadata.gz: d9af7a1ceb33f2154b1747b9f0104d53c4b42dc802a43827e621224cd9a4140e430b75232a7e35610908747b70f6e85384e7e9f8484be2e78a53fe829982adb5
7
- data.tar.gz: f62ec07a6d4350c2bcadfcdb855f0006fb61428079c818a3b8706eb787b74f9db30bbfadb0279a6c7467609a23d08037dc3b90559d2160eacac80e98295a6846
6
+ metadata.gz: bfae427c8064df1985796fbbfeb71d89458ec295f616a2dbce13126237619b0a6eaf0b557482241e0ad9164aa76baeeb890b2435b343175fe3a1938e0f0d0955
7
+ data.tar.gz: da9ce852cbc8139824b15a19318948600edb7921f5047b42b9130e229f8a51b124783c37b13492d6199ec2485488f1bc5b558e4647ddb7e60ec9eae131d9887f
@@ -382,22 +382,9 @@ module Killbill #:nodoc:
382
382
  # Find the payment_processor_id if not provided
383
383
  payment_processor_account_id ||= find_payment_processor_id_from_initial_call(kb_account_id, context.tenant_id, options[:token])
384
384
  options[:payment_processor_account_id] = payment_processor_account_id
385
+ options[:payer_id] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :payer_id)
385
386
 
386
- # We have a baid on file
387
- if options[:reference_id]
388
- if is_authorize
389
- gateway_call_proc = Proc.new do |gateway, linked_transaction, payment_source, amount_in_cents, options|
390
- # Can't use default implementation: the purchase signature is for one-off payments only
391
- gateway.authorize_reference_transaction(amount_in_cents, options)
392
- end
393
- else
394
- gateway_call_proc = Proc.new do |gateway, linked_transaction, payment_source, amount_in_cents, options|
395
- # Can't use default implementation: the purchase signature is for one-off payments only
396
- gateway.reference_transaction(amount_in_cents, options)
397
- end
398
- end
399
- else
400
- # One-off payment
387
+ if options.has_key?(:token)
401
388
  # Retrieve payer_id and payer_email
402
389
  begin
403
390
  payer_info = get_payer_info(options[:token],
@@ -423,12 +410,27 @@ module Killbill #:nodoc:
423
410
  :message => { :payment_plugin_status => :CANCELED, :exception_class => e.class.to_s, :exception_message => e.message }.to_json)
424
411
  return response.to_transaction_info_plugin(nil)
425
412
  end
426
- options[:payer_id] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :payer_id)
427
413
  if options[:payer_id].nil?
428
414
  options[:payer_id] = payer_info.payer_id
429
415
  end
430
416
  options[:payer_email] = payer_info.payer_email
417
+ end
431
418
 
419
+ # We have a baid on file
420
+ if options[:reference_id]
421
+ if is_authorize
422
+ gateway_call_proc = Proc.new do |gateway, linked_transaction, payment_source, amount_in_cents, options|
423
+ # Can't use default implementation: the purchase signature is for one-off payments only
424
+ gateway.authorize_reference_transaction(amount_in_cents, options)
425
+ end
426
+ else
427
+ gateway_call_proc = Proc.new do |gateway, linked_transaction, payment_source, amount_in_cents, options|
428
+ # Can't use default implementation: the purchase signature is for one-off payments only
429
+ gateway.reference_transaction(amount_in_cents, options)
430
+ end
431
+ end
432
+ else
433
+ # One-off payment
432
434
  if is_authorize
433
435
  gateway_call_proc = Proc.new do |gateway, linked_transaction, payment_source, amount_in_cents, options|
434
436
  gateway.authorize(amount_in_cents, options)
@@ -640,20 +642,20 @@ module Killbill #:nodoc:
640
642
 
641
643
  # Filter out the pending transaction if there is already a response tied with the same transaction but indicating a final state
642
644
  t_info_plugins_without_pending = t_info_plugins.reject { |t_info_plugin| target_transaction_types.include?(t_info_plugin.transaction_type) && t_info_plugin.status == :PENDING }
643
- [with_only_pending_trx ? t_info_plugins : t_info_plugins_without_pending, t_info_plugins, with_only_pending_trx]
645
+ result = [with_only_pending_trx ? t_info_plugins : t_info_plugins_without_pending, t_info_plugins, with_only_pending_trx]
646
+ result
644
647
  end
645
648
 
646
649
  def merge_selected_properties_from_details_call(plugin_infos, to_merge_plugin_info, merge_properties)
647
650
  unless to_merge_plugin_info.nil?
648
- matched_trx_plugin_info = plugin_infos.detect {|info| info.kb_transaction_payment_id == to_merge_plugin_info.kb_transaction_payment_id}
649
- unless matched_trx_plugin_info.nil?
651
+ plugin_infos.each do |trx_plugin_info|
650
652
  merge_properties.each do |p|
651
653
  p_value = find_value_from_properties(to_merge_plugin_info.properties, p)
652
654
  unless p_value.blank?
653
- if matched_trx_plugin_info.properties.detect {|mp| mp.key.to_s == p.to_s}.nil?
654
- matched_trx_plugin_info.properties << create_plugin_property(p.to_s, p_value)
655
+ if trx_plugin_info.properties.detect {|mp| mp.key.to_s == p.to_s}.nil?
656
+ trx_plugin_info.properties << create_plugin_property(p.to_s, p_value)
655
657
  else
656
- matched_trx_plugin_info.properties.detect {|mp| mp.key.to_s == p.to_s} .value = p_value
658
+ trx_plugin_info.properties.detect {|mp| mp.key.to_s == p.to_s} .value = p_value
657
659
  end
658
660
  end
659
661
  end
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.14
4
+ version: 5.0.15
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-07-08 00:00:00.000000000 Z
11
+ date: 2019-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement