Class: MaxipagoApi::CustomerRequest

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/maxipago_api/requests/customer_request.rb

Class Method Summary collapse

Class Method Details

.create(customer) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/maxipago_api/requests/customer_request.rb', line 8

def create(customer)
  xml = {
      'verification' => {merchantId: MaxipagoApi.store_id, merchantKey: MaxipagoApi.store_key}, 
      command: 'add-consumer', 
      request: customer.to_object
    }.to_xml(root: 'api-request', skip_types: true)
  response = post(MaxipagoApi.api_register_endpoint, body: xml, headers: {'Content-Type' => 'text/plain'})
  Hash.from_xml(response.parsed_response)
end