Class: Docdata::Order::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/docdata/order/client.rb

Overview

Client for the Docdata Order API.

Constant Summary collapse

XMLNS_DDP =
'http://www.docdatapayments.com/services/paymentservice/1_3/'
DDP_VERSION =
'1.3'

Instance Method Summary collapse

Constructor Details

#initialize(name, password, options = {}) ⇒ Client

Returns a new instance of Client.



12
13
14
# File 'lib/docdata/order/client.rb', line 12

def initialize(name, password, options = {})
  @options = options.merge(merchant: { name: name, password: password })
end

Instance Method Details

#create(options = {}) ⇒ Object



16
17
18
19
20
21
# File 'lib/docdata/order/client.rb', line 16

def create(options = {})
  params = @options.merge(options)
  response = call(:create, CreateRequest.new(params))

  CreateResponse.new(params, response)
end

#payment_methods(options = {}) ⇒ Object



44
45
46
47
48
49
# File 'lib/docdata/order/client.rb', line 44

def payment_methods(options = {})
  params = @options.merge(options)
  response = call(:list_payment_methods, ListPaymentMethodsRequest.new(params))

  ListPaymentMethodsResponse.new(params, response)
end

#refund(options = {}) ⇒ Object



37
38
39
40
41
42
# File 'lib/docdata/order/client.rb', line 37

def refund(options = {})
  params = @options.merge(options)
  response = call(:refund, RefundRequest.new(params))

  RefundResponse.new(params, response)
end

#start(options = {}) ⇒ Object



23
24
25
26
27
28
# File 'lib/docdata/order/client.rb', line 23

def start(options = {})
  params = @options.merge(options)
  response = call(:start, StartRequest.new(params))

  StartResponse.new(params, response)
end

#status(options = {}) ⇒ Object



30
31
32
33
34
35
# File 'lib/docdata/order/client.rb', line 30

def status(options = {})
  params = @options.merge(options)
  response = call(:status_extended, ExtendedStatusRequest.new(params))

  ExtendedStatusResponse.new(params, response)
end