Class: Pesamoni::DefaultApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pesamoni_ruby/api/default_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DefaultApi

Returns a new instance of DefaultApi.



15
16
17
# File 'lib/pesamoni_ruby/api/default_api.rb', line 15

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



13
14
15
# File 'lib/pesamoni_ruby/api/default_api.rb', line 13

def api_client
  @api_client
end

Instance Method Details

#transactions_post(method, amount, opts = {}) ⇒ InlineResponse200

Below are parameters and their respective expected responses. In order to try out the service, simply click Try it out.

Parameters:

  • method

    Enter a request method. To check for request methods <a href=''>click here</a>

  • amount

    Enter the amount you would like to request for. <p style="color:red">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, acsendbank, pesab2c, sendairtime, cardaccept</b></p>

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :mobile (String)

    Enter the mobile number you would like to execute the above method in format 256.… or 254…<p style="color:red">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, senderid, sendsms, sendairtime</b></p>

  • :holdername (String)

    Enter name of payer for Visa/MasterCard transactions<p style="color:red">This method applies for request method <b>cardaccept</b></p>

  • :cardnumber (String)

    Enter the Visa/MasterCard cardnumber<p style="color:red">This method applies for request method <b>cardaccept</b></p>

  • :cvv (String)

    Enter the Visa/MasterCard cvv<p style="color:red">This method applies for request method <b>cardaccept</b></p>

  • :exp (String)

    Enter the Visa/MasterCard expiry date in the format MM/YYYY e.g 07/2030<p style="color:red">This method applies for request method <b>cardaccept</b></p>

  • :currency (String)

    Enter the currency you intend to make the transaction for Visa/MasterCard based transactions<p style="color:red">This method applies for request method <b>cardaccept</b></p>

  • :account (String)

    Enter the Pesamoni account you would like to use for this transaction<p style="color:red">This method applies for request method <b>paybills</b></p>

  • :reference (String)

    Enter your user generated transaction reference<p style="color:red">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p>

  • :genericmsg (String)

    Enter your user generated generic message for the requested transaction<p style="color:red">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p>

  • :token (String)

    Enter your user generated token for the above mentioned method<p style="color:red">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p>

  • :bouquet (String)

    Enter the bouquet or package you would like to pay for<p style="color:red">This method applies for request methods <b>paybills</b></p>

  • :payoption (String)

    Enter your prefered payment option<p style="color:red">This method applies for request methods <b>paybills</b></p>

  • :meternumber (String)

    Enter the meter number for the intended payment<p style="color:red">This method applies for request methods <b>paybills</b></p>

Returns:



36
37
38
39
# File 'lib/pesamoni_ruby/api/default_api.rb', line 36

def transactions_post(method, amount, opts = {})
  data, _status_code, _headers = transactions_post_with_http_info(method, amount, opts)
  data
end

#transactions_post_with_http_info(method, amount, opts = {}) ⇒ Array<(InlineResponse200, Fixnum, Hash)>

Below are parameters and their respective expected responses. In order to try out the service, simply click Try it out.

Parameters:

  • method

    Enter a request method. To check for request methods &lt;a href&#x3D;&#39;&#39;&gt;click here&lt;/a&gt;

  • amount

    Enter the amount you would like to request for. &lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request methods &lt;b&gt;acreceive, acreceivekeac, acsend, acsendkeac, acsendbank, pesab2c, sendairtime, cardaccept&lt;/b&gt;&lt;/p&gt;

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :mobile (String)

    Enter the mobile number you would like to execute the above method in format 256.… or 254…&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request methods &lt;b&gt;acreceive, acreceivekeac, acsend, acsendkeac, senderid, sendsms, sendairtime&lt;/b&gt;&lt;/p&gt;

  • :holdername (String)

    Enter name of payer for Visa/MasterCard transactions&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request method &lt;b&gt;cardaccept&lt;/b&gt;&lt;/p&gt;

  • :cardnumber (String)

    Enter the Visa/MasterCard cardnumber&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request method &lt;b&gt;cardaccept&lt;/b&gt;&lt;/p&gt;

  • :cvv (String)

    Enter the Visa/MasterCard cvv&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request method &lt;b&gt;cardaccept&lt;/b&gt;&lt;/p&gt;

  • :exp (String)

    Enter the Visa/MasterCard expiry date in the format MM/YYYY e.g 07/2030&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request method &lt;b&gt;cardaccept&lt;/b&gt;&lt;/p&gt;

  • :currency (String)

    Enter the currency you intend to make the transaction for Visa/MasterCard based transactions&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request method &lt;b&gt;cardaccept&lt;/b&gt;&lt;/p&gt;

  • :account (String)

    Enter the Pesamoni account you would like to use for this transaction&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request method &lt;b&gt;paybills&lt;/b&gt;&lt;/p&gt;

  • :reference (String)

    Enter your user generated transaction reference&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request methods &lt;b&gt;acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept&lt;/b&gt;&lt;/p&gt;

  • :genericmsg (String)

    Enter your user generated generic message for the requested transaction&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request methods &lt;b&gt;acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept&lt;/b&gt;&lt;/p&gt;

  • :token (String)

    Enter your user generated token for the above mentioned method&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request methods &lt;b&gt;acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept&lt;/b&gt;&lt;/p&gt;

  • :bouquet (String)

    Enter the bouquet or package you would like to pay for&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request methods &lt;b&gt;paybills&lt;/b&gt;&lt;/p&gt;

  • :payoption (String)

    Enter your prefered payment option&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request methods &lt;b&gt;paybills&lt;/b&gt;&lt;/p&gt;

  • :meternumber (String)

    Enter the meter number for the intended payment&lt;p style&#x3D;&quot;color:red&quot;&gt;This method applies for request methods &lt;b&gt;paybills&lt;/b&gt;&lt;/p&gt;

Returns:

  • (Array<(InlineResponse200, Fixnum, Hash)>)

    InlineResponse200 data, response status code and response headers



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/pesamoni_ruby/api/default_api.rb', line 59

def transactions_post_with_http_info(method, amount, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_post ...'
  end
  # verify the required parameter 'method' is set
  if @api_client.config.client_side_validation && method.nil?
    fail ArgumentError, "Missing the required parameter 'method' when calling DefaultApi.transactions_post"
  end
  if @api_client.config.client_side_validation && method < 1
    fail ArgumentError, 'invalid value for "method" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  # verify the required parameter 'amount' is set
  if @api_client.config.client_side_validation && amount.nil?
    fail ArgumentError, "Missing the required parameter 'amount' when calling DefaultApi.transactions_post"
  end
  if @api_client.config.client_side_validation && amount < 1
    fail ArgumentError, 'invalid value for "amount" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'mobile'].nil? && opts[:'mobile'] < 1
    fail ArgumentError, 'invalid value for "opts[:"mobile"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'holdername'].nil? && opts[:'holdername'] < 1
    fail ArgumentError, 'invalid value for "opts[:"holdername"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'cardnumber'].nil? && opts[:'cardnumber'] < 1
    fail ArgumentError, 'invalid value for "opts[:"cardnumber"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'cvv'].nil? && opts[:'cvv'] < 1
    fail ArgumentError, 'invalid value for "opts[:"cvv"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'exp'].nil? && opts[:'exp'] < 1
    fail ArgumentError, 'invalid value for "opts[:"exp"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'currency'].nil? && opts[:'currency'] < 1
    fail ArgumentError, 'invalid value for "opts[:"currency"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'account'].nil? && opts[:'account'] < 1
    fail ArgumentError, 'invalid value for "opts[:"account"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'reference'].nil? && opts[:'reference'] < 1
    fail ArgumentError, 'invalid value for "opts[:"reference"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'genericmsg'].nil? && opts[:'genericmsg'] < 1
    fail ArgumentError, 'invalid value for "opts[:"genericmsg"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'token'].nil? && opts[:'token'] < 1
    fail ArgumentError, 'invalid value for "opts[:"token"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'bouquet'].nil? && opts[:'bouquet'] < 1
    fail ArgumentError, 'invalid value for "opts[:"bouquet"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'payoption'].nil? && opts[:'payoption'] < 1
    fail ArgumentError, 'invalid value for "opts[:"payoption"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'meternumber'].nil? && opts[:'meternumber'] < 1
    fail ArgumentError, 'invalid value for "opts[:"meternumber"]" when calling DefaultApi.transactions_post, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/transactions'

  # query parameters
  query_params = {}
  query_params[:'method'] = method
  query_params[:'amount'] = amount
  query_params[:'mobile'] = opts[:'mobile'] if !opts[:'mobile'].nil?
  query_params[:'holdername'] = opts[:'holdername'] if !opts[:'holdername'].nil?
  query_params[:'cardnumber'] = opts[:'cardnumber'] if !opts[:'cardnumber'].nil?
  query_params[:'cvv'] = opts[:'cvv'] if !opts[:'cvv'].nil?
  query_params[:'exp'] = opts[:'exp'] if !opts[:'exp'].nil?
  query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?
  query_params[:'account'] = opts[:'account'] if !opts[:'account'].nil?
  query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?
  query_params[:'genericmsg'] = opts[:'genericmsg'] if !opts[:'genericmsg'].nil?
  query_params[:'token'] = opts[:'token'] if !opts[:'token'].nil?
  query_params[:'bouquet'] = opts[:'bouquet'] if !opts[:'bouquet'].nil?
  query_params[:'payoption'] = opts[:'payoption'] if !opts[:'payoption'].nil?
  query_params[:'meternumber'] = opts[:'meternumber'] if !opts[:'meternumber'].nil?

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['apipassword', 'apiusername']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse200')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#transactions_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end