Sha256: 26bed61a33c64994ffb95b7d152831a36c9750b0451beaf01b827c191decad44
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
Spree::CheckoutController.class_eval do def edit if ((@order.state == "payment") && @order.valid?) puts "valid, processing" if @order.payable_via_pag_seguro? puts "payable via pag_seguro, adding payment" payment = Spree::Payment.new payment.amount = @order.total payment.payment_method = Spree::Order.pag_seguro_payment_method @order.payments << payment pag_seguro_payment = PagSeguro::Payment.new(Spree::PagSeguro::Config.email, Spree::PagSeguro::Config.token, redirect_url: Spree::PagSeguro::Config.redrect_url) pag_seguro_payment.items = @order.line_items.collect do |item| PagSeguro::Item.new( id: item.id, description: item.product.description, amount: format("%.2f", item.price.round(2)), quantity: item.quantity, weight: item.product.weight, ) end pag_seguro_payment.sender = PagSeguro::Sender.new(name: @order.name, email: @order.email, phone_number: @order.ship_address.phone) pag_seguro_payment.shipping = PagSeguro::Shipping.new(type: PagSeguro::Shipping::SEDEX, state: @order.ship_address.state.abbr, city: @order.ship_address.city, postal_code: @order.ship_address.zipcode, street: @order.ship_address.address1, complement: @order.ship_address.address2) @pag_seguro_url = pag_seguro_payment.checkout_payment_url payment.started_processing end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_pag_seguro-1.0.0.beta3 | app/controllers/spree/checkout_controller_decorator.rb |