summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-04-14 20:52:50 -0600
committerHombreLaser <sebastian-440@live.com>2023-04-14 20:52:50 -0600
commit9607fcb5a9cdc7595633336881cc0dd8aa9fb8ca (patch)
treea03b7f31fdca2e531d082ac813dc341262631a85 /app/controllers
parent8fbeea986d06a0052ce0132717f22b6ff8bd1a04 (diff)
Corrige errores de OrdersController
Diffstat (limited to 'app/controllers')
-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