class MaxipagoApi::CreditCardRequest

Public Class Methods

save(credit_card) click to toggle source
# File lib/maxipago_api/requests/credit_card_request.rb, line 9
def save(credit_card)
  xml = {
    'verification' => {merchantId: MaxipagoApi.store_id, merchantKey: MaxipagoApi.store_key}, 
    command: 'add-card-onfile', 
    request: credit_card.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