17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/models/solidus_razorpay/order_decorator.rb', line 17
def process_razorpayment(params, order)
setup_razorpay(payment_method(params[:payment_method_id]))
razorpay_payment_object = Razorpay::Payment.fetch(params[:razorpay_payment_id])
payment = payment(order, razorpay_payment_object, payment_method(params[:payment_method_id]))
if payment_authorized?(razorpay_payment_object)
razorpay_payment_object.capture({ amount: order.amount_in_paise })
razorpay_payment_object = Razorpay::Payment.fetch(params[:razorpay_payment_id])
payment.update(response_code: razorpay_payment_object.status)
razorpay_payment_object.status
else
raise StandardError.new('Unable to capture payment')
end
end
|