killbill-paypal-express 5.0.5 → 5.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/paypal_express/api.rb +33 -31
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 012520da60a1d9f2a9c19fd182e5e97318bce8bb
4
- data.tar.gz: c9c708a6547c8cce3c282a2812d1a086ddbca036
3
+ metadata.gz: 139032a64440a821aa18d1c0318b2dc5e4ea11ae
4
+ data.tar.gz: 8fbea55f5942536f77a62844ca37c7587f79c0a4
5
5
  SHA512:
6
- metadata.gz: bdd74bad1a6606a85e21e26ad8ab740031ea1bce343542734461abb1e054302e96804948cf6ea939a598b6b09343bb293ecfd3f9da87613a7ab032c4c0e30400
7
- data.tar.gz: ce8f24705bc1e185bdb4fbc6add4eb3b0c728fa41ff7328876741b199486659729111d8e1002ec8da290c9d5f3bc533738747c8cd0f2da3d9c9238885de57fdd
6
+ metadata.gz: 720423a7ebac4b0c91159520b3b8ba213418c9624ed8ccf012bc5dd801347b5423ea425879a8120c83ffd866782c45cef721c5103412021b0d370523529f2929
7
+ data.tar.gz: c1c34495e9987498d6c9fc6d6e3f9c34bedcbb4a518632a5df45c6b71e03c8f52ced690c2e05f761e0d128826e728fd2f8a848047d1e53074262a8357023ef04
@@ -370,7 +370,7 @@ module Killbill #:nodoc:
370
370
  add_required_options(kb_payment_transaction_id, kb_payment_method_id, context, options)
371
371
 
372
372
  # We have a baid on file
373
- if options[:token]
373
+ if options[:reference_id]
374
374
  if is_authorize
375
375
  gateway_call_proc = Proc.new do |gateway, linked_transaction, payment_source, amount_in_cents, options|
376
376
  # Can't use default implementation: the purchase signature is for one-off payments only
@@ -385,6 +385,38 @@ module Killbill #:nodoc:
385
385
  else
386
386
  # One-off payment
387
387
  options[:token] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :token) || find_last_token(kb_account_id, context.tenant_id)
388
+
389
+ # Retrieve payer_id and payer_email
390
+ begin
391
+ payer_info = get_payer_info(options[:token],
392
+ kb_account_id,
393
+ context.tenant_id,
394
+ payment_processor_account_id,
395
+ kb_payment_id,
396
+ kb_payment_transaction_id,
397
+ transaction_type)
398
+ rescue => e
399
+ # Maybe invalid token?
400
+ response = @response_model.create(:api_call => api_call_type,
401
+ :kb_account_id => kb_account_id,
402
+ :kb_payment_id => kb_payment_id,
403
+ :kb_payment_transaction_id => kb_payment_transaction_id,
404
+ :transaction_type => transaction_type,
405
+ :authorization => nil,
406
+ :payment_processor_account_id => payment_processor_account_id,
407
+ :kb_tenant_id => context.tenant_id,
408
+ :success => false,
409
+ :created_at => Time.now.utc,
410
+ :updated_at => Time.now.utc,
411
+ :message => { :payment_plugin_status => :CANCELED, :exception_class => e.class.to_s, :exception_message => e.message }.to_json)
412
+ return response.to_transaction_info_plugin(nil)
413
+ end
414
+ options[:payer_id] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :payer_id)
415
+ if options[:payer_id].nil?
416
+ options[:payer_id] = payer_info.payer_id
417
+ end
418
+ options[:payer_email] = payer_info.payer_email
419
+
388
420
  if is_authorize
389
421
  gateway_call_proc = Proc.new do |gateway, linked_transaction, payment_source, amount_in_cents, options|
390
422
  gateway.authorize(amount_in_cents, options)
@@ -400,36 +432,6 @@ module Killbill #:nodoc:
400
432
  payment_processor_account_id ||= find_payment_processor_id_from_initial_call(kb_account_id, context.tenant_id, options[:token])
401
433
  options[:payment_processor_account_id] = payment_processor_account_id
402
434
 
403
- begin
404
- payer_info = get_payer_info(options[:token],
405
- kb_account_id,
406
- context.tenant_id,
407
- payment_processor_account_id,
408
- kb_payment_id,
409
- kb_payment_transaction_id,
410
- transaction_type)
411
- rescue => e
412
- # Maybe invalid token?
413
- response = @response_model.create(:api_call => api_call_type,
414
- :kb_account_id => kb_account_id,
415
- :kb_payment_id => kb_payment_id,
416
- :kb_payment_transaction_id => kb_payment_transaction_id,
417
- :transaction_type => transaction_type,
418
- :authorization => nil,
419
- :payment_processor_account_id => payment_processor_account_id,
420
- :kb_tenant_id => context.tenant_id,
421
- :success => false,
422
- :created_at => Time.now.utc,
423
- :updated_at => Time.now.utc,
424
- :message => { :payment_plugin_status => :CANCELED, :exception_class => e.class.to_s, :exception_message => e.message }.to_json)
425
- return response.to_transaction_info_plugin(nil)
426
- end
427
- options[:payer_id] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :payer_id)
428
- if options[:payer_id].nil?
429
- options[:payer_id] = payer_info.payer_id
430
- end
431
- options[:payer_email] = payer_info.payer_email
432
-
433
435
  properties = merge_properties(properties, options)
434
436
  dispatch_to_gateways(api_call_type, kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context, gateway_call_proc, nil, {:payer_id => options[:payer_id]})
435
437
  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.5
4
+ version: 5.0.6
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: 2017-04-27 00:00:00.000000000 Z
11
+ date: 2017-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement