sage_pay 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.11
4
+
5
+ * Cancel support for cancelling existing authorised transactions.
6
+
3
7
  ## 0.2.10
4
8
 
5
9
  * Authorise support, I hope, which, again I hope, will make repeat actually work.
data/Rakefile CHANGED
@@ -94,7 +94,7 @@ task :release => :build do
94
94
  end
95
95
 
96
96
  desc "Build the gem"
97
- task :build => :gemspec do
97
+ task :build => [:spec, :gemspec] do
98
98
  sh "mkdir -p pkg"
99
99
  sh "gem build #{gemspec_file}"
100
100
  sh "mv #{gem_file} pkg"
data/lib/sage_pay.rb CHANGED
@@ -7,7 +7,7 @@ require 'md5'
7
7
  require 'uuid'
8
8
 
9
9
  module SagePay
10
- VERSION = '0.2.10'
10
+ VERSION = '0.2.11'
11
11
  end
12
12
 
13
13
  require 'validatable-ext'
@@ -30,4 +30,5 @@ require 'sage_pay/server/refund_response'
30
30
  require 'sage_pay/server/repeat'
31
31
  require 'sage_pay/server/repeat_response'
32
32
  require 'sage_pay/server/authorise'
33
+ require 'sage_pay/server/cancel'
33
34
  require 'sage_pay/server'
@@ -76,6 +76,13 @@ module SagePay
76
76
  SagePay::Server::Authorise.new(defaults.merge(attributes))
77
77
  end
78
78
 
79
+ def self.cancel(attributes = {})
80
+ defaults = {
81
+ }.merge(default_options)
82
+
83
+ SagePay::Server::Cancel.new(defaults.merge(attributes))
84
+ end
85
+
79
86
  def self.repeat(attributes = {})
80
87
  defaults = {
81
88
  :vendor_tx_code => TransactionCode.random,
@@ -0,0 +1,29 @@
1
+ module SagePay
2
+ module Server
3
+ class Cancel < Command
4
+ self.tx_type = :cancel
5
+
6
+ attr_accessor :vps_tx_id, :security_key
7
+
8
+ validates_presence_of :vps_tx_id, :security_key
9
+
10
+ validates_length_of :vps_tx_id, :is => 38
11
+ validates_length_of :security_key, :is => 10
12
+
13
+ def post_params
14
+ super.merge({
15
+ "VPSTxId" => vps_tx_id,
16
+ "SecurityKey" => security_key
17
+ })
18
+ end
19
+
20
+ def live_service
21
+ "cancel"
22
+ end
23
+
24
+ def simulator_service
25
+ "VendorCancelTx"
26
+ end
27
+ end
28
+ end
29
+ end
data/sage_pay.gemspec CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'sage_pay'
10
- s.version = '0.2.10'
11
- s.date = '2010-04-25'
10
+ s.version = '0.2.11'
11
+ s.date = '2010-04-28'
12
12
  s.rubyforge_project = 'sage_pay'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
@@ -59,6 +59,7 @@ gateway for accepting credit card payments through your web app.
59
59
  lib/sage_pay/server/abort.rb
60
60
  lib/sage_pay/server/address.rb
61
61
  lib/sage_pay/server/authorise.rb
62
+ lib/sage_pay/server/cancel.rb
62
63
  lib/sage_pay/server/command.rb
63
64
  lib/sage_pay/server/notification.rb
64
65
  lib/sage_pay/server/notification_response.rb
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe SagePay do
4
- it "should be version 0.2.10" do
5
- SagePay::VERSION.should == '0.2.10'
4
+ it "should be version 0.2.11" do
5
+ SagePay::VERSION.should == '0.2.11'
6
6
  end
7
7
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 10
9
- version: 0.2.10
8
+ - 11
9
+ version: 0.2.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - Graeme Mathieson
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-25 00:00:00 +01:00
17
+ date: 2010-04-28 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -80,6 +80,7 @@ files:
80
80
  - lib/sage_pay/server/abort.rb
81
81
  - lib/sage_pay/server/address.rb
82
82
  - lib/sage_pay/server/authorise.rb
83
+ - lib/sage_pay/server/cancel.rb
83
84
  - lib/sage_pay/server/command.rb
84
85
  - lib/sage_pay/server/notification.rb
85
86
  - lib/sage_pay/server/notification_response.rb