Module: SagePay::Server

Defined in:
lib/sage_pay/server.rb,
lib/sage_pay/server/abort.rb,
lib/sage_pay/server/cancel.rb,
lib/sage_pay/server/refund.rb,
lib/sage_pay/server/repeat.rb,
lib/sage_pay/server/address.rb,
lib/sage_pay/server/command.rb,
lib/sage_pay/server/release.rb,
lib/sage_pay/server/response.rb,
lib/sage_pay/server/authorise.rb,
lib/sage_pay/server/notification.rb,
lib/sage_pay/server/registration.rb,
lib/sage_pay/server/refund_response.rb,
lib/sage_pay/server/repeat_response.rb,
lib/sage_pay/server/transaction_code.rb,
lib/sage_pay/server/related_transaction.rb,
lib/sage_pay/server/notification_response.rb,
lib/sage_pay/server/registration_response.rb,
lib/sage_pay/server/signature_verification_details.rb

Defined Under Namespace

Classes: Abort, Address, Authorise, Cancel, Command, Notification, NotificationResponse, Refund, RefundResponse, Registration, RegistrationResponse, RelatedTransaction, Release, Repeat, RepeatResponse, Response, SignatureVerificationDetails, TransactionCode

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.default_registration_optionsObject

Returns the value of attribute default_registration_options.



4
5
6
# File 'lib/sage_pay/server.rb', line 4

def default_registration_options
  @default_registration_options
end

Class Method Details

.abort(attributes = {}) ⇒ Object



57
58
59
60
61
62
# File 'lib/sage_pay/server.rb', line 57

def self.abort(attributes = {})
  defaults = {
  }.merge(default_options)

  SagePay::Server::Abort.new(defaults.merge(attributes))
end

.authenticate(attributes = {}) ⇒ Object



37
38
39
# File 'lib/sage_pay/server.rb', line 37

def self.authenticate(attributes = {})
  registration({ :tx_type => :authenticate }.merge(attributes))
end

.authorise(attributes = {}) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/sage_pay/server.rb', line 72

def self.authorise(attributes = {})
  defaults = {
    :vendor_tx_code => TransactionCode.random,
  }.merge(default_options)

  SagePay::Server::Authorise.new(defaults.merge(attributes))
end

.cancel(attributes = {}) ⇒ Object



80
81
82
83
84
85
# File 'lib/sage_pay/server.rb', line 80

def self.cancel(attributes = {})
  defaults = {
  }.merge(default_options)

  SagePay::Server::Cancel.new(defaults.merge(attributes))
end

.default_optionsObject

The notification URL is only relevant to registration options, but the rest are relevant to all requests. FIXME: This should be Hash#only instead of Hash#except!



21
22
23
# File 'lib/sage_pay/server.rb', line 21

def self.default_options
  default_registration_options.except(:notification_url, :profile)
end

.deferred(attributes = {}) ⇒ Object



33
34
35
# File 'lib/sage_pay/server.rb', line 33

def self.deferred(attributes = {})
  registration({ :tx_type => :deferred }.merge(attributes))
end

.payment(attributes = {}) ⇒ Object



29
30
31
# File 'lib/sage_pay/server.rb', line 29

def self.payment(attributes = {})
  registration({ :tx_type => :payment }.merge(attributes))
end

.refund(attributes = {}) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/sage_pay/server.rb', line 64

def self.refund(attributes = {})
  defaults = {
    :vendor_tx_code => TransactionCode.random,
  }.merge(default_options)

  SagePay::Server::Refund.new(defaults.merge(attributes))
end

.registration(attributes) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/sage_pay/server.rb', line 41

def self.registration(attributes)
  defaults = {
    :vendor_tx_code   => TransactionCode.random,
    :delivery_address => attributes[:billing_address]
  }.merge(default_registration_options)

  SagePay::Server::Registration.new(defaults.merge(attributes))
end


25
26
27
# File 'lib/sage_pay/server.rb', line 25

def self.related_transaction(attributes = {})
  SagePay::Server::RelatedTransaction.new(attributes)
end

.release(attributes = {}) ⇒ Object



50
51
52
53
54
55
# File 'lib/sage_pay/server.rb', line 50

def self.release(attributes = {})
  defaults = {
  }.merge(default_options)

  SagePay::Server::Release.new(defaults.merge(attributes))
end

.repeat(attributes = {}) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/sage_pay/server.rb', line 87

def self.repeat(attributes = {})
  defaults = {
    :vendor_tx_code => TransactionCode.random,
  }.merge(default_options)

  SagePay::Server::Repeat.new(defaults.merge(attributes))
end