32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'app/controllers/spree/omnikassa_payments_controller.rb', line 32
def reply
@payment_response = payment_response_from_params(params)
@order = @payment_response.order
add_payment_if_not_exists
message = "OmnikassaPaymentResponse posted: payment: # @payment_response.payment.id}; params: #{params.inspect}"
if @payment_response.valid?
case @payment_response.response_level
when :success
Rails.logger.info message
@payment_response.payment.complete!
advance_order_status :complete
when :pending
Rails.logger.info message
@payment_response.payment.pend!
advance_order_status :payment
when :cancelled
Rails.logger.info message
@payment_response.payment.failure!
@payment_response.order.cancel
when :failed
Rails.logger.error message
@payment_response.payment.failure!
@payment_response.order.cancel
else
Rails.logger.error message
@payment_response.payment.pend!
@payment_response.order.cancel
end
else
Rails.logger.error message
@payment_response.payment.pend!
end
render :text => @payment_response.response_level.to_s
end
|