klarna-checkout 1.1.1 → 1.1.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: 2625382d75e0c3546376625acbb48bfa3e262d37
4
- data.tar.gz: 5f0ef99528382d3e8eddb9fbab48b0b634d4bfe0
3
+ metadata.gz: b171d07a02e73e397bdbd37a9d98005e4e820e7f
4
+ data.tar.gz: b83100462a3715a474eafcebd762bc8a5b436e33
5
5
  SHA512:
6
- metadata.gz: 0297e5a3afaeea8d27862390b3302c8d227f4bd58f0c5f413ea8cb83c5168065b1665cc78332c0933c7d6014cd73554799062d0f1c821780b86645fab9356d63
7
- data.tar.gz: 0a351368f68606e52c3812f25289af2ffec0efa1ca3d7aad6aa0c7ff0505bfb915047550f6c0ef4bf9b382d0cbeca88e4cb60922e7d24f08a9b31568bd65c33c
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
@@ -1,5 +1,5 @@
1
1
  module Klarna
2
2
  module Checkout
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  require 'klarna/checkout/version'
2
2
 
3
3
  describe Klarna::Checkout::VERSION do
4
- it { should eq '1.1.1' }
4
+ it { should eq '1.1.2' }
5
5
  end
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.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-12 00:00:00.000000000 Z
11
+ date: 2014-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday