solidus_culqi 0.0.1 → 0.0.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: b87517498f541c5a8ad5b739f725b28921281f96
4
- data.tar.gz: 93c72f59c361757c499eb3606e793aa81b2d4573
3
+ metadata.gz: 2ffd16d55727246157726af60755d45bd77af4ff
4
+ data.tar.gz: 0eed2658dd67b31df98b22900e76fc2d216ac74a
5
5
  SHA512:
6
- metadata.gz: c64c32c5deb830bed6db8ba903f992dfd02a01f8636254df152efebb685813494a3f3f6e775bf1b8a1914cb879a13ee9e3e1d3a62c2ac11da90c6c8554fd726d
7
- data.tar.gz: 02ea951f965722b9c7d57a2ad36f10d7d49dc945d0d36abd34e085f0ab547656b7bc256835e9062155ceb249d900b4596d5c7f9c5189a520a945687f4e250acc
6
+ metadata.gz: 0372c44fda0f92504e10f0881f1e36e9702736a68e544071f519f9b0c377c95f25751aba199438a669536d039da85518009393749fa381f34ec623f03afad874
7
+ data.tar.gz: 282edb48b247d1b4a6cd75680cc1545237dbb5d81ad6adb441673427eeba22282b6da6bbdacebf18b734d04144b6016698c631b9f7edae193c77d319ef7f67a9
data/.rubocop.yml CHANGED
@@ -208,7 +208,7 @@ Metrics/AbcSize:
208
208
 
209
209
  Metrics/BlockLength:
210
210
  Exclude:
211
- - 'spec/*/*'
211
+ - 'spec/**/*'
212
212
 
213
213
  Metrics/BlockNesting:
214
214
  Enabled: false
data/.travis.yml CHANGED
@@ -2,13 +2,14 @@ sudo: false
2
2
  cache: bundler
3
3
  language: ruby
4
4
  bundler_args: --quiet
5
+ before_install:
6
+ - gem install bundler --pre
5
7
  script:
6
8
  - bundle exec rake
7
9
  rvm:
8
10
  - 2.4.1
9
11
  env:
10
12
  matrix:
11
- - SOLIDUS_BRANCH=v1.1 DB=postgres
12
13
  - SOLIDUS_BRANCH=v1.2 DB=postgres
13
14
  - SOLIDUS_BRANCH=v1.3 DB=postgres
14
15
  - SOLIDUS_BRANCH=v1.4 DB=postgres
@@ -17,7 +18,6 @@ env:
17
18
  - SOLIDUS_BRANCH=v2.2 DB=postgres
18
19
  - SOLIDUS_BRANCH=v2.3 DB=postgres
19
20
  - SOLIDUS_BRANCH=master DB=postgres
20
- - SOLIDUS_BRANCH=v1.1 DB=mysql
21
21
  - SOLIDUS_BRANCH=v1.2 DB=mysql
22
22
  - SOLIDUS_BRANCH=v1.3 DB=mysql
23
23
  - SOLIDUS_BRANCH=v1.4 DB=mysql
data/Gemfile CHANGED
@@ -5,9 +5,10 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
5
5
  branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
6
6
  gem 'solidus', github: 'solidusio/solidus', branch: branch
7
7
 
8
- gemspec
8
+ gem 'ffaker'
9
+ gem 'mysql2'
10
+ gem 'pg'
11
+ gem 'solidus_auth_devise'
12
+ gem 'sqlite3'
9
13
 
10
- group :test do
11
- gem 'ffaker'
12
- gem 'sqlite3'
13
- end
14
+ gemspec
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  Solidus Culqi
2
2
  =============
3
+ [![Gem Version][rubygems-image]][rubygems-url]
4
+ [![Build Status][travis-image]][travis-url]
3
5
 
