summaryrefslogtreecommitdiff
path: root/app/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/orders_controller.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb
index 7a26d11..a57bf68 100644
--- a/app/controllers/api/orders_controller.rb
+++ b/app/controllers/api/orders_controller.rb
@@ -9,8 +9,16 @@ module Api
render json: serialized_collection.serializable_hash, status: :ok
end
+ def show
+ @order = current_user_account.orders.find_by(id: params[:id])
+
+ render status: :not_found and return if @order.nil?
+
+ render json: serialized_object.serializable_hash, status: :ok
+ end
+
def create
- @service = PaymentService.new(@order, permitted_params[:card_id])
+ @service = PaymentServices::PaymentService.new(permitted_params[:card_id], current_user_account)
@order = @service.call
if @order
@@ -29,5 +37,9 @@ module Api
def serialized_object
@serialized_object ||= OrderSerializer.new(@order)
end
+
+ def permitted_params
+ params.permit(:card_id)
+ end
end
end