judopay 2.1.0 → 2.1.3

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 (122) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +24 -23
  3. data/.rspec +1 -1
  4. data/.rubocop.yml +54 -51
  5. data/.travis.yml +6 -6
  6. data/CHANGELOG.md +17 -17
  7. data/Gemfile +4 -4
  8. data/LICENSE +21 -21
  9. data/README.md +96 -94
  10. data/Rakefile +22 -22
  11. data/judopay.gemspec +38 -38
  12. data/lib/certs/digicert_sha256_ca.pem +49 -49
  13. data/lib/certs/rapidssl_ca.crt +63 -63
  14. data/lib/faraday/judo_mashify.rb +11 -11
  15. data/lib/faraday/raise_http_exception.rb +19 -19
  16. data/lib/judopay.rb +70 -70
  17. data/lib/judopay/api.rb +10 -10
  18. data/lib/judopay/connection.rb +77 -77
  19. data/lib/judopay/core_ext/hash.rb +29 -29
  20. data/lib/judopay/core_ext/string.rb +32 -32
  21. data/lib/judopay/error.rb +117 -115
  22. data/lib/judopay/mash.rb +11 -11
  23. data/lib/judopay/model.rb +134 -134
  24. data/lib/judopay/models/android_payment.rb +26 -26
  25. data/lib/judopay/models/android_preauth.rb +8 -8
  26. data/lib/judopay/models/apple_payment.rb +26 -26
  27. data/lib/judopay/models/apple_preauth.rb +9 -9
  28. data/lib/judopay/models/card_address.rb +11 -11
  29. data/lib/judopay/models/card_payment.rb +33 -33
  30. data/lib/judopay/models/card_preauth.rb +11 -11
  31. data/lib/judopay/models/collection.rb +16 -16
  32. data/lib/judopay/models/encrypt_details.rb +18 -0
  33. data/lib/judopay/models/inner/pk_payment.rb +17 -17
  34. data/lib/judopay/models/inner/pk_payment_token.rb +13 -13
  35. data/lib/judopay/models/inner/transmitted_field.rb +39 -39
  36. data/lib/judopay/models/inner/wallet.rb +30 -30
  37. data/lib/judopay/models/market/collection.rb +10 -10
  38. data/lib/judopay/models/market/payment.rb +10 -10
  39. data/lib/judopay/models/market/preauth.rb +10 -10
  40. data/lib/judopay/models/market/refund.rb +10 -10
  41. data/lib/judopay/models/market/transaction.rb +10 -10
  42. data/lib/judopay/models/one_use_token_payment.rb +29 -0
  43. data/lib/judopay/models/payment.rb +8 -8
  44. data/lib/judopay/models/preauth.rb +8 -8
  45. data/lib/judopay/models/refund.rb +16 -16
  46. data/lib/judopay/models/register_card.rb +27 -27
  47. data/lib/judopay/models/save_card.rb +24 -25
  48. data/lib/judopay/models/token_payment.rb +30 -30
  49. data/lib/judopay/models/token_preauth.rb +10 -10
  50. data/lib/judopay/models/transaction.rb +8 -8
  51. data/lib/judopay/models/void.rb +19 -19
  52. data/lib/judopay/models/web_payments/payment.rb +28 -28
  53. data/lib/judopay/models/web_payments/preauth.rb +10 -10
  54. data/lib/judopay/models/web_payments/transaction.rb +19 -19
  55. data/lib/judopay/models/web_payments/web_payment_operation.rb +8 -8
  56. data/lib/judopay/null_logger.rb +9 -11
  57. data/lib/judopay/request.rb +50 -50
  58. data/lib/judopay/response.rb +7 -7
  59. data/lib/judopay/serializer.rb +27 -27
  60. data/lib/judopay/version.rb +4 -4
  61. data/spec/factories.rb +227 -208
  62. data/spec/faraday/response_spec.rb +27 -27
  63. data/spec/fixtures/card_payments/create.json +21 -21
  64. data/spec/fixtures/card_payments/create_3dsecure.json +7 -7
  65. data/spec/fixtures/card_payments/create_bad_request.json +12 -12
  66. data/spec/fixtures/card_payments/create_declined.json +23 -23
  67. data/spec/fixtures/card_payments/validate.json +4 -4
  68. data/spec/fixtures/token_payments/create.json +21 -21
  69. data/spec/fixtures/transactions/all.json +237 -237
  70. data/spec/fixtures/transactions/android_payment.json +26 -26
  71. data/spec/fixtures/transactions/apple_payment.json +26 -26
  72. data/spec/fixtures/transactions/find.json +22 -22
  73. data/spec/fixtures/transactions/find_not_found.json +4 -4
  74. data/spec/fixtures/transactions/register_card.json +28 -28
  75. data/spec/fixtures/transactions/save_card.json +27 -27
  76. data/spec/fixtures/transactions/void.json +26 -26
  77. data/spec/fixtures/web_payments/payments/create.json +3 -3
  78. data/spec/fixtures/web_payments/payments/find.json +38 -38
  79. data/spec/judopay/android_payment_spec.rb +74 -74
  80. data/spec/judopay/apple_payment_spec.rb +80 -80
  81. data/spec/judopay/card_address_spec.rb +10 -10
  82. data/spec/judopay/card_payment_spec.rb +51 -63
  83. data/spec/judopay/card_preauth_spec.rb +35 -35
  84. data/spec/judopay/collection_spec.rb +26 -26
  85. data/spec/judopay/core_ext/hash_spec.rb +24 -24
  86. data/spec/judopay/core_ext/string_spec.rb +16 -16
  87. data/spec/judopay/error_spec.rb +70 -70
  88. data/spec/judopay/judopay_spec.rb +19 -19
  89. data/spec/judopay/market/collection_spec.rb +26 -26
  90. data/spec/judopay/market/payment_spec.rb +14 -14
  91. data/spec/judopay/market/preauth_spec.rb +14 -14
  92. data/spec/judopay/market/refund_spec.rb +26 -26
  93. data/spec/judopay/market/transaction_spec.rb +14 -14
  94. data/spec/judopay/payment_spec.rb +14 -14
  95. data/spec/judopay/preauth_spec.rb +14 -14
  96. data/spec/judopay/refund_spec.rb +26 -26
  97. data/spec/judopay/register_card_spec.rb +24 -24
  98. data/spec/judopay/save_card_spec.rb +23 -23
  99. data/spec/judopay/token_payment_spec.rb +22 -22
  100. data/spec/judopay/token_preauth_spec.rb +22 -22
  101. data/spec/judopay/transaction_spec.rb +51 -51
  102. data/spec/judopay/void_spec.rb +24 -24
  103. data/spec/judopay/web_payments/payment_spec.rb +16 -16
  104. data/spec/judopay/web_payments/preauth_spec.rb +16 -16
  105. data/spec/judopay/web_payments/transaction_spec.rb +15 -15
  106. data/spec/spec_helper.rb +41 -41
  107. data/test/additions_payment_test.rb +30 -0
  108. data/test/authentication_test.rb +23 -23
  109. data/test/base/integration_base.rb +20 -20
  110. data/test/base/payments_tests.rb +47 -47
  111. data/test/base/token_payment_tests.rb +98 -98
  112. data/test/card_details_test.rb +21 -21
  113. data/test/configuration_test.rb +35 -35
  114. data/test/helper/assertion_helper.rb +29 -29
  115. data/test/payment_test.rb +10 -10
  116. data/test/preauth_test.rb +10 -10
  117. data/test/register_card_test.rb +42 -42
  118. data/test/save_card_test.rb +23 -0
  119. data/test/token_payment_test.rb +10 -10
  120. data/test/token_preauth_test.rb +10 -10
  121. data/test/void_test.rb +45 -45
  122. metadata +18 -12
