def create_transaction(payment_method, transaction)
      unless get_valid?
        return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), CreateTransactionResponse)
      end
      begin
        case payment_method
        when Enums::PaymentMethod::DIRECT
          url = @web_url + Constants::DIRECT_PAYMENT_METHOD_NAME + Constants::JSON_SUFFIX

          request = Message::TransactionProcess::TransDirectPaymentMsgProcess.create_request(transaction)
          response = Message::TransactionProcess::TransDirectPaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
          Message::TransactionProcess::TransDirectPaymentMsgProcess.make_result(response)
        when Enums::PaymentMethod::RESPONSIVE_SHARED
          url = @web_url + Constants::RESPONSIVE_SHARED_METHOD_NAME + Constants::JSON_SUFFIX

          request = Message::TransactionProcess::TransResponsiveSharedMsgProcess.create_request(transaction)
          response = Message::TransactionProcess::TransResponsiveSharedMsgProcess.send_request(url, @api_key, @password, @version, request)
          Message::TransactionProcess::TransResponsiveSharedMsgProcess.make_result(response)
        when Enums::PaymentMethod::TRANSPARENT_REDIRECT
          url = @web_url + Constants::TRANSPARENT_REDIRECT_METHOD_NAME + Constants::JSON_SUFFIX

          request = Message::TransactionProcess::TransTransparentRedirectMsgProcess.create_request(transaction)
          response = Message::TransactionProcess::TransTransparentRedirectMsgProcess.send_request(url, @api_key, @password, @version, request)
          Message::TransactionProcess::TransTransparentRedirectMsgProcess.make_result(response)
        when Enums::PaymentMethod::WALLET
          if transaction.capture
            url = @web_url + Constants::DIRECT_PAYMENT_METHOD_NAME + Constants::JSON_SUFFIX

            request = Message::TransactionProcess::TransDirectPaymentMsgProcess.create_request(transaction)
            response = Message::TransactionProcess::TransDirectPaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
            Message::TransactionProcess::TransDirectPaymentMsgProcess.make_result(response)
          else
            url = @web_url + Constants::CAPTURE_PAYMENT_METHOD

            request = Message::TransactionProcess::CapturePaymentMsgProcess.create_request(transaction)
            response = Message::TransactionProcess::CapturePaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
            Message::TransactionProcess::CapturePaymentMsgProcess.make_result(response)
          end
        when Enums::PaymentMethod::AUTHORISATION
          url = @web_url + Constants::CAPTURE_PAYMENT_METHOD

          request = Message::TransactionProcess::CapturePaymentMsgProcess.create_request(transaction)
          response = Message::TransactionProcess::CapturePaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
          Message::TransactionProcess::CapturePaymentMsgProcess.make_result(response)
        else
          make_response_with_exception(Exceptions::ParameterInvalidException.new('Unsupported payment type'), CreateTransactionResponse)
        end
      rescue => e
        @logger.error(e.to_s) if @logger
        make_response_with_exception(e, CreateTransactionResponse)
      end
    end
def create_transaction(payment_method, transaction)
      unless get_valid?
        return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), CreateTransactionResponse)
      end
      begin
        case payment_method
        when Enums::PaymentMethod::DIRECT
          url = @web_url + Constants::DIRECT_PAYMENT_METHOD_NAME + Constants::JSON_SUFFIX

          request = Message::TransactionProcess::TransDirectPaymentMsgProcess.create_request(transaction)
          response = Message::TransactionProcess::TransDirectPaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
          Message::TransactionProcess::TransDirectPaymentMsgProcess.make_result(response)
        when Enums::PaymentMethod::RESPONSIVE_SHARED
          url = @web_url + Constants::RESPONSIVE_SHARED_METHOD_NAME + Constants::JSON_SUFFIX

          request = Message::TransactionProcess::TransResponsiveSharedMsgProcess.create_request(transaction)
          response = Message::TransactionProcess::TransResponsiveSharedMsgProcess.send_request(url, @api_key, @password, @version, request)
          Message::TransactionProcess::TransResponsiveSharedMsgProcess.make_result(response)
        when Enums::PaymentMethod::TRANSPARENT_REDIRECT
          url = @web_url + Constants::TRANSPARENT_REDIRECT_METHOD_NAME + Constants::JSON_SUFFIX

          request = Message::TransactionProcess::TransTransparentRedirectMsgProcess.create_request(transaction)
          response = Message::TransactionProcess::TransTransparentRedirectMsgProcess.send_request(url, @api_key, @password, @version, request)
          Message::TransactionProcess::TransTransparentRedirectMsgProcess.make_result(response)
        when Enums::PaymentMethod::WALLET
          if transaction.capture
            url = @web_url + Constants::DIRECT_PAYMENT_METHOD_NAME + Constants::JSON_SUFFIX

            request = Message::TransactionProcess::TransDirectPaymentMsgProcess.create_request(transaction)
            response = Message::TransactionProcess::TransDirectPaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
            Message::TransactionProcess::TransDirectPaymentMsgProcess.make_result(response)
          else
            url = @web_url + Constants::CAPTURE_PAYMENT_METHOD

            request = Message::TransactionProcess::CapturePaymentMsgProcess.create_request(transaction)
            response = Message::TransactionProcess::CapturePaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
            Message::TransactionProcess::CapturePaymentMsgProcess.make_result(response)
          end
        when Enums::PaymentMethod::AUTHORISATION
          url = @web_url + Constants::CAPTURE_PAYMENT_METHOD

          request = Message::TransactionProcess::CapturePaymentMsgProcess.create_request(transaction)
          response = Message::TransactionProcess::CapturePaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
          Message::TransactionProcess::CapturePaymentMsgProcess.make_result(response)
        else
          make_response_with_exception(Exceptions::ParameterInvalidException.new('Unsupported payment type'), CreateTransactionResponse)
        end
      rescue => e
        @logger.error(e.to_s) if @logger
        make_response_with_exception(e, CreateTransactionResponse)
      end
    end
Creates a transaction either using an authorisation, the responsive shared
 page, transparent redirect, or direct as the source of funds

 @param [Enums::PaymentMethod] payment_method Describes where the card details will be coming from for this transaction (Direct, Responsive Shared, Transparent Redirect etc)
 @param [Models::Transaction] transaction Request containing the transaction details
 @return [CreateTransactionResponse] CreateTransactionResponse