/**
  * Add modifider to an {@link Order} .
  * 
  * @see Modifier_Interface::addToOrder()
  * @param Order $order
  * @param Mixed $value
  */
 public function addToOrder($order, $value)
 {
     $modification = new Modification();
     $modification->ModifierClass = get_class($this);
     $modification->ModifierOptionID = $value;
     $modification->Amount = $this->Amount($order, $value);
     $modification->Description = $this->Description($order, $value);
     $modification->OrderID = $order->ID;
     $modification->write();
 }
 public function applyModificationTaxRate(Modification $mod)
 {
     if ($mod->SubTotalModifier) {
         $order = $mod->Order();
         // Orders shipped within New Zealand have tax applied
         if ($order && $order->exists() && $order->ShippingCountryCode == 'NZ') {
             $mod->XeroTaxType = 'OUTPUT2';
             $mod->XeroTaxRate = 15.0;
         } else {
             $mod->XeroTaxType = 'NONE';
             $mod->XeroTaxRate = 0.0;
         }
         $mod->write();
     }
 }