$quote = Mage::getModel('sales/quote')->setStoreId(Mage::app()->getStore('default')->getId());
$quote->setCustomerEmail($mail);
$product = Mage::getModel('catalog/product')->load($productId);
$buyInfo = array(
'qty' => 1,
'options' => array($optionId => $optionValue)
);
$quote->addProduct($product, new Varien_Object($buyInfo));
$addressData = array(
'firstname' => $firstName,
'lastname' => $lastName,
'street' => $street,
'city' => $city,
'postcode' => $postCode,
'telephone' => '-',
'country_id' => $country,
'region_id' => $regionId,
);
$billingAddress = $quote->getBillingAddress()->addData($addressData);
$shippingAddress = $quote->getShippingAddress()->addData($addressData);
$shippingAddress->setCollectShippingRates(true)->collectShippingRates()
->setShippingMethod('flatrate_flatrate')
->setPaymentMethod('bankpayment');
$quote->getPayment()->importData(array('method' => 'bankpayment'));
$quote->collectTotals()->save();
$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();
$order = $service->getOrder();
// ...