You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: coupon_codes_controller.rb
    path of file: ./repos/solidus/api/app/controllers/spree/api
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Spree
  module Api
    clas
    
      def create
        authorize! :update, @order, order_token

        @order.coupon_code = params[:coupon_code]
        @handler = Spree::Config.promotions.coupon_code_handler_class.new(@order).apply

        if @handler.successful?
          render 'spree/api/promotions/handler', status: 200
        else
          logger.error("apply_coupon_code_error=#{@handler.error.inspect}")
          render 'spree/api/promotions/handler', status: 422
        end