4
6
  Add [Culqi](https://www.culqi.com/) support for [solidus](https://solidus.io/) e-commerce.
5
7
 
@@ -28,3 +30,8 @@ First bundle your dependencies, then run `rake`. `rake` will default to building
28
30
  bundle
29
31
  bundle exec rake
30
32
  ```
33
+
34
+ [rubygems-image]: https://badge.fury.io/rb/solidus_culqi.svg
35
+ [rubygems-url]: https://badge.fury.io/rb/solidus_culqi
36
+ [travis-image]: https://travis-ci.org/ccarruitero/solidus_culqi.svg?branch=master
37
+ [travis-url]: https://travis-ci.org/ccarruitero/solidus_culqi
@@ -1,26 +1,17 @@
1
1
  module Solidus
2
- class Gateway::CulqiGateway < ::Spree::Gateway
2
+ class Gateway::CulqiGateway < SolidusCulqi::Gateway.parent_class
3
+ extend SolidusCulqi::Gateway
4
+
3
5
  preference :public_key, :string
4
6
  preference :secret_key, :string
5
7
 
8
+ partial_method 'culqi'
9
+ provider_method self.class
10
+
6
11
  def default_currency
7
12
  "PEN"
8
13
  end
9
14
 
10
- if SolidusSupport.solidus_gem_version < Gem::Version.new('2.3.x')
11
- def method_type
12
- 'culqi'
13
- end
14
- else
15
- def partial_name
16
- 'culqi'
17
- end
18
- end
19
-
20
- def provider_class
21
- self.class
22
- end
23
-
24
15
  def authorize(amount, creditcard, gateway_options)
25
16
  init_culqi
26
17
  commit(amount, creditcard, gateway_options, false)
@@ -37,21 +28,39 @@ module Solidus
37
28
  parse_response(charge)
38
29
  end
39
30
 
40
- def credit(amount, creditcard, _gateway_options)
31
+ def credit(amount, _creditcard, response_code, _gateway_options)
41
32
  init_culqi
42
33
  # Culqi only accepts 'duplicado','fraudulento' o 'solicitud_comprador'
43
34
  # like reason's value
44
35
  refund = Culqi::Refund.create(
45
36
  amount: amount,
46
- charge_id: creditcard,
37
+ charge_id: response_code,
47
38
  reason: "solicitud_comprador"
48
39
  )
49
40
  parse_response(refund)
50
41
  end
51
42
 
52
- def void(creditcard, gateway_options)
43
+ def void(response_code, creditcard, gateway_options)
53
44
  amount = gateway_options[:subtotal].to_i
54
- credit(amount, creditcard, gateway_options)
45
+ credit(amount, creditcard, response_code, gateway_options)
46
+ end
47
+
48
+ def payment_profiles_supported?
49
+ true
50
+ end
51
+
52
+ def create_profile(payment)
53
+ return unless payment.source.gateway_customer_profile_id.nil?
54
+ init_culqi
55
+ customer = get_customer(payment)
56
+ token = payment.source.gateway_payment_profile_id
57
+ card_token = generate_card(customer, token)
58
+ unless customer.nil? || card_token.nil?
59
+ payment.source.update({
60
+ gateway_customer_profile_id: customer,
61
+ gateway_payment_profile_id: card_token
62
+ })
63
+ end
55
64
  end
56
65
 
57
66
  private
@@ -85,5 +94,40 @@ module Solidus
85
94
  authorization: res["id"]
86
95
  )
87
96
  end
97
+
98
+ def find_customer(email)
99
+ res = Culqi::Customer.list
100
+ customers = JSON.parse(res)["data"]
101
+ customers.select { |customer| customer["email"] == email }.first
102
+ end
103
+
104
+ def get_customer(payment)
105
+ address = payment.order.bill_address
106
+ email = payment.order.email
107
+ customer = find_customer(email)
108
+ customer = generate_customer(address, email) if customer.nil?
109
+ customer["id"]
110
+ end
111
+
112
+ def generate_customer(address, email)
113
+ culqi_customer = Culqi::Customer.create(
114
+ address: address.address1,
115
+ address_city: address.state.name,
116
+ country_code: address.country.iso,
117
+ email: email,
118
+ first_name: address.first_name,
119
+ last_name: address.last_name,
120
+ phone_number: address.phone.tr("/() -/", "")
121
+ )
122
+ JSON.parse(culqi_customer)
123
+ end
124
+
125
+ def generate_card(customer, token)
126
+ card = Culqi::Card.create(
127
+ customer_id: customer,
128
+ token_id: token
129
+ )
130
+ JSON.parse(card)["id"]
131
+ end
88
132
  end
89
133
  end
@@ -0,0 +1,3 @@
1
+ <%= render "spree/checkout/existing_payment/gateway",
2
+ wallet_payment_source: wallet_payment_source,
3
+ default: default %>
@@ -1,4 +1,4 @@
1
- class AddInstallmentsToOrders < ActiveRecord::Migration[5.1]
1
+ class AddInstallmentsToOrders < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_orders, :installments, :integer
4
4
  end
@@ -0,0 +1,29 @@
1
+ module SolidusCulqi
2
+ module Gateway
3
+ def self.parent_class
4
+ if SolidusCulqi::Support.solidus_earlier('2.3.x')
5
+ Spree::Gateway
6
+ else
7
+ Spree::PaymentMethod::CreditCard
8
+ end
9
+ end
10
+
11
+ def partial_method(partial_name)
12
+ common_method('method_type', 'partial_name', partial_name)
13
+ end
14
+
15
+ def provider_method(provider_class)
16
+ common_method('provider_class', 'gateway_class', provider_class)
17
+ end
18
+
19
+ private
20
+
21
+ def common_method(old_method, new_method, method_value)
22
+ if SolidusCulqi::Support.solidus_earlier('2.3.x')
23
+ define_method(old_method) { method_value }
24
+ else
25
+ define_method(new_method) { method_value }
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,7 @@
1
+ module SolidusCulqi
2
+ module Support
3
+ def self.solidus_earlier(version)
4
+ SolidusSupport.solidus_gem_version < Gem::Version.new(version)
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module SolidusCulqi
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/solidus_culqi.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'solidus_core'
2
2
  require 'solidus_support'
3
3
  require 'culqi-ruby'
4
+ require 'solidus_culqi/support'
5
+ require 'solidus_culqi/gateway'
4
6
  require 'solidus_culqi/engine'
@@ -29,4 +29,6 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency 'rubocop'
30
30
  s.add_development_dependency 'rubocop-rspec'
31
31
  s.add_development_dependency 'simplecov'
32
+ s.add_development_dependency 'vcr'
33
+ s.add_development_dependency 'webmock'
32
34
  end
@@ -0,0 +1,206 @@
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
+ - Thu, 12 Oct 2017 15:40:57 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=1A99777A77FBED1B8F22DDC666ED6DED; Path=/api/; HttpOnly
42
+ X-Culqi-Tracking-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YXJkcyI6W10sIm1ldGFkYXRhIjp7Im90aGVyX251bWJlciI6Ijc4OTk1MzY1NSJ9fSx7Im9iamVjdCI6ImN1c3RvbWVyIiwiaWQiOiJjdXNfdGVzdF9obmZRRVhFTVhKblBaQTVVIiwiY3JlYXRpb25fZGF0ZSI6MTUwNDM3MTYyNjAwMCwiZW1haWwiOiJ0ZXN0M2QzOWY4ZTctYzQ4Mi00NzE0LThmZjEtNjc2Mjc5Yzg1ZjVkQGN1bHFpLmNvbSIsImFudGlmcmF1ZF9kZXRhaWxzIjp7ImZpcnN0X25hbWUiOiJXaWxsaWFtIiwibGFzdF9uYW1lIjoiTXVybyIsImFkZHJlc3MiOiJBdmVuaWRhIExpbWEgMTIzMjEzIiwiYWRkcmVzc19jaXR5IjoiTElNQSIsImNvdW50cnlfY29kZSI6IlBFIiwicGhvbmUiOiI5OTg5ODk3ODkiLCJvYmplY3QiOiJjbGllbnQifSwiY2FyZHMiOltdLCJtZXRhZGF0YSI6eyJvdGhlcl9udW1iZXIiOiI3ODk5NTM2NTUifX1dLCJwYWdpbmciOnsicHJldmlvdXMiOiJodHRwczovL2FwaS5jdWxxaS5jb20vdjIvY3VzdG9tZXJzP2xpbWl0PTUwJmJlZm9yZT1jdXNfdGVzdF9DQWNTckNrQmw4WlI5YnBUIiwibmV4dCI6Imh0dHBzOi8vYXBpLmN1bHFpLmNvbS92Mi9jdXN0b21lcnM/bGltaXQ9NTAmYWZ0ZXI9Y3VzX3Rlc3RfaG5mUUVYRU1YSm5QWkE1VSIsImN1cnNvcnMiOnsiYmVmb3JlIjoiY3VzX3Rlc3RfQ0FjU3JDa0JsOFpSOWJwVCIsImFmdGVyIjoiY3VzX3Rlc3RfaG5mUUVYRU1YSm5QWkE1VSJ9fX0=
52
+ http_version:
53
+ recorded_at: Thu, 12 Oct 2017 15:40:57 GMT
54
+ - request:
55
+ method: post
56
+ uri: https://api.culqi.com/v2/customers/
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"address":"YT-1300","address_city":"Alabama","country_code":"US","email":"rolf@morissettelubowitz.info","first_name":"Han","last_name":"Solo","phone_number":"5555555555"}'
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
+ - Thu, 12 Oct 2017 15:40:57 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=3DC5DA1924180965D9E407B8A6D576E5; Path=/api/; HttpOnly
93
+ X-Culqi-Tracking-Id:
94
+ - '1924589'
95
+ X-Culqi-Environment:
96
+ - test
97
+ X-Culqi-Version:
98
+ - 2.0.0
99
+ body:
100
+ encoding: UTF-8
101
+ string: '{"object":"customer","id":"cus_test_vzsZCYnldWZeObod","creation_date":1507822857854,"email":"rolf@morissettelubowitz.info","antifraud_details":{"first_name":"Han","last_name":"Solo","address":"YT-1300","address_city":"Alabama","country_code":"US","phone":"5555555555","object":"client"},"metadata":{}}'
102
+ http_version:
103
+ recorded_at: Thu, 12 Oct 2017 15:40:57 GMT
104
+ - request:
105
+ method: post
106
+ uri: https://api.culqi.com/v2/cards/
107
+ body:
108
+ encoding: UTF-8
109
+ string: '{"customer_id":"cus_test_vzsZCYnldWZeObod","token_id":"tkn_test_1lJ0XHkiSysrU99M"}'
110
+ headers:
111
+ Accept-Encoding:
112
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
113
+ Accept:
114
+ - "*/*"
115
+ User-Agent:
116
+ - Ruby
117
+ Host:
118
+ - api.culqi.com
119
+ Authorization:
120
+ - Bearer sk_test_SpwICNI4YT0OSLHY
121
+ Content-Type:
122
+ - application/json
123
+ Cache-Control:
124
+ - no-cache
125
+ response:
126
+ status:
127
+ code: 201
128
+ message: Created
129
+ headers:
130
+ Server:
131
+ - ":"
132
+ - nginx
133
+ Date:
134
+ - Thu, 12 Oct 2017 15:41:01 GMT
135
+ Content-Type:
136
+ - application/json;charset=UTF-8
137
+ Transfer-Encoding:
138
+ - chunked
139
+ Connection:
140
+ - keep-alive
141
+ Set-Cookie:
142
+ - JSESSIONID=7E9A0D09CEC03BABFDFB8FABB5F4B196; Path=/api/; HttpOnly
143
+ X-Culqi-Tracking-Id:
144
+ - '1924590'
145
+ X-Culqi-Environment:
146
+ - test
147
+ X-Culqi-Version:
148
+ - 2.0.0
149
+ body:
150
+ encoding: ASCII-8BIT
151
+ string: !binary |-
152
+ eyJvYmplY3QiOiJjYXJkIiwiaWQiOiJjcmRfdGVzdF9tNVFYWDd0dEMzYzIxZnNtIiwiYWN0aXZlIjp0cnVlLCJjcmVhdGlvbl9kYXRlIjoxNTA3ODIyODYxODgwLCJjdXN0b21lcl9pZCI6ImN1c190ZXN0X3Z6c1pDWW5sZFdaZU9ib2QiLCJzb3VyY2UiOnsib2JqZWN0IjoidG9rZW4iLCJpZCI6InRrbl90ZXN0XzFsSjBYSGtpU3lzclU5OU0iLCJ0eXBlIjoiY2FyZCIsImNyZWF0aW9uX2RhdGUiOjE1MDc4MjI4NTEwMDAsImVtYWlsIjoicm9sZkBtb3Jpc3NldHRlbHVib3dpdHouaW5mbyIsImNhcmRfbnVtYmVyIjoiNDExMTExKioqKioqMTExMSIsImxhc3RfZm91ciI6IjExMTEiLCJhY3RpdmUiOnRydWUsImlpbiI6eyJvYmplY3QiOiJpaW4iLCJiaW4iOiI0MTExMTEiLCJjYXJkX2JyYW5kIjoiVmlzYSIsImNhcmRfdHlwZSI6ImNyZWRpdG8iLCJjYXJkX2NhdGVnb3J5IjoiQ2zDoXNpY2EiLCJpc3N1ZXIiOnsibmFtZSI6IkpQTU9SR0FOIENIQVNFIEJBTkssIE4uQS4iLCJjb3VudHJ5IjoiVU5JVEVEIFNUQVRFUyIsImNvdW50cnlfY29kZSI6IlVTIiwid2Vic2l0ZSI6bnVsbCwicGhvbmVfbnVtYmVyIjpudWxsfSwiaW5zdGFsbG1lbnRzX2FsbG93ZWQiOlsyLDQsNiw4LDEwLDEyXX0sImNsaWVudCI6eyJpcCI6IjE3OS43LjE1My4yMjQiLCJpcF9jb3VudHJ5IjoiUGVyw7oiLCJpcF9jb3VudHJ5X2NvZGUiOiJQRSIsImJyb3dzZXIiOm51bGwsImRldmljZV9maW5nZXJwcmludCI6IjEzNDc0MDk5MzUiLCJkZXZpY2VfdHlwZSI6IkVzY3JpdG9yaW8ifSwibWV0YWRhdGEiOnsiY2xpZW50X2lwIjoiMTc5LjcuMTUzLjIyNCJ9fSwibWV0YWRhdGEiOnt9fQ==
153
+ http_version:
154
+ recorded_at: Thu, 12 Oct 2017 15:41:01 GMT
155
+ - request:
156
+ method: post
157
+ uri: https://api.culqi.com/v2/charges/
158
+ body:
159
+ encoding: UTF-8
160
+ string: '{"amount":1999,"capture":false,"currency_code":"PEN","description":null,"email":"rolf@morissettelubowitz.info","installments":2,"source_id":"crd_test_m5QXX7ttC3c21fsm"}'
161
+ headers:
162
+ Accept-Encoding:
163
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
164
+ Accept:
165
+ - "*/*"
166
+ User-Agent:
167
+ - Ruby
168
+ Host:
169
+ - api.culqi.com
170
+ Authorization:
171
+ - Bearer sk_test_SpwICNI4YT0OSLHY
172
+ Content-Type:
173
+ - application/json
174
+ Cache-Control:
175
+ - no-cache
176
+ response:
177
+ status:
178
+ code: 201
179
+ message: Created
180
+ headers:
181
+ Server:
182
+ - ":"
183
+ - nginx
184
+ Date:
185
+ - Thu, 12 Oct 2017 15:41:07 GMT
186
+ Content-Type:
187
+ - application/json;charset=UTF-8
188
+ Transfer-Encoding:
189
+ - chunked
190
+ Connection:
191
+ - keep-alive
192
+ Set-Cookie:
193
+ - JSESSIONID=6B2295AC0FD7453289E0E5C21CBBACE1; Path=/api/; HttpOnly
194
+ X-Culqi-Tracking-Id:
195
+ - '1924594'
196
+ X-Culqi-Environment:
197
+ - test
198
+ X-Culqi-Version:
199
+ - 2.0.0
200
+ body:
201
+ encoding: ASCII-8BIT
202
+ string: !binary |-
203
+ eyJkdXBsaWNhdGVkIjpmYWxzZSwib2JqZWN0IjoiY2hhcmdlIiwiaWQiOiJjaHJfdGVzdF9LTVdNcGZBZk9YaTczT0tEIiwiY3JlYXRpb25fZGF0ZSI6MTUwNzgyMjg2NTAwMCwiYW1vdW50IjoxOTk5LCJhbW91bnRfcmVmdW5kZWQiOjAsImN1cnJlbnRfYW1vdW50IjoxOTk5LCJpbnN0YWxsbWVudHMiOjIsImluc3RhbGxtZW50c19hbW91bnQiOjk5OSwiY3VycmVuY3lfY29kZSI6IlBFTiIsImVtYWlsIjoicm9sZkBtb3Jpc3NldHRlbHVib3dpdHouaW5mbyIsImRlc2NyaXB0aW9uIjpudWxsLCJzb3VyY2UiOnsib2JqZWN0IjoiY2FyZCIsImlkIjoiY3JkX3Rlc3RfbTVRWFg3dHRDM2MyMWZzbSIsImFjdGl2ZSI6dHJ1ZSwiY3JlYXRpb25fZGF0ZSI6MTUwNzgyMjg2MTAwMCwiY3VzdG9tZXJfaWQiOiJjdXNfdGVzdF92enNaQ1lubGRXWmVPYm9kIiwic291cmNlIjp7Im9iamVjdCI6InRva2VuIiwiaWQiOiJ0a25fdGVzdF8xbEowWEhraVN5c3JVOTlNIiwidHlwZSI6ImNhcmQiLCJjcmVhdGlvbl9kYXRlIjoxNTA3ODIyODUxMDAwLCJlbWFpbCI6InJvbGZAbW9yaXNzZXR0ZWx1Ym93aXR6LmluZm8iLCJjYXJkX251bWJlciI6IjQxMTExMSoqKioqKjExMTEiLCJsYXN0X2ZvdXIiOiIxMTExIiwiYWN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