Sha256: a64749ad9282e1cd3eb7afbad845cd251ceba7f68587a1fb88bc0d9edb5c6d55
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module SolidusInter class Gateway def initialize(options) end def purchase(_money, source, _options = {}) inter_payment = source.retrieve_from_api if inter_payment.paid? source.update(status: "approved", paid_amount: inter_payment.valor_pago, e2e_id: inter_payment.end_to_end_id) successful_response("Pagamento realizado", inter_payment.txid) else failure_response(inter_payment.internal_error || "Ocorreu um erro no pagamento.") end end def void(transaction_id, _options = {}) # Respondendo sempre com successful_response para funcionar o botão de "Cancelar" do pedido. Reembolso deve ser feito por fora. successful_response("Pagamento cancelado. Se necessário, realize o reembolso.", transaction_id) end private def successful_response(message, transaction_id) ActiveMerchant::Billing::Response.new( true, message, {}, authorization: transaction_id ) end def failure_response(message) ActiveMerchant::Billing::Response.new( false, message ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_inter-1.6.0 | app/models/solidus_inter/gateway.rb |