solidus_culqi 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +14 -29
  3. data/.travis.yml +6 -17
  4. data/Gemfile +2 -0
  5. data/app/models/concerns/solidus_culqi/inject_installments_concern.rb +1 -1
  6. data/app/models/payment_decorator.rb +3 -1
  7. data/app/models/permitted_attributes_decorator.rb +3 -1
  8. data/app/models/solidus/gateway/culqi_gateway.rb +11 -8
  9. data/bin/geckodriver +28 -0
  10. data/lib/solidus_culqi.rb +0 -1
  11. data/lib/solidus_culqi/version.rb +1 -1
  12. data/solidus_culqi.gemspec +0 -4
  13. data/spec/models/culqi_gateway.rb +3 -10
  14. data/spec/spec_helper.rb +0 -34
  15. metadata +4 -72
  16. data/app/views/spree/checkout/existing_payment/_culqi.html.erb +0 -3
  17. data/app/views/spree/checkout/payment/_culqi.html.erb +0 -79
  18. data/lib/solidus_culqi/gateway.rb +0 -31
  19. data/spec/cassettes/Culqi_checkout/with_logged_user/store_card_in_wallet.yml +0 -206
  20. data/spec/cassettes/Culqi_checkout/with_unlogged_user/with_process_checkout/capture_payment.yml +0 -207
  21. data/spec/cassettes/Culqi_checkout/with_unlogged_user/with_process_checkout/process_order.yml +0 -156
  22. data/spec/cassettes/Culqi_checkout/with_unlogged_user/with_process_checkout/voids_a_payment.yml +0 -207
  23. data/spec/cassettes/Culqi_checkout_autocapture/with_valid_credit_card/can_process_a_valid_payment.yml +0 -156
  24. data/spec/cassettes/Culqi_checkout_autocapture/with_valid_credit_card/refunds_a_payment.yml +0 -207
  25. data/spec/features/culqi_checkout_autocapture_spec.rb +0 -103
  26. data/spec/features/culqi_checkout_spec.rb +0 -96
  27. data/spec/support/culqi_helper.rb +0 -53
