class PacProviderFM
Public Instance Methods
cancel(user_keys, rfc, uuid)
click to toggle source
# File lib/services/pac_provider_fm.rb, line 6 def cancel user_keys, rfc, uuid config_client response = FmTimbradoCfdi.cancelar rfc, uuid parse_cfdi response end
enable_rfc(user_keys, request)
click to toggle source
# File lib/services/pac_provider_fm.rb, line 12 def enable_rfc user_keys, request config_client response = FmTimbradoCfdi.subir_certificado request[:rfc], request[:certificate], request[:key], request[:password] parse_cfdi response end
rining(user_keys)
click to toggle source
# File lib/services/pac_provider_fm.rb, line 20 def rining user_keys config_client response = FmTimbradoCfdi.timbra_cfdi_xml(@tax_receipt_xml, true) parse response end
Private Instance Methods
config_client()
click to toggle source
# File lib/services/pac_provider_fm.rb, line 47 def config_client FmTimbradoCfdi.configurar do |config| config.user_id = @user_keys[:id] config.user_pass = @user_keys[:password] config.namespace = @user_keys[:namespace] config.endpoint = @user_keys[:endpoint] config.fm_wsdl = @user_keys[:wsdl] config.log = @user_keys[:log] config.ssl_verify_mode = @user_keys[:ssl_verify_mode] end end
parse(response)
click to toggle source
# File lib/services/pac_provider_fm.rb, line 28 def parse response { status: response.valid?, xml: response.xml, stamp: response.timbre || '', pdf: response.pdf || '', cbb: response.cbb || '', errors: response.errors } end
parse_cfdi(response)
click to toggle source
# File lib/services/pac_provider_fm.rb, line 38 def parse_cfdi response { status: response.valid?, xml: response.xml, success: return_success_message(response.xml), errors: return_error_message(response.error) } end
return_error_message(xml)
click to toggle source
# File lib/services/pac_provider_fm.rb, line 59 def return_error_message xml { code: Nokogiri::XML(xml).xpath('//faultcode').text(), message: Nokogiri::XML(xml).xpath('//faultstring').text() } end
return_success_message(xml)
click to toggle source
# File lib/services/pac_provider_fm.rb, line 66 def return_success_message xml { code: Nokogiri::XML(xml).xpath('//Code').text, message: Nokogiri::XML(xml).xpath('//Message').text } end