Permalink
Browse files

Support payRequest successExpiration

  • Loading branch information...
1 parent 837aaf0 commit fb699f5773f9b3e21586a4ddd960e1ca48c405c5 @exviva committed Sep 28, 2012
View
@@ -32,7 +32,8 @@ Now you can initiate a transaction at ClickandBuy:
order_id: 123, # your unique order identifier
ip: '1.2.3.4', # user's IP address
order_description: 'ACME Earthquake Pills', # what the user is buying
- locale: 'en' # user's locale ('en' or 'de')
+ locale: 'en', # user's locale ('en' or 'de')
+ success_expiration: 1439 # (optional) how many minutes to wait for success
}
response = gateway.setup_purchase(amount, options)
@@ -22,6 +22,7 @@ def details(xml)
xml.externalID @options[:order_id]
xml.consumerIPAddress @options[:ip]
xml.consumerLanguage @options[:locale]
+ xml.successExpiration @options[:success_expiration] if @options.key?(:success_expiration)
end
def extract_response_details(response)
@@ -5,7 +5,7 @@
let(:gateway) { described_class.new(auth) }
let(:amount) { Money.new(1000, 'EUR') }
let(:order_id) { Time.now.to_i }
- let(:setup_purchase_options) { {success_url: 'http://example.com', failure_url: 'http://example.com', order_id: order_id, ip: '1.2.3.4', order_description: '', locale: 'en'} }
+ let(:setup_purchase_options) { {success_url: 'http://example.com', failure_url: 'http://example.com', order_id: order_id, ip: '1.2.3.4', order_description: '', locale: 'en', success_expiration: 30} }
def perform_setup_purchase
gateway.setup_purchase(amount, setup_purchase_options)
@@ -59,6 +59,18 @@
it 'uses the locale option for consumerLanguage' do
details['consumerLanguage'].should eq(locale)
end
+
+ it 'does not have successExpiration' do
+ details.should_not have_key('successExpiration')
+ end
+
+ describe 'with success_expiration provided' do
+ before { options[:success_expiration] = 1439 }
+
+ it 'uses the success_expiration option for successExpiration' do
+ details['successExpiration'].should eq('1439')
+ end
+ end
end
describe '#handle_response' do

0 comments on commit fb699f5

Please sign in to comment.