Skip to content

Commit

Permalink
Update interface for 'get addresses' and 'reserve_amount' to match 'a…
Browse files Browse the repository at this point in the history
…ctivate's interface
  • Loading branch information
Hagai Levin committed Jul 21, 2013
1 parent 3bd8840 commit a85cf27
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/klarna/methods/get_addresses.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'digest'

module Klarna
module Methods
module GetAddresses
Expand All @@ -6,7 +8,7 @@ def self.name
'get_addresses'
end

def self.params(store_id, store_secret, params)
def self.params(store_id, store_secret, api_version, client_name, params)
[
params[:pno],
store_id,
Expand Down
4 changes: 3 additions & 1 deletion lib/klarna/methods/reserve_amount.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
require 'digest'

module Klarna
module Methods
module ReserveAmount
def self.name
'reserve_amount'
end

def self.params(store_id, store_secret, params)
def self.params(store_id, store_secret, api_version, client_name, params)
[
params[:pno],
params.fetch(:gender, ''),
Expand Down
4 changes: 3 additions & 1 deletion spec/lib/klarna/methods/get_addresses_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@

let(:store_id) { ENV['KLARNA_STORE_ID'] }
let(:store_secret) { ENV['KLARNA_STORE_SECRET'] }
let(:api_version) { Klarna::Client::KLARNA_API_VERSION }
let(:client_name) { Klarna::Client::CLIENT_NAME }

let(:method_params) do
subject.params(store_id, store_secret, params)
subject.params(store_id, store_secret, api_version, client_name, params)
end

it 'returns an array of 6 elements' do
Expand Down
6 changes: 5 additions & 1 deletion spec/lib/klarna/methods/reserve_amount_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: UTF-8

require 'spec_helper'

describe Klarna::Methods::ReserveAmount do
Expand Down Expand Up @@ -62,9 +64,11 @@

let(:store_id) { ENV['KLARNA_STORE_ID'] }
let(:store_secret) { ENV['KLARNA_STORE_SECRET'] }
let(:api_version) { Klarna::Client::KLARNA_API_VERSION }
let(:client_name) { Klarna::Client::CLIENT_NAME }

let(:method_params) do
subject.params(store_id, store_secret, params)
subject.params(store_id, store_secret, api_version, client_name, params)
end

it 'returns an array of 26 elements' do
Expand Down

0 comments on commit a85cf27

Please sign in to comment.