Class: Whop_sdk::PaymentMethodDomains::Client
- Inherits:
-
Object
- Object
- Whop_sdk::PaymentMethodDomains::Client
- Defined in:
- lib/whop_sdk/payment_method_domains/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Whop_sdk::Types::PaymentMethodDomain
Registers a hostname with the wallet provider and attempts verification inline.
-
#delete(request_options: {}, **params) ⇒ Whop_sdk::PaymentMethodDomains::Types::DeletePaymentMethodDomainsResponse
Unregisters a payment method domain so its wallet payment methods stop rendering there.
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Whop_sdk::PaymentMethodDomains::Types::ListPaymentMethodDomainsResponse
Lists payment method domains.
-
#retrieve(request_options: {}, **params) ⇒ Whop_sdk::Types::PaymentMethodDomain
Retrieves a payment method domain to check its verification status.
-
#verify(request_options: {}, **params) ⇒ Whop_sdk::Types::PaymentMethodDomain
Re-attempts provider verification of a pending domain once the association file is hosted.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/whop_sdk/payment_method_domains/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Whop_sdk::Types::PaymentMethodDomain
Registers a hostname with the wallet provider and attempts verification inline. Returns verified when the
provider fetched the domain-association file (for Apple Pay,
/.well-known/apple-developer-merchantid-domain-association), or pending when it could not — host the file,
then retry with the verify endpoint.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/whop_sdk/payment_method_domains/client.rb', line 102 def create(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "payment_method_domains", body: Whop_sdk::PaymentMethodDomains::Types::CreatePaymentMethodDomainsRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::Types::PaymentMethodDomain.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ Whop_sdk::PaymentMethodDomains::Types::DeletePaymentMethodDomainsResponse
Unregisters a payment method domain so its wallet payment methods stop rendering there.
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/whop_sdk/payment_method_domains/client.rb', line 177 def delete(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "payment_method_domains/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::PaymentMethodDomains::Types::DeletePaymentMethodDomainsResponse.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list(request_options: {}, **params) ⇒ Whop_sdk::PaymentMethodDomains::Types::ListPaymentMethodDomainsResponse
Lists payment method domains. Without account_id, returns the caller's own domains and those of every
connected account.
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 |
# File 'lib/whop_sdk/payment_method_domains/client.rb', line 40 def list(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["account_id"] = params[:account_id] if params.key?(:account_id) query_params["hostname"] = params[:hostname] if params.key?(:hostname) query_params["status"] = params[:status] if params.key?(:status) query_params["provider"] = params[:provider] if params.key?(:provider) query_params["created_before"] = params[:created_before] if params.key?(:created_before) query_params["created_after"] = params[:created_after] if params.key?(:created_after) query_params["order"] = params[:order] if params.key?(:order) query_params["direction"] = params[:direction] if params.key?(:direction) query_params["first"] = params[:first] if params.key?(:first) query_params["after"] = params[:after] if params.key?(:after) query_params["last"] = params[:last] if params.key?(:last) query_params["before"] = params[:before] if params.key?(:before) Whop_sdk::Internal::CursorItemIterator.new( cursor_field: :end_cursor, item_field: :data, initial_cursor: query_params["after"] ) do |next_cursor| query_params["after"] = next_cursor request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "payment_method_domains", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) parsed_response = Whop_sdk::PaymentMethodDomains::Types::ListPaymentMethodDomainsResponse.load(response.body) [parsed_response, response] else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end end |
#retrieve(request_options: {}, **params) ⇒ Whop_sdk::Types::PaymentMethodDomain
Retrieves a payment method domain to check its verification status.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/whop_sdk/payment_method_domains/client.rb', line 140 def retrieve(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "payment_method_domains/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::Types::PaymentMethodDomain.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#verify(request_options: {}, **params) ⇒ Whop_sdk::Types::PaymentMethodDomain
Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a
bad_request explaining what to fix; verifying an already verified domain is a no-op.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/whop_sdk/payment_method_domains/client.rb', line 215 def verify(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "payment_method_domains/#{URI.encode_uri_component(params[:id].to_s)}/verify", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::Types::PaymentMethodDomain.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |