Module: ControllerOrderTypes
- Extended by:
- ActiveSupport::Concern
- Included in:
- Trade::My::OrdersController
- Defined in:
- app/controllers/concerns/controller_order_types.rb
Instance Method Summary collapse
- #alipay_pay ⇒ Object
- #paypal_execute ⇒ Object
- #paypal_pay ⇒ Object
- #stripe_pay ⇒ Object
- #wxpay_pay ⇒ Object
Instance Method Details
#alipay_pay ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/concerns/controller_order_types.rb', line 32 def alipay_pay respond_to do |format| if @order.payment_status != 'all_paid' format.json { result = @order.alipay_prepay render json: { result: result } } format.html { redirect_to @order.alipay_prepay_url } else format.json format.html { redirect_to my_orders_url } end end end |
#paypal_execute ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/concerns/controller_order_types.rb', line 62 def paypal_execute respond_to do |format| if @order.paypal_execute(params) format.json { } format.html { redirect_to my_order_url(@order.id), notice: "Order[#{@order.uuid}] placed successfully" } else format.html { redirect_to my_orders_url, alert: @order.error.inspect } format.json { } end end end |
#paypal_pay ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/concerns/controller_order_types.rb', line 49 def paypal_pay respond_to do |format| if @order.payment_status != 'all_paid' result = @order.paypal_prepay format.json format.html { redirect_to result } else format.json format.html { redirect_to my_orders_url } end end end |
#stripe_pay ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/concerns/controller_order_types.rb', line 14 def stripe_pay if @order.payment_status != 'all_paid' @order.stripe_charge(params) end respond_to do |format| if @order.errors.blank? format.json { render json: { result: @order } } format.html { redirect_to @order.approve_url } else format.json { process_errors(@order) } format.html { redirect_to my_orders_url } end end end |
#wxpay_pay ⇒ Object
74 75 76 77 78 79 80 81 82 |
# File 'app/controllers/concerns/controller_order_types.rb', line 74 def wxpay_pay @wxpay_order = @order.wxpay_order(spbill_create_ip: request.remote_ip) if @wxpay_order['result_code'] == 'FAIL' || @wxpay_order.blank? render 'wxpay_pay_err' else render 'wxpay_pay' end end |