active_payment 0.0.8 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ FactoryGirl.define do
7
7
  payee_id 1
8
8
  payer_id 1
9
9
  payable_id 1
10
+ payable_type 'PayableObj'
10
11
  gateway "paypal_express_checkout"
11
12
  state "pending"
12
13
  ip_address "127.0.0.1"
data/spec/helper.rb CHANGED
@@ -18,28 +18,28 @@ class ActionDispatch::Routing::RouteSet
18
18
  end
19
19
  end
20
20
 
21
- class Payee
22
- include ActivePayment::Models::Payee
23
- attr_accessor :paypal_identifier
21
+ class PayeeObj
22
+ attr_accessor :paypal
24
23
 
25
24
  def id
26
25
  1
27
26
  end
28
27
 
29
- def paypal_identifier
30
- 'test@paypal.com'
28
+ def paypal
29
+ 'activepayment@paypal.com'
31
30
  end
32
- end
33
- class Payer
34
- include ActivePayment::Models::Payer
35
31
 
32
+ def to_payee
33
+ ActivePayment::Models::Payee.new(identifier: paypal)
34
+ end
35
+ end
36
+ class PayerObj
36
37
  def id
37
38
  2
38
39
  end
39
40
  end
40
- class Payable
41
- include ActivePayment::Models::Payable
42
41
 
42
+ class PayableObj
43
43
  def id
44
44
  3
45
45
  end
@@ -59,6 +59,13 @@ class Payable
59
59
  def shipping
60
60
  20
61
61
  end
62
+
63
+ def to_payable
64
+ ActivePayment::Models::Payable.new(
65
+ amount: amount, reference: self,
66
+ description: description, reference_number: id,
67
+ tax: tax, shipping: shipping)
68
+ end
62
69
  end
63
70
 
64
71
  RSpec.configure do |config|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_payment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Marc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-11 00:00:00.000000000 Z
11
+ date: 2015-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -167,9 +167,8 @@ files:
167
167
  - lib/active_payment/gateway.rb
168
168
  - lib/active_payment/gateways/paypal_adaptive_payment.rb
169
169
  - lib/active_payment/gateways/paypal_express_checkout.rb
170
- - lib/active_payment/models/concerns/payable.rb
171
- - lib/active_payment/models/concerns/payee.rb
172
- - lib/active_payment/models/concerns/payer.rb
170
+ - lib/active_payment/models/payable.rb
171
+ - lib/active_payment/models/payee.rb
173
172
  - lib/active_payment/models/sale.rb
174
173
  - lib/active_payment/models/sales.rb
175
174
  - lib/active_payment/version.rb
@@ -179,6 +178,8 @@ files:
179
178
  - spec/active_payment/gateway_spec.rb
180
179
  - spec/active_payment/gateways/paypal_adaptive_payment_spec.rb
181
180
  - spec/active_payment/gateways/paypal_express_checkout_spec.rb
181
+ - spec/active_payment/models/payable_spec.rb
182
+ - spec/active_payment/models/payee_spec.rb
182
183
  - spec/active_payment/models/sale_spec.rb
183
184
  - spec/active_payment/models/sales_spec.rb
184
185
  - spec/active_payment/models/transaction_spec.rb
@@ -253,6 +254,8 @@ test_files:
253
254
  - spec/active_payment/gateway_spec.rb
254
255
  - spec/active_payment/gateways/paypal_adaptive_payment_spec.rb
255
256
  - spec/active_payment/gateways/paypal_express_checkout_spec.rb
257
+ - spec/active_payment/models/payable_spec.rb
258
+ - spec/active_payment/models/payee_spec.rb
256
259
  - spec/active_payment/models/sale_spec.rb
257
260
  - spec/active_payment/models/sales_spec.rb
258
261
  - spec/active_payment/models/transaction_spec.rb
@@ -1,32 +0,0 @@
1
- module ActivePayment
2
- module Models
3
- module Payable
4
- extend ActiveSupport::Concern
5
-
6
- def to_paypal_hash
7
- {
8
- name: description,
9
- amount: amount.to_i,
10
- number: 1,
11
- quantity: 1,
12
- }
13
- end
14
-
15
- def shipping
16
- shipping
17
- end
18
-
19
- def tax
20
- tax
21
- end
22
-
23
- def reference
24
- id
25
- end
26
-
27
- def description
28
- description
29
- end
30
- end
31
- end
32
- end
@@ -1,27 +0,0 @@
1
- module ActivePayment
2
- module Models
3
- module Payee
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- if superclass == ActiveRecord::Base
8
- has_many :received_transactions, foreign_key: 'payee_id', class_name: 'ActivePayment::Transaction'
9
- end
10
- end
11
-
12
- def to_paypal_hash
13
- {
14
- email: paypal_identifier,
15
- primary: false
16
- }
17
- end
18
-
19
- def paypal_identifier
20
- paypal
21
- end
22
-
23
- module ClassMethods
24
- end
25
- end
26
- end
27
- end
@@ -1,13 +0,0 @@
1
- module ActivePayment
2
- module Models
3
- module Payer
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- if superclass == ActiveRecord::Base
8
- has_many :sent_transactions, foreign_key: 'payer_id', class_name: 'ActivePayment::Transaction'
9
- end
10
- end
11
- end
12
- end
13
- end