klarna-checkout 1.1.1 → 1.1.2
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b171d07a02e73e397bdbd37a9d98005e4e820e7f
|
4
|
+
data.tar.gz: b83100462a3715a474eafcebd762bc8a5b436e33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4302033685d53f8a921597f3bde504b6ce900fc764bd63465d2c15f115a9eba08441c7fe4ca0a684b4b109d14ea1fe989ceb2db902b493377dbc48ac0208a2f8
|
7
|
+
data.tar.gz: 5e8b8dd0b8869771256bf4961a8e2914a89967b1fb0b84069d0541dd0db5feb98ff90df77c5057ea79e310ddb3daca29069f0f7f567f654f43c99c25e4e0d98b
|
@@ -25,15 +25,22 @@ module Klarna
|
|
25
25
|
validate :cart_validation
|
26
26
|
|
27
27
|
def as_json
|
28
|
-
json_sanitize({
|
28
|
+
json = json_sanitize({
|
29
29
|
:merchant_reference => (@merchant_reference && @merchant_reference.as_json),
|
30
30
|
:purchase_country => @purchase_country,
|
31
31
|
:purchase_currency => @purchase_currency,
|
32
32
|
:locale => @locale,
|
33
33
|
:cart => @cart.as_json,
|
34
|
-
:gui => @gui.as_json,
|
34
|
+
:gui => (@gui && @gui.as_json),
|
35
35
|
:merchant => @merchant.as_json
|
36
36
|
})
|
37
|
+
if id || json[:gui].nil?
|
38
|
+
json.delete(:gui)
|
39
|
+
end
|
40
|
+
if id
|
41
|
+
json.delete(:merchant)
|
42
|
+
end
|
43
|
+
json
|
37
44
|
end
|
38
45
|
|
39
46
|
private
|
@@ -188,6 +188,16 @@ describe Klarna::Checkout::Order do
|
|
188
188
|
json_hash
|
189
189
|
end
|
190
190
|
|
191
|
+
shared_examples_for "it's not included when order has ID" do
|
192
|
+
context "when 'id' is set" do
|
193
|
+
before(:each) do
|
194
|
+
order.id = 'foobar'
|
195
|
+
end
|
196
|
+
|
197
|
+
it { should be_nil }
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
191
201
|
describe "merchant_reference" do
|
192
202
|
subject { json_hash[:merchant_reference] }
|
193
203
|
|
@@ -217,12 +227,16 @@ describe Klarna::Checkout::Order do
|
|
217
227
|
its([:checkout_uri]) { should eq 'http://www.example.com/checkout' }
|
218
228
|
its([:confirmation_uri]) { should eq 'http://www.example.com/confirmation_uri' }
|
219
229
|
its([:push_uri]) { should eq 'http://www.example.com/push' }
|
230
|
+
|
231
|
+
it_behaves_like "it's not included when order has ID"
|
220
232
|
end
|
221
233
|
|
222
234
|
describe "gui" do
|
223
235
|
subject { json_hash[:gui] }
|
224
236
|
|
225
237
|
its([:layout]) { should eq 'desktop' }
|
238
|
+
|
239
|
+
it_behaves_like "it's not included when order has ID"
|
226
240
|
end
|
227
241
|
end
|
228
242
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klarna-checkout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theodor Tonum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|