Class: Kemen::KGestPay

Inherits:
Object
  • Object
show all
Defined in:
lib/kgestpay.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ KGestPay

Returns a new instance of KGestPay.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
# File 'lib/kgestpay.rb', line 7

def initialize(args)
  raise(ArgumentError.new(" Missing argument [:shopLogin] Variable @shopLogin cannot be initiliazed.")) if args[:shopLogin].nil?
  raise(ArgumentError.new(" Missing argument [:endpoint] Variable @endpoint cannot be initiliazed.")) if args[:endpoint].nil?
  @shopLogin = args[:shopLogin]
  @endpoint = args[:endpoint]
  #create the ws instance
  @ws = SOAP::WSDLDriverFactory.new("#{@endpoint}?WSDL").create_rpc_driver
  super
end

Instance Method Details

#callDeleteS2S(args) ⇒ Object

Raises:

  • (ArgumentError)


49
50
51
52
53
54
55
56
57
58
59
# File 'lib/kgestpay.rb', line 49

def callDeleteS2S(args)

  #conditional requirments
  raise(ArgumentError.new("One between the parameters [:bankTransactionId] or [:shopTransactionId] is required.")) if args[:bankTransactionId].nil? && args[:shopTransactionId].nil?

  args[:shopLogin] = @shopLogin

  #invoke the gestpay webservice method and return the result
  @ws.callDeleteS2S(args).callDeleteS2SResult.gestPayS2S

end

#callPagamS2S(args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/kgestpay.rb', line 17

def callPagamS2S(args)

  #Required arguments
  [:uicCode, :amount, :shopTransactionId, :cardNumber, :expiryMonth, :expiryYear, :cvv, :buyerName, :buyerEmail].each do |arg|
    raise(ArgumentError.new("Parameter [:#{arg}] is required but has not been passed")) if args[arg.to_sym].nil?
  end

  args[:shopLogin] = @shopLogin

  #invoke the gestpay webservice method and return the result
  @ws.callPagamS2S(args).callPagamS2SResult.gestPayS2S

end

#callReadTrxS2S(args) ⇒ Object

Raises:

  • (ArgumentError)


79
80
81
82
83
84
85
86
87
88
89
# File 'lib/kgestpay.rb', line 79

def callReadTrxS2S(args)

  #conditional requirments
  raise(ArgumentError.new("One between the parameters [:bankTransactionId] or [:shopTransactionId] is required.")) if args[:bankTransactionId].nil? && args[:shopTransactionId].nil?

  args[:shopLogin] = @shopLogin

  #invoke the gestpay webservice method and return the result
  @ws.callReadTrxS2S(args).callReadTrxS2SResult.gestPayS2S

end

#callRefundS2S(args) ⇒ Object

Raises:

  • (ArgumentError)


62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/kgestpay.rb', line 62

def callRefundS2S(args)

  #Required arguments
  [:uicCode, :amount].each do |arg|
    raise(ArgumentError.new("Parameter [:#{arg}] is required but has not been passed")) if args[arg.to_sym].nil?
  end

  #conditional requirments
  raise(ArgumentError.new("One between the parameters [:bankTransactionId] or [:shopTransactionId] is required.")) if args[:bankTransactionId].nil? && args[:shopTransactionId].nil?

  args[:shopLogin] = @shopLogin

  #invoke the gestpay webservice method and return the result
  @ws.callRefundS2S(args).callRefundS2SResult.gestPayS2S

end

#callSettleS2S(args) ⇒ Object

Raises:

  • (ArgumentError)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/kgestpay.rb', line 31

def callSettleS2S(args)

  #Required arguments
  [:uicCode, :amount].each do |arg|
    raise(ArgumentError.new("Parameter [:#{arg}] is required but has not been passed")) if args[arg.to_sym].nil?
  end

  #conditional requirments
  raise(ArgumentError.new("One between the parameters [:bankTransID] or [:shopTransID] is required.")) if args[:bankTransID].nil? && args[:shopTransID].nil?

  args[:shopLogin] = @shopLogin

  #invoke the gestpay webservice method and return the result
  @ws.callSettleS2S(args).callSettleS2SResult.gestPayS2S

end

#callVerifycardS2S(args) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/kgestpay.rb', line 91

def callVerifycardS2S(args)

  #Required arguments
  [:shopTransactionId, :cardNumber, :expiryMonth, :expiryYear, :cvv2].each do |arg|
    raise(ArgumentError.new("Parameter [:#{arg}] is required but has not been passed")) if args[arg.to_sym].nil?
  end

  args[:shopLogin] = @shopLogin

  #invoke the gestpay webservice method and return the result
  @ws.callVerifycardS2S(args).callVerifycardS2SResult.gestPayS2S

end