@@ -1,8 +1,8 @@
1
- module Judopay
2
- module WebPayments
3
- module WebPaymentOperation
4
- PAYMENT = 0
5
- REGISTER = 1
6
- end
7
- end
8
- end
1
+ module Judopay
2
+ module WebPayments
3
+ module WebPaymentOperation
4
+ PAYMENT = 0
5
+ REGISTER = 1
6
+ end
7
+ end
8
+ end
@@ -1,11 +1,9 @@
1
- require 'logger'
2
-
3
- module Judopay
4
- class NullLogger < Logger
5
- def initialize(*)
6
- end
7
-
8
- def add(*)
9
- end
10
- end
11
- end
1
+ require 'logger'
2
+
3
+ module Judopay
4
+ class NullLogger < Logger
5
+ def initialize(*) end
6
+
7
+ def add(*) end
8
+ end
9
+ end
@@ -1,50 +1,50 @@
1
- require 'openssl'
2
- require 'json'
3
-
4
- module Judopay
5
- # Defines HTTP request methods
6
- module Request
7
- # Perform an HTTP GET request
8
- def get(path, options = {}, raw = false)
9
- request(:get, path, options, raw)
10
- end
11
-
12
- # Perform an HTTP POST request
13
- def post(path, options = {}, raw = false)
14
- request(:post, path, options, raw)
15
- end
16
-
17
- # Perform an HTTP PUT request
18
- def put(path, options = {}, raw = false)
19
- request(:put, path, options, raw)
20
- end
21
-
22
- # Perform an HTTP DELETE request
23
- def delete(path, options = {}, raw = false)
24
- request(:delete, path, options, raw)
25
- end
26
-
27
- private
28
-
29
- # Perform an HTTP request
30
- def request(method, path, options, raw = false)
31
- response = connection(raw).send(method) do |request|
32
- case method
33
- when :get, :delete
34
- request.url(path, options)
35
- when :post, :put
36
- request.path = path
37
- unless options.nil?
38
- request.body = Judopay::Serializer.new(options).as_json
39
- Judopay.log(Logger::DEBUG, 'Request body: ' + request.body)
40
- end
41
- end
42
- end
43
-
44
- Judopay.log(Logger::DEBUG, response)
45
-
46
- return response if raw
47
- Response.create(response.body)
48
- end
49
- end
50
- end
1
+ require 'openssl'
2
+ require 'json'
3
+
4
+ module Judopay
5
+ # Defines HTTP request methods
6
+ module Request
7
+ # Perform an HTTP GET request
8
+ def get(path, options = {}, raw = false)
9
+ request(:get, path, options, raw)
10
+ end
11
+
12
+ # Perform an HTTP POST request
13
+ def post(path, options = {}, raw = false)
14
+ request(:post, path, options, raw)
15
+ end
16
+
17
+ # Perform an HTTP PUT request
18
+ def put(path, options = {}, raw = false)
19
+ request(:put, path, options, raw)
20
+ end
21
+
22
+ # Perform an HTTP DELETE request
23
+ def delete(path, options = {}, raw = false)
24
+ request(:delete, path, options, raw)
25
+ end
26
+
27
+ private
28
+
29
+ # Perform an HTTP request
30
+ def request(method, path, options, raw = false)
31
+ response = connection(raw).send(method) do |request|
32
+ case method
33
+ when :get, :delete
34
+ request.url(path, options)
35
+ when :post, :put
36
+ request.path = path
37
+ unless options.nil?
38
+ request.body = Judopay::Serializer.new(options).as_json
39
+ Judopay.log(Logger::DEBUG, 'Request body: ' + request.body)
40
+ end
41
+ end
42
+ end
43
+
44
+ Judopay.log(Logger::DEBUG, response)
45
+
46
+ return response if raw
47
+ Response.create(response.body)
48
+ end
49
+ end
50
+ end
@@ -1,7 +1,7 @@
1
- module Judopay
2
- module Response
3
- def self.create(response_hash)
4
- response_hash
5
- end
6
- end
7
- end
1
+ module Judopay
2
+ module Response
3
+ def self.create(response_hash)
4
+ response_hash
5
+ end
6
+ end
7
+ end
@@ -1,27 +1,27 @@
1
- module Judopay
2
- # @private
3
- class Serializer
4
- attr_reader :serialized_object
5
-
6
- def initialize(serialized_object)
7
- @serialized_object = serialized_object
8
- end
9
-
10
- def as_json
11
- output_hash = hashify(@serialized_object).camel_case_keys!
12
- JSON.generate(output_hash)
13
- end
14
-
15
- # Turn a hash with nested Virtus objects into a simple nested hash
16
- def hashify(source)
17
- output_hash = {}
18
- source.to_hash.each do |key, value|
19
- next if value.nil?
20
-
21
- # Is this a Virtus model object that we need to hashify?
22
- output_hash[key] = value.class.included_modules.include?(Virtus::Model::Core) ? hashify(value) : value
23
- end
24
- output_hash
25
- end
26
- end
27
- end
1
+ module Judopay
2
+ # @private
3
+ class Serializer
4
+ attr_reader :serialized_object
5
+
6
+ def initialize(serialized_object)
7
+ @serialized_object = serialized_object
8
+ end
9
+
10
+ def as_json
11
+ output_hash = hashify(@serialized_object).camel_case_keys!
12
+ JSON.generate(output_hash)
13
+ end
14
+
15
+ # Turn a hash with nested Virtus objects into a simple nested hash
16
+ def hashify(source)
17
+ output_hash = {}
18
+ source.to_hash.each do |key, value|
19
+ next if value.nil?
20
+
21
+ # Is this a Virtus model object that we need to hashify?
22
+ output_hash[key] = value.class.included_modules.include?(Virtus::Model::Core) ? hashify(value) : value
23
+ end
24
+ output_hash
25
+ end
26
+ end
27
+ end
@@ -1,4 +1,4 @@
1
- module Judopay
2
- SDK_VERSION = '2.1.0'.freeze
3
- API_VERSION = '5.2.0'.freeze
4
- end
1
+ module Judopay
2
+ SDK_VERSION = '2.1.3'.freeze
3
+ API_VERSION = '5.2.0'.freeze
4
+ end
@@ -1,208 +1,227 @@
1
- models = %w(
2
- card_payment
3
- card_preauth
4
- collection
5
- refund
6
- token_payment
7
- token_preauth
8
- web_payments/payment
9
- market/collection
10
- market/refund
11
- save_card
12
- register_card
13
- void
14
- apple_payment
15
- android_payment
16
- )
17
- models.each { |model| require_relative '../lib/judopay/models/' + model }
18
- require 'securerandom'
19
-
20
- FactoryGirl.define do
21
- trait :payment_details do
22
- your_consumer_reference 123
23
- sequence :your_payment_reference do |n|
24
- SecureRandom.hex(21) + n.to_s
25
- end
26
- amount 1.01
27
- end
28
-
29
- trait :valid_card do
30
- card_number '4976000000003436'
31
- expiry_date '12/20'
32
- cv2 452
33
- end
34
-
35
- trait :declined_card do
36
- card_number '4221690000004963'
37
- expiry_date '12/20'
38
- cv2 125
39
- end
40
-
41
- trait :valid_token_details do
42
- consumer_token '3UW4DV9wI0oKkMFS'
43
- card_token 'SXw4hnv1vJuEujQR'
44
- cv2 452
45
- end
46
-
47
- trait :valid_judo_id do
48
- judo_id '100435-197'
49
- end
50
-
51
- trait :valid_collection_or_refund_details do
52
- receipt_id '1234'
53
- amount 1.01
54
- sequence :your_payment_reference do |n|
55
- SecureRandom.hex(21) + n.to_s
56
- end
57
- end
58
-
59
- trait :client_ip_address_and_user_agent do
60
- client_ip_address '127.0.0.1'
61
- client_user_agent 'Mozilla/5.0 (Windows NT 6.2; Win64; x64)...'
62
- end
63
-
64
- factory :card_payment, :class => Judopay::CardPayment do
65
- payment_details
66
- valid_judo_id
67
- valid_card
68
- currency 'GBP'
69
-
70
- trait :declined do
71
- card_number '4221690000004963'
72
- cv2 125
73
- end
74
- end
75
-
76
- factory :card_preauth, :class => Judopay::CardPreauth do
77
- payment_details
78
- valid_card
79
- valid_judo_id
80
- currency 'GBP'
81
-
82
- trait :declined do
83
- card_number '4221690000004963'
84
- cv2 125
85
- end
86
- end
87
-
88
- factory :collection, :class => Judopay::Collection do
89
- valid_collection_or_refund_details
90
- end
91
-
92
- factory :refund, :class => Judopay::Refund do
93
- valid_collection_or_refund_details
94
- end
95
-
96
- factory :token_payment, :class => Judopay::TokenPayment do
97
- payment_details
98
- valid_token_details
99
- valid_judo_id
100
- currency 'GBP'
101
- end
102
-
103
- factory :token_preauth, :class => Judopay::TokenPreauth do
104
- payment_details
105
- valid_token_details
106
- valid_judo_id
107
- currency 'GBP'
108
- end
109
-
110
- factory :web_payment, :class => Judopay::WebPayments::Payment do
111
- valid_judo_id
112
- payment_details
113
- client_ip_address_and_user_agent
114
-
115
- partner_service_fee 1.00
116
- end
117
-
118
- factory :web_preauth, :class => Judopay::WebPayments::Payment do
119
- valid_judo_id
120
- payment_details
121
- client_ip_address_and_user_agent
122
-
123
- partner_service_fee 1.00
124
- end
125
-
126
- factory :market_collection, :class => Judopay::Market::Collection do
127
- valid_collection_or_refund_details
128
- end
129
-
130
- factory :market_refund, :class => Judopay::Market::Refund do
131
- valid_collection_or_refund_details
132
- end
133
-
134
- factory :save_card, :class => Judopay::SaveCard do
135
- valid_card
136
-
137
- your_consumer_reference 123
138
- end
139
-
140
- factory :register_card, :class => Judopay::RegisterCard do
141
- payment_details
142
- valid_card
143
- valid_judo_id
144
- currency 'GBP'
145
-
146
- trait :declined do
147
- card_number '4221690000004963'
148
- cv2 125
149
- end
150
- end
151
-
152
- factory :void, :class => Judopay::Void do
153
- valid_collection_or_refund_details
154
- end
155
-
156
- factory :apple_payment, :class => Judopay::ApplePayment do
157
- payment_details
158
- valid_judo_id
159
- currency 'GBP'
160
-
161
- client_details do
162
- {
163
- :key => 'someValidKey',
164
- :value => 'someValidValue'
165
- }
166
- end
167
-
168
- pk_payment do
169
- {
170
- :token => {
171
- :payment_instrument_name => 'Visa 9911',
172
- :payment_network => 'Visa',
173
- :payment_data => {
174
- :version => 'EC_v1',
175
- :data => 'someData',
176
- :signature => 'someData',
177
- :header => {
178
- :ephemeralPublicKey => 'someData',
179
- :publicKeyHash => 'someData',
180
- :transactionId => 'someData'
181
- }
182
- }
183
- },
184
- :billing_address => nil,
185
- :shipping_address => nil
186
- }
187
- end
188
- end
189
- factory :android_payment, :class => Judopay::AndroidPayment do
190
- payment_details
191
- valid_judo_id
192
- currency 'GBP'
193
-
194
- wallet do
195
- {
196
- :encrypted_message => 'ZW5jcnlwdGVkTWVzc2FnZQ==',
197
- :environment => 3,
198
- :ephemeral_public_key => 'ZXBoZW1lcmFsUHVibGljS2V5',
199
- :google_transaction_id => '123456789',
200
- :instrument_details => '1234',
201
- :instrument_type => 'VISA',
202
- :public_key => 'someKey',
203
- :tag => 'c2lnbmF0dXJl',
204
- :version => 1
205
- }
206
- end
207
- end
208
- end
1
+ models = %w(
2
+ card_payment
3
+ card_preauth
4
+ collection
5
+ refund
6
+ token_payment
7
+ token_preauth
8
+ web_payments/payment
9
+ market/collection
10
+ market/refund
11
+ save_card
12
+ register_card
13
+ void
14
+ apple_payment
15
+ android_payment
16
+ encrypt_details
17
+ one_use_token_payment
18
+ )
19
+ models.each { |model| require_relative '../lib/judopay/models/' + model }
20
+ require 'securerandom'
21
+
22
+ FactoryBot.define do
23
+ trait :payment_details do
24
+ your_consumer_reference 123
25
+ sequence :your_payment_reference do |n|
26
+ SecureRandom.hex(21) + n.to_s
27
+ end
28
+ amount 1.01
29
+ end
30
+
31
+ trait :valid_card do
32
+ card_number '4976000000003436'
33
+ expiry_date '12/20'
34
+ cv2 452
35
+ end
36
+
37
+ trait :declined_card do
38
+ card_number '4221690000004963'
39
+ expiry_date '12/20'
40
+ cv2 125
41
+ end
42
+
43
+ trait :valid_token_details do
44
+ consumer_token '3UW4DV9wI0oKkMFS'
45
+ card_token 'SXw4hnv1vJuEujQR'
46
+ cv2 452
47
+ end
48
+
49
+ trait :valid_judo_id do
50
+ judo_id '100435-197'
51
+ end
52
+
53
+ trait :valid_collection_or_refund_details do
54
+ receipt_id '1234'
55
+ amount 1.01
56
+ sequence :your_payment_reference do |n|
57
+ SecureRandom.hex(21) + n.to_s
58
+ end
59
+ end
60
+
61
+ trait :client_ip_address_and_user_agent do
62
+ client_ip_address '127.0.0.1'
63
+ client_user_agent 'Mozilla/5.0 (Windows NT 6.2; Win64; x64)...'
64
+ end
65
+
66
+ factory :card_payment, :class => Judopay::CardPayment do
67
+ payment_details
68
+ valid_judo_id
69
+ valid_card
70
+ currency 'GBP'
71
+
72
+ trait :declined do
73
+ card_number '4221690000004963'
74
+ cv2 125
75
+ end
76
+ end
77
+
78
+ factory :card_preauth, :class => Judopay::CardPreauth do
79
+ payment_details
80
+ valid_card
81
+ valid_judo_id
82
+ currency 'GBP'
83
+
84
+ trait :declined do
85
+ card_number '4221690000004963'
86
+ cv2 125
87
+ end
88
+ end
89
+
90
+ factory :collection, :class => Judopay::Collection do
91
+ valid_collection_or_refund_details
92
+ end
93
+
94
+ factory :refund, :class => Judopay::Refund do
95
+ valid_collection_or_refund_details
96
+ end
97
+
98
+ factory :token_payment, :class => Judopay::TokenPayment do
99
+ payment_details
100
+ valid_token_details
101
+ valid_judo_id
102
+ currency 'GBP'
103
+ end
104
+
105
+ factory :token_preauth, :class => Judopay::TokenPreauth do
106
+ payment_details
107
+ valid_token_details
108
+ valid_judo_id
109
+ currency 'GBP'
110
+ end
111
+
112
+ factory :web_payment, :class => Judopay::WebPayments::Payment do
113
+ valid_judo_id
114
+ payment_details
115
+ client_ip_address_and_user_agent
116
+
117
+ partner_service_fee 1.00
118
+ end
119
+
120
+ factory :web_preauth, :class => Judopay::WebPayments::Payment do
121
+ valid_judo_id
122
+ payment_details
123
+ client_ip_address_and_user_agent
124
+
125
+ partner_service_fee 1.00
126
+ end
127
+
128
+ factory :market_collection, :class => Judopay::Market::Collection do
129
+ valid_collection_or_refund_details
130
+ end
131
+
132
+ factory :market_refund, :class => Judopay::Market::Refund do
133
+ valid_collection_or_refund_details
134
+ end
135
+
136
+ factory :save_card, :class => Judopay::SaveCard do
137
+ valid_card
138
+
139
+ your_consumer_reference 123
140
+ end
141
+
142
+ factory :register_card, :class => Judopay::RegisterCard do
143
+ payment_details
144
+ valid_card
145
+ valid_judo_id
146
+ currency 'GBP'
147
+
148
+ trait :declined do
149
+ card_number '4221690000004963'
150
+ cv2 125
151
+ end
152
+ end
153
+
154
+ factory :void, :class => Judopay::Void do
155
+ valid_collection_or_refund_details
156
+ end
157
+
158
+ factory :apple_payment, :class => Judopay::ApplePayment do
159
+ payment_details
160
+ valid_judo_id
161
+ currency 'GBP'
162
+
163
+ client_details do
164
+ {
165
+ :key => 'someValidKey',
166
+ :value => 'someValidValue'
167
+ }
168
+ end
169
+
170
+ pk_payment do
171
+ {
172
+ :token => {
173
+ :payment_instrument_name => 'Visa 9911',
174
+ :payment_network => 'Visa',
175
+ :payment_data => {
176
+ :version => 'EC_v1',
177
+ :data => 'someData',
178
+ :signature => 'someData',
179
+ :header => {
180
+ :ephemeralPublicKey => 'someData',
181
+ :publicKeyHash => 'someData',
182
+ :transactionId => 'someData'
183
+ }
184
+ }
185
+ },
186
+ :billing_address => nil,
187
+ :shipping_address => nil
188
+ }
189
+ end
190
+ end
191
+
192
+ factory :android_payment, :class => Judopay::AndroidPayment do
193
+ payment_details
194
+ valid_judo_id
195
+ currency 'GBP'
196
+
197
+ wallet do
198
+ {
199
+ :encrypted_message => 'ZW5jcnlwdGVkTWVzc2FnZQ==',
200
+ :environment => 3,
201
+ :ephemeral_public_key => 'ZXBoZW1lcmFsUHVibGljS2V5',
202
+ :google_transaction_id => '123456789',
203
+ :instrument_details => '1234',
204
+ :instrument_type => 'VISA',
205
+ :public_key => 'someKey',
206
+ :tag => 'c2lnbmF0dXJl',
207
+ :version => 1
208
+ }
209
+ end
210
+ end
211
+
212
+ factory :encrypt_details, :class => Judopay::EncryptDetails do
213
+ card_number '4976000000003436'
214
+ expiry_date '12/20'
215
+ cv2 452
216
+ end
217
+
218
+ factory :one_use_token_payment, :class => Judopay::OneUseTokenPayment do
219
+ your_consumer_reference 'oneUseTokenTestConsumer'
220
+ sequence :your_payment_reference do |n|
221
+ SecureRandom.hex(21) + n.to_s
222
+ end
223
+ amount 1.01
224
+ currency "GBP"
225
+ end
226
+
227
+ end