5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/solidus_afterpay/checkouts_controller.rb', line 5
def create
authorize! :update, order, order_token
response = payment_method.gateway.create_checkout(
order,
redirect_confirm_url: redirect_confirm_url,
redirect_cancel_url: redirect_cancel_url,
mode: params[:mode],
popup_origin_url: request.referer
)
if response.success?
render json: {
token: response.params['token'],
expires: response.params['expires'],
redirectCheckoutUrl: response.params['redirectCheckoutUrl']
}, status: :created
else
render json: { error: response.message, errorCode: response.error_code }, status: :unprocessable_entity
end
end
|