/**
* AuthorizeTicket
* Makes a new authorization on an existing ticket using the AuthorizeTicket JSON service
* @param int @amount The amount of the purchase in smallest unit
* @param string @currency The currency either in numeric or string format (e.g. 208/DKK)
* @param int @merchantId DIBS Merchant ID / customer number
* @param string @orderId The shops order ID for the purchase
* @param string @ticketId The ticket number on which the authorization should be done
* @param string @K The secret HMAC key from DIBS Admin
*/
function AuthorizeTicket($amount, $currency, $merchantId, $orderId, $ticketId, $K) {
  //Create message array consisting of all input parameters
  $message = array(
    "merchantId" => $merchantId,
    "amount" => $amount,
    "currency" => $currency,
    "orderId" => $orderId,
    "ticketId" => $ticketId,
  );
  
  //Calculate MAC value for request
  $mac = calculateMac($message, $K); 
  $message["MAC"] = $mac;
  
  //Post to the DIBS system
  $res = postToDIBS("AuthorizeTicket", $message);
  
  if ($res["status"] == "ACCEPT") {
    //Payment accepted. Check $res["transactionId"] for transaction ID.
    //Insert own code to update shop system
  } else if ($res["status"] == "DECLINE") { 
    //Check $res["declineReason"] for more information.
    //Insert own code to update shop system
  } else {
    //An error happened. Check $res["declineReason"] for more information.
    //Insert own code to update shop system
  }
}