unlock_paypal 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a65af1d4188b89aa50c67dcc27c45faf92639877
4
- data.tar.gz: 046a70f4f37e4ced378dadbd33c690f89b220f33
3
+ metadata.gz: 80e9846b30eeb857dd6329b9adf7c0d5772c113b
4
+ data.tar.gz: 3f6e20da6ee1328bb230a0978bf1790890c88a33
5
5
  SHA512:
6
- metadata.gz: e1e1b0a34cd69bac567592935806c230036cb351ac3cbc64fd761c52daa6e5436dc5a2a18f7538eae20f05589d5db431a00ae859ec51f2b25a9a84ebcab8f8d3
7
- data.tar.gz: 7a360f2fefd6280b508b559f709aebee7303da7c45343383088af76108609d0c16c439df52088abc9d7d316982812c16accef9ffc1e5996ec7411ed978d2eb96
6
+ metadata.gz: b176fdda696c8db7a35a002922af84e9d7d49e65236820a4f0d4be00219d193d96514689b583ce0333495ff30f8a21b00b665e4525af84d444f2f2e069e468f1
7
+ data.tar.gz: 014c37227571cc76b7b7a5aef4bb0768227f9e450330c93a098455dbba0996518aa3246f86826976a7f263a0fa0c84b3b6314a094d4291e4e6e0a5149b8e85af
@@ -52,49 +52,27 @@ class UnlockPaypal::ContributionsController < ::ApplicationController
52
52
  @contribution.gateway_data["ipn_url"] = details.ipn_url
53
53
  @contribution.gateway_data["agreed"] = details.agreed?
54
54
  @contribution.save!
55
- paypal = PayPal::Recurring.new({
55
+ recurring = PayPal::Recurring.new({
56
+ ipn_url: details.ipn_url,
57
+ description: details.description,
58
+ amount: details.amount,
59
+ currency: details.currency,
60
+ frequency: 1,
56
61
  token: params[:token],
62
+ period: :monthly,
57
63
  payer_id: params[:PayerID],
58
- description: details.description,
59
- amount: details.amount,
60
- currency: details.currency
64
+ start_at: Time.now,
65
+ failed: 3,
66
+ outstanding: :next_billing
61
67
  }.merge(@contribution.paypal_auth))
62
- payment = paypal.request_payment
63
- if payment.approved? && payment.completed?
64
- recurring = PayPal::Recurring.new({
65
- ipn_url: details.ipn_url,
66
- description: details.description,
67
- amount: details.amount,
68
- currency: details.currency,
69
- frequency: 1,
70
- token: params[:token],
71
- period: :monthly,
72
- payer_id: params[:PayerID],
73
- start_at: Time.now,
74
- failed: 3,
75
- outstanding: :next_billing
76
- }.merge(@contribution.paypal_auth))
77
- profile = recurring.create_recurring_profile
78
- if profile.valid? && profile.profile_id.present? && profile.status == "ActiveProfile"
79
- profile_data = {}
80
- profile_data["profile_id"] = profile.profile_id
81
- profile_data["profile_status"] = profile.status
82
- @contribution.update gateway_data: @contribution.gateway_data.merge(profile_data)
83
- @contribution.activate!
84
- return redirect_to initiative_contribution_path(@initiative.id, @contribution)
85
- else
86
- if payment.errors.size > 0
87
- payment.errors.each do |error|
88
- error[:messages].each do |message|
89
- @contribution.errors.add(:base, "#{error[:code]} #{message} (PayPal)")
90
- end
91
- end
92
- else
93
- error = t('flash.actions.create.alert', resource_name: @contribution.class.model_name.human)
94
- @contribution.errors.add(:base, "#{error} (PayPal - create_recurring_profile)")
95
- end
96
- return render '/initiatives/contributions/new'
97
- end
68
+ profile = recurring.create_recurring_profile
69
+ if profile.valid? && profile.profile_id.present? && profile.status == "ActiveProfile"
70
+ profile_data = {}
71
+ profile_data["profile_id"] = profile.profile_id
72
+ profile_data["profile_status"] = profile.status
73
+ @contribution.update gateway_data: @contribution.gateway_data.merge(profile_data)
74
+ @contribution.activate!
75
+ return redirect_to initiative_contribution_path(@initiative.id, @contribution)
98
76
  else
99
77
  if payment.errors.size > 0
100
78
  payment.errors.each do |error|
@@ -104,7 +82,7 @@ class UnlockPaypal::ContributionsController < ::ApplicationController
104
82
  end
105
83
  else
106
84
  error = t('flash.actions.create.alert', resource_name: @contribution.class.model_name.human)
107
- @contribution.errors.add(:base, "#{error} (PayPal - request_payment)")
85
+ @contribution.errors.add(:base, "#{error} (PayPal - create_recurring_profile)")
108
86
  end
109
87
  return render '/initiatives/contributions/new'
110
88
  end
@@ -1,3 +1,3 @@
1
1
  module UnlockPaypal
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unlock_paypal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Weinmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-18 00:00:00.000000000 Z
11
+ date: 2015-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails