Class: MassPayRubySdk::CardApi

Inherits:
Object
  • Object
show all
Defined in:
lib/masspay_ruby_sdk/api/card_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CardApi



18
19
20
# File 'lib/masspay_ruby_sdk/api/card_api.rb', line 18

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'lib/masspay_ruby_sdk/api/card_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#get_wallet_card_info(user_token, wallet_token, opts = {}) ⇒ GetWalletCardInfo200Response

Get MassPay Card Information This GET endpoint is used to retrieve MassPay card information associated with the provided wallet token.
You can use this endpoint to obtain information about the MassPay card associated with the wallet.
To use this endpoint, you need to provide the user_token and wallet_token as required parameters in the URL Path.
The response will include a JSON object containing details for the MassPay card, including the card number, balance, status.



27
28
29
30
# File 'lib/masspay_ruby_sdk/api/card_api.rb', line 27

def get_wallet_card_info(user_token, wallet_token, opts = {})
  data, _status_code, _headers = get_wallet_card_info_with_http_info(user_token, wallet_token, opts)
  data
end

#get_wallet_card_info_with_http_info(user_token, wallet_token, opts = {}) ⇒ Array<(GetWalletCardInfo200Response, Integer, Hash)>

Get MassPay Card Information This GET endpoint is used to retrieve MassPay card information associated with the provided wallet token. &lt;br&gt; You can use this endpoint to obtain information about the MassPay card associated with the wallet. &lt;br&gt; To use this endpoint, you need to provide the &#x60;user_token&#x60; and &#x60;wallet_token&#x60; as required parameters in the URL Path. &lt;br&gt; The response will include a JSON object containing details for the MassPay card, including the card number, balance, status.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
# File 'lib/masspay_ruby_sdk/api/card_api.rb', line 38

def get_wallet_card_info_with_http_info(user_token, wallet_token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CardApi.get_wallet_card_info ...'
  end
  # verify the required parameter 'user_token' is set
  if @api_client.config.client_side_validation && user_token.nil?
    fail ArgumentError, "Missing the required parameter 'user_token' when calling CardApi.get_wallet_card_info"
  end
  # verify the required parameter 'wallet_token' is set
  if @api_client.config.client_side_validation && wallet_token.nil?
    fail ArgumentError, "Missing the required parameter 'wallet_token' when calling CardApi.get_wallet_card_info"
  end
  # resource path
  local_var_path = '/wallet/{user_token}/{wallet_token}/card'.sub('{' + 'user_token' + '}', CGI.escape(user_token.to_s)).sub('{' + 'wallet_token' + '}', CGI.escape(wallet_token.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetWalletCardInfo200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME']

  new_options = opts.merge(
    :operation => :"CardApi.get_wallet_card_info",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CardApi#get_wallet_card_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_wallet_card_info(user_token, wallet_token, opts = {}) ⇒ nil

Update MassPay Card Information This PUT endpoint is used to update the MassPay card information for a provided user token and wallet token.
You can use this endpoint to help your users manage their MassPay card information, including updating their card PIN number or status.
To use this endpoint, you need to provide the user_token and wallet_token as parameters in the URL Path, along with the parameters in the request Query, including the card pin number or(and) status.
The endpoint will then update the card information for the provided user and wallet token.

Options Hash (opts):

  • :pin (String)

    New 4 digit pin number for the card (To be used in ATM machines)

  • :status (String)

    New status for the card



98
99
100
101
# File 'lib/masspay_ruby_sdk/api/card_api.rb', line 98

def update_wallet_card_info(user_token, wallet_token, opts = {})
  update_wallet_card_info_with_http_info(user_token, wallet_token, opts)
  nil
end

#update_wallet_card_info_with_http_info(user_token, wallet_token, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update MassPay Card Information This PUT endpoint is used to update the MassPay card information for a provided user token and wallet token. &lt;br&gt; You can use this endpoint to help your users manage their MassPay card information, including updating their card PIN number or status. &lt;br&gt; To use this endpoint, you need to provide the &#x60;user_token&#x60; and &#x60;wallet_token&#x60; as parameters in the URL Path, along with the parameters in the request Query, including the card pin number or(and) status. &lt;br&gt; The endpoint will then update the card information for the provided user and wallet token.

Options Hash (opts):

  • :pin (String)

    New 4 digit pin number for the card (To be used in ATM machines)

  • :status (String)

    New status for the card



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/masspay_ruby_sdk/api/card_api.rb', line 111

def update_wallet_card_info_with_http_info(user_token, wallet_token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CardApi.update_wallet_card_info ...'
  end
  # verify the required parameter 'user_token' is set
  if @api_client.config.client_side_validation && user_token.nil?
    fail ArgumentError, "Missing the required parameter 'user_token' when calling CardApi.update_wallet_card_info"
  end
  # verify the required parameter 'wallet_token' is set
  if @api_client.config.client_side_validation && wallet_token.nil?
    fail ArgumentError, "Missing the required parameter 'wallet_token' when calling CardApi.update_wallet_card_info"
  end
  pattern = Regexp.new(/^[0-9]{4}$/)
  if @api_client.config.client_side_validation && !opts[:'pin'].nil? && opts[:'pin'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"pin\"]' when calling CardApi.update_wallet_card_info, must conform to the pattern #{pattern}."
  end

  allowable_values = ["SUSPEND", "UNSUSPEND", "CLOSE"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/wallet/{user_token}/{wallet_token}/card'.sub('{' + 'user_token' + '}', CGI.escape(user_token.to_s)).sub('{' + 'wallet_token' + '}', CGI.escape(wallet_token.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'pin'] = opts[:'pin'] if !opts[:'pin'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME']

  new_options = opts.merge(
    :operation => :"CardApi.update_wallet_card_info",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CardApi#update_wallet_card_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end