@@ -1,207 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.culqi.com/v2/customers/
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Ruby
16
- Host:
17
- - api.culqi.com
18
- Authorization:
19
- - Bearer sk_test_SpwICNI4YT0OSLHY
20
- Content-Type:
21
- - application/json
22
- Cache-Control:
23
- - no-cache
24
- response:
25
- status:
26
- code: 200
27
- message: OK
28
- headers:
29
- Server:
30
- - ":"
31
- - nginx
32
- Date:
33
- - Tue, 15 May 2018 05:09:03 GMT
34
- Content-Type:
35
- - application/json;charset=UTF-8
36
- Transfer-Encoding:
37
- - chunked
38
- Connection:
39
- - keep-alive
40
- Set-Cookie:
41
- - JSESSIONID=A90BC32CA727555EBB3D2ABD982A10F3; Path=/api/; HttpOnly
42
- X-Culqi-Tracking-Id:
43
- - '2572991'
44
- X-Culqi-Environment:
45
- - test
46
- X-Culqi-Version:
47
- - 2.0.0
48
- body:
49
- encoding: ASCII-8BIT
50
- string: !binary |-
51
- eyJkYXRhIjpbeyJvYmplY3QiOiJjdXN0b21lciIsImlkIjoiY3VzX3Rlc3RfZXdDcVV2eUV4eE0wVVNqbyIsImNyZWF0aW9uX2RhdGUiOjE1MjYzNjA4NzMwMDAsImVtYWlsIjoiZW1haWwxQGV4YW1wbGUuY29tIiwiYW50aWZyYXVkX2RldGFpbHMiOnsiZmlyc3RfbmFtZSI6IkhhbiIsImxhc3RfbmFtZSI6IlNvbG8iLCJhZGRyZXNzIjoiWVQtMTMwMCIsImFkZHJlc3NfY2l0eSI6IkFsYWJhbWEiLCJjb3VudHJ5X2NvZGUiOiJVUyIsInBob25lIjoiNTU1NTU1NTU1NSIsIm9iamVjdCI6ImNsaWVudCJ9LCJjYXJkcyI6W3sib2JqZWN0IjoiY2FyZCIsImlkIjoiY3JkX3Rlc3RfeDhuQTlmQmJ6SmxGbHFNUSIsImFjdGl2ZSI6dHJ1ZSwiY3JlYXRpb25fZGF0ZSI6MTUyNjM2MDg3NzAwMCwiY3VzdG9tZXJfaWQiOiJjdXN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BzOi8vYXBpLmN1bHFpLmNvbS92Mi9jdXN0b21lcnM/bGltaXQ9NTAmYWZ0ZXI9Y3VzX3Rlc3RfaG5mUUVYRU1YSm5QWkE1VSIsImN1cnNvcnMiOnsiYmVmb3JlIjoiY3VzX3Rlc3RfZXdDcVV2eUV4eE0wVVNqbyIsImFmdGVyIjoiY3VzX3Rlc3RfaG5mUUVYRU1YSm5QWkE1VSJ9fX0=
52
- http_version:
53
- recorded_at: Tue, 15 May 2018 05:09:03 GMT
54
- - request:
55
- method: post
56
- uri: https://api.culqi.com/v2/cards/
57
- body:
58
- encoding: UTF-8
59
- string: '{"customer_id":"cus_test_5KekHsuSguEzjzh8","token_id":"tkn_test_zRj2aPFMtA6ibl8M"}'
60
- headers:
61
- Accept-Encoding:
62
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
63
- Accept:
64
- - "*/*"
65
- User-Agent:
66
- - Ruby
67
- Host:
68
- - api.culqi.com
69
- Authorization:
70
- - Bearer sk_test_SpwICNI4YT0OSLHY
71
- Content-Type:
72
- - application/json
73
- Cache-Control:
74
- - no-cache
75
- response:
76
- status:
77
- code: 201
78
- message: Created
79
- headers:
80
- Server:
81
- - ":"
82
- - nginx
83
- Date:
84
- - Tue, 15 May 2018 05:09:08 GMT
85
- Content-Type:
86
- - application/json;charset=UTF-8
87
- Transfer-Encoding:
88
- - chunked
89
- Connection:
90
- - keep-alive
91
- Set-Cookie:
92
- - JSESSIONID=67CC5872313C09FEBDF8F1A2F7D3CB69; Path=/api/; HttpOnly
93
- X-Culqi-Tracking-Id:
94
- - '2572992'
95
- X-Culqi-Environment:
96
- - test
97
- X-Culqi-Version:
98
- - 2.0.0
99
- body:
100
- encoding: ASCII-8BIT
101
- string: !binary |-
102
- eyJvYmplY3QiOiJjYXJkIiwiaWQiOiJjcmRfdGVzdF9MWWZQWmtOWTBvQzlaVno1IiwiYWN0aXZlIjp0cnVlLCJjcmVhdGlvbl9kYXRlIjoxNTA3Nzg5MzMzMDAwLCJjdXN0b21lcl9pZCI6ImN1c190ZXN0XzVLZWtIc3VTZ3VFemp6aDgiLCJzb3VyY2UiOnsib2JqZWN0IjoidG9rZW4iLCJpZCI6InRrbl90ZXN0X3pSajJhUEZNdEE2aWJsOE0iLCJ0eXBlIjoiY2FyZCIsImNyZWF0aW9uX2RhdGUiOjE1MjYzNjA5MzgwMDAsImVtYWlsIjoiaGFuQGV4YW1wbGUuY29tIiwiY2FyZF9udW1iZXIiOiI0MTExMTEqKioqKioxMTExIiwibGFzdF9mb3VyIjoiMTExMSIsImFjdGl2ZSI6dHJ1ZSwiaWluIjp7Im9iamVjdCI6ImlpbiIsImJpbiI6IjQxMTExMSIsImNhcmRfYnJhbmQiOiJWaXNhIiwiY2FyZF90eXBlIjoiY3JlZGl0byIsImNhcmRfY2F0ZWdvcnkiOiJDbMOhc2ljYSIsImlzc3VlciI6eyJuYW1lIjoiSU5URVJCQU5LIiwiY291bnRyeSI6IlBFUlUiLCJjb3VudHJ5X2NvZGUiOiJQRSIsIndlYnNpdGUiOm51bGwsInBob25lX251bWJlciI6bnVsbH0sImluc3RhbGxtZW50c19hbGxvd2VkIjpbMiw0LDYsOCwxMCwxMiwzLDUsNyw5LDI0LDQ4XX0sImNsaWVudCI6eyJpcCI6IjE3OS43LjE1NS42OSIsImlwX2NvdW50cnkiOiJQZXLDuiIsImlwX2NvdW50cnlfY29kZSI6IlBFIiwiYnJvd3NlciI6bnVsbCwiZGV2aWNlX2ZpbmdlcnByaW50IjoiMTM0NzQwOTkzNSIsImRldmljZV90eXBlIjoiRXNjcml0b3JpbyJ9LCJtZXRhZGF0YSI6eyJtZXRob2QiOiJqcyIsImNsaWVudF9pcCI6IjE3OS43LjE1NS42OSIsInNlY3VyZSI6ImZhbHNlIiwidXJsIjoiaHR0cDovLzEyNy4wLjAuMTozNTIwMy9jaGVja291dC9wYXltZW50In19LCJtZXRhZGF0YSI6e319
103
- http_version:
104
- recorded_at: Tue, 15 May 2018 05:09:08 GMT
105
- - request:
106
- method: post
107
- uri: https://api.culqi.com/v2/charges/
108
- body:
109
- encoding: UTF-8
110
- string: '{"amount":1999,"capture":true,"currency_code":"PEN","description":null,"email":"han@example.com","installments":0,"source_id":"crd_test_LYfPZkNY0oC9ZVz5"}'
111
- headers:
112
- Accept-Encoding:
113
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
114
- Accept:
115
- - "*/*"
116
- User-Agent:
117
- - Ruby
118
- Host:
119
- - api.culqi.com
120
- Authorization:
121
- - Bearer sk_test_SpwICNI4YT0OSLHY
122
- Content-Type:
123
- - application/json
124
- Cache-Control:
125
- - no-cache
126
- response:
127
- status:
128
- code: 201
129
- message: Created
130
- headers:
131
- Server:
132
- - ":"
133
- - nginx
134
- Date:
135
- - Tue, 15 May 2018 05:09:13 GMT
136
- Content-Type:
137
- - application/json;charset=UTF-8
138
- Transfer-Encoding:
139
- - chunked
140
- Connection:
141
- - keep-alive
142
- Set-Cookie:
143
- - JSESSIONID=08F27CC5A1EEF7293C35400A6B639D05; Path=/api/; HttpOnly
144
- X-Culqi-Tracking-Id:
145
- - '2572995'
146
- X-Culqi-Environment:
147
- - test
148
- X-Culqi-Version:
149
- - 2.0.0
150
- body:
151
- encoding: ASCII-8BIT
152
- string: !binary |-
153
- eyJkdXBsaWNhdGVkIjpmYWxzZSwib2JqZWN0IjoiY2hhcmdlIiwiaWQiOiJjaHJfdGVzdF9mdlI1OUhGM1BRRnRSZ1RuIiwiY3JlYXRpb25fZGF0ZSI6MTUyNjM2MDk1MTAwMCwiYW1vdW50IjoxOTk5LCJhbW91bnRfcmVmdW5kZWQiOjAsImN1cnJlbnRfYW1vdW50IjoxOTk5LCJpbnN0YWxsbWVudHMiOjAsImluc3RhbGxtZW50c19hbW91bnQiOm51bGwsImN1cnJlbmN5X2NvZGUiOiJQRU4iLCJlbWFpbCI6ImhhbkBleGFtcGxlLmNvbSIsImRlc2NyaXB0aW9uIjpudWxsLCJzb3VyY2UiOnsib2JqZWN0IjoiY2FyZCIsIml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qi.com/v2/refunds/
159
- body:
160
- encoding: UTF-8
161
- string: '{"amount":1999,"charge_id":"chr_test_fvR59HF3PQFtRgTn","reason":"solicitud_comprador"}'
162
- headers:
163
- Accept-Encoding:
164
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
165
- Accept:
166
- - "*/*"
167
- User-Agent:
168
- - Ruby
169
- Host:
170
- - api.culqi.com
171
- Authorization:
172
- - Bearer sk_test_SpwICNI4YT0OSLHY
173
- Content-Type:
174
- - application/json
175
- Cache-Control:
176
- - no-cache
177
- response:
178
- status:
179
- code: 201
180
- message: Created
181
- headers:
182
- Server:
183
- - ":"
184
- - nginx
185
- Date:
186
- - Tue, 15 May 2018 05:09:20 GMT
187
- Content-Type:
188
- - application/json;charset=UTF-8
189
- Transfer-Encoding:
190
- - chunked
191
- Connection:
192
- - keep-alive
193
- Set-Cookie:
194
- - JSESSIONID=A3D0B78BC9490866A36B1A57C0E94197; Path=/api/; HttpOnly
195
- X-Culqi-Tracking-Id:
196
- - '2572996'
197
- X-Culqi-Environment:
198
- - test
199
- X-Culqi-Version:
200
- - 2.0.0
201
- body:
202
- encoding: ASCII-8BIT
203
- string: !binary |-
204
- eyJvYmplY3QiOiJyZWZ1bmQiLCJpZCI6InJlZl90ZXN0X0FoWVJyZDVYY1cwZ1hLaG8iLCJjaGFyZ2VfaWQiOiJjaHJfdGVzdF9mdlI1OUhGM1BRRnRSZ1RuIiwiY3JlYXRpb25fZGF0ZSI6MTUyNjM2MDk2MDAwMCwiYW1vdW50IjoxOTk5LCJyZWFzb24iOiJEZXZvbHVjacOzbiBzb2xpY2l0YWRhIHBvciBlbCBjb21lcmNpbyIsIm1ldGFkYXRhIjp7fX0=
205
- http_version:
206
- recorded_at: Tue, 15 May 2018 05:09:20 GMT
207
- recorded_with: VCR 4.0.0
@@ -1,103 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe "Culqi checkout autocapture", :vcr, type: :feature, js: true do
6
- let(:zone) { create(:zone) }
7
- let(:country) { create(:country) }
8
- let(:product) { create(:product) }
9
-
10
- before do
11
- zone.members << Spree::ZoneMember.create!(zoneable: country)
12
- create(:store)
13
- create(:free_shipping_method)
14
- Spree::Config.set(auto_capture: true)
15
- setup_culqi_gateway
16
- checkout_until_payment(product)
17
- end
18
-
19
- context "with valid credit card" do
20
- stub_authorization!
21
-
22
- before do
23
- fill_in "Card Number", with: "4111 1111 1111 1111"
24
- page.execute_script("$('.cardNumber').trigger('change')")
25
- fill_in "Card Code", with: "123"
26
- fill_in "Expiration", with: "09 / 20"
27
- click_button "Save and Continue"
28
- sleep(5) # Wait for API to return + form to submit
29
- click_button "Save and Continue"
30
- end
31
-
32
- it "can process a valid payment" do
33
- expect(page.current_url).to include("/checkout/confirm")
34
- click_button "Place Order"
35
- expect(page).to have_content("Your order has been processed successfully")
36
- end
37
-
38
- it "refunds a payment" do
39
- reason = FactoryBot.create(:refund_reason)
40
-
41
- click_button "Place Order"
42
- visit spree.admin_order_payments_path(Spree::Order.last)
43
- sleep(3)
44
- click_icon(:reply)
45
- fill_in "Amount", with: Spree::Order.last.amount.to_f
46
- select reason.name, from: "Reason", visible: false
47
- click_on "Refund"
48
- expect(Spree::Refund.count).to be(1)
49
- end
50
- end
51
-
52
- context "when missing credit card number" do
53
- it "shows an error" do
54
- fill_in "Expiration", with: "01 / #{Time.now.year + 1}"
55
- fill_in "Card Code", with: "123"
56
- click_button "Save and Continue"
57
- expect(page).to have_content("El numero de tarjeta de crédito o débito brindado no es válido.")
58
- end
59
- end
60
-
61
- context "when missing expiration date" do
62
- it "shows an error" do
63
- fill_in "Card Number", with: "4242 4242 4242 4242"
64
- fill_in "Card Code", with: "123"
65
- click_button "Save and Continue"
66
- expect(page).to have_content("de expiración de tu tarjeta es inválido.")
67
- end
68
- end
69
-
70
- context "with an invalid credit card number" do
71
- it "shows an error" do
72
- fill_in "Card Number", with: "1111 1111 1111", visible: false
73
- fill_in "Expiration", with: "02 / #{Time.now.year + 1}"
74
- fill_in "Card Code", with: "123"
75
- click_button "Save and Continue"
76
- expect(page).to have_content("El numero de tarjeta de crédito o débito brindado no es válido.")
77
- end
78
- end
79
-
80
- context "with stolen card" do
81
- it "shows an error" do
82
- fill_in "Card Number", with: "4000 0200 0000 0000"
83
- fill_in "Card Code", with: "354"
84
- fill_in "Expiration", with: "10 / 19"
85
- click_button "Save and Continue"
86
- sleep(5)
87
- click_button "Save and Continue"
88
- expect(page).to have_content("El numero de tarjeta de crédito o débito brindado no es válido.")
89
- end
90
- end
91
-
92
- context "with insufficient funds" do
93
- it "shows an error" do
94
- fill_in "Card Number", with: "4000 0400 0000 0008"
95
- fill_in "Card Code", with: "295"
96
- fill_in "Expiration", with: "03 / 21"
97
- click_button "Save and Continue"
98
- sleep(5)
99
- click_button "Save and Continue"
100
- expect(page).to have_content("El numero de tarjeta de crédito o débito brindado no es válido.")
101
- end
102
- end
103
- end
@@ -1,96 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe "Culqi checkout", :vcr, type: :feature, js: true do
6
- let(:zone) { create(:zone) }
7
- let(:country) { create(:country) }
8
- let(:product) { create(:product) }
9
-
10
- before do
11
- zone.members << Spree::ZoneMember.create!(zoneable: country)
12
- create(:store)
13
- create(:free_shipping_method)
14
- setup_culqi_gateway
15
- end
16
-
17
- context 'with unlogged user' do
18
- stub_authorization!
19
-
20
- before do
21
- checkout_until_payment(product)
22
-
23
- fill_in "Card Number", with: "4111 1111 1111 1111", visible: false
24
- page.execute_script("$('.cardNumber').trigger('change')")
25
- fill_in "Card Code", with: "123"
26
- fill_in "Expiration", with: "09 / 20"
27
- click_button "Save and Continue"
28
- sleep(5) # Wait for API to return + form to submit
29
- find(".culqiInstallments").select("2")
30
- click_button "Save and Continue"
31
- end
32
-
33
- context "with process checkout" do
34
- before do
35
- expect(page.current_url).to include("/checkout/confirm")
36
- click_button "Place Order"
37
- end
38
-
39
- it "process order" do
40
- expect(page).to have_content("Your order has been processed successfully")
41
- payment = Spree::Order.last.payments.last
42
- expect(payment.source.gateway_customer_profile_id).not_to be_nil
43
- end
44
-
45
- it "capture payment" do
46
- visit spree.admin_order_payments_path(Spree::Order.last)
47
- sleep(3)
48
- click_icon(:capture)
49
- expect(page).to have_content("Payment Updated")
50
- end
51
-
52
- it "voids a payment" do
53
- visit spree.admin_order_payments_path(Spree::Order.last)
54
- sleep(3)
55
- click_icon(:void)
56
- expect(page).to have_content("Payment Updated")
57
- end
58
- end
59
- end
60
-
61
- context 'with logged user' do
62
- let(:user) { create(:user) }
63
-
64
- before do
65
- visit spree.login_path
66
- fill_in 'Email', with: user.email
67
- fill_in 'Password', with: user.password
68
- click_button 'Login'
69
- end
70
-
71
- it 'store card in wallet' do
72
- checkout_until_payment(product, user)
73
-
74
- fill_in "Card Number", with: "4111 1111 1111 1111", visible: false
75
- page.execute_script("$('.cardNumber').trigger('change')")
76
- fill_in "Card Code", with: "123"
77
- fill_in "Expiration", with: "09 / 20"
78
- click_button "Save and Continue"
79
- sleep(5)
80
- find(".culqiInstallments").select("2")
81
- click_button "Save and Continue"
82
- click_button "Place Order"
83
- expect(page).to have_content("Your order has been processed successfully")
84
-
85
- checkout_until_payment(product, user)
86
- if SolidusCulqi::Support.solidus_earlier('2.2.x')
87
- source = user.payment_sources.first
88
- else
89
- source = user.wallet.wallet_payment_sources.first.payment_source
90
- end
91
-
92
- expect(page).to have_content(source.name)
93
- expect(page).to have_content(source.display_number)
94
- end
95
- end
96
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- module CulqiHelper
6
- def setup_culqi_gateway
7
- Solidus::Gateway::CulqiGateway.create!(
8
- name: "Culqi",
9
- preferred_secret_key: "sk_test_SpwICNI4YT0OSLHY",
10
- preferred_public_key: "pk_test_CaY0noGVG8ohIj4P"
11
- )
12
- end
13
-
14
- def checkout_until_payment(product, user = nil)
15
- visit spree.product_path(product)
16
- click_button "Add To Cart"
17
-
18
- expect(page).to have_current_path("/cart")
19
- click_button "Checkout"
20
-
21
- # Address
22
- if user
23
- expect(page).to have_current_path("/checkout/address")
24
- else
25
- within("#guest_checkout") do
26
- find('#order_email')
27
- fill_in "Email", with: "han@example.com"
28
- click_button "Continue"
29
- end
30
- expect(page).to have_current_path("/checkout")
31
- end
32
-
33
- country = Spree::Country.first
34
- within("#billing") do
35
- fill_in "First Name", with: "Han"
36
- fill_in "Last Name", with: "Solo"
37
- fill_in "Street Address", with: "YT-1300"
38
- fill_in "City", with: "Mos Eisley"
39
- select "United States of America", from: "Country"
40
- select country.states.first, from: "order_bill_address_attributes_state_id"
41
- fill_in "Zip", with: "12010"
42
- fill_in "Phone", with: "(555) 555-5555"
43
- end
44
- click_on "Save and Continue"
45
-
46
- # Delivery
47
- expect(page).to have_current_path("/checkout/delivery")
48
- # expect(page).to have_content("UPS Ground")
49
- click_on "Save and Continue"
50
-
51
- expect(page).to have_current_path("/checkout/payment")
52
- end
53
- end