Class: Payabli::Wallet::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/payabli/wallet/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void

Parameters:



9
10
11
# File 'lib/payabli/wallet/client.rb', line 9

def initialize(client:)
  @client = client
end

Instance Method Details

#configure_apple_pay_organization(request_options: {}, **params) ⇒ Payabli::Types::ConfigureApplePayOrganizationApiResponse

Configure and activate Apple Pay for a Payabli organization

Examples:

client.wallet.configure_apple_pay_organization(
  cascade: true,
  is_enabled: true,
  org_id: 123
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/payabli/wallet/client.rb', line 31

def configure_apple_pay_organization(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "Wallet/applepay/configure-organization",
    headers: headers,
    body: Payabli::Wallet::Types::ConfigureOrganizationRequestApplePay.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::ConfigureApplePayOrganizationApiResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#configure_apple_pay_paypoint(request_options: {}, **params) ⇒ Payabli::Types::ConfigureApplePaypointApiResponse

Configure and activate Apple Pay for a Payabli paypoint

Examples:

client.wallet.configure_apple_pay_paypoint(
  entry: "8cfec329267",
  is_enabled: true
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/payabli/wallet/client.rb', line 73

def configure_apple_pay_paypoint(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "Wallet/applepay/configure-paypoint",
    headers: headers,
    body: Payabli::Wallet::Types::ConfigurePaypointRequestApplePay.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::ConfigureApplePaypointApiResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#configure_google_pay_organization(request_options: {}, **params) ⇒ Payabli::Types::ConfigureApplePayOrganizationApiResponse

Configure and activate Google Pay for a Payabli organization

Examples:

client.wallet.configure_google_pay_organization(
  cascade: true,
  is_enabled: true,
  org_id: 123
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/payabli/wallet/client.rb', line 116

def configure_google_pay_organization(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "Wallet/googlepay/configure-organization",
    headers: headers,
    body: Payabli::Wallet::Types::ConfigureOrganizationRequestGooglePay.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::ConfigureApplePayOrganizationApiResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#configure_google_pay_paypoint(request_options: {}, **params) ⇒ Payabli::Types::ConfigureGooglePaypointApiResponse

Configure and activate Google Pay for a Payabli paypoint

Examples:

client.wallet.configure_google_pay_paypoint(
  entry: "8cfec329267",
  is_enabled: true
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/payabli/wallet/client.rb', line 158

def configure_google_pay_paypoint(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "Wallet/googlepay/configure-paypoint",
    headers: headers,
    body: Payabli::Wallet::Types::ConfigurePaypointRequestGooglePay.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::ConfigureGooglePaypointApiResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end