POST /events/:id/discounts/
        Creates a new discount; returns the result as a :format:`discount` as the key ``discount``.
495371
def post_event_discounts(self, id, **data):
        
        
        return self.post("/events/{0}/discounts/".format(id), data=data)
95598
def create_event(*args)
      raise "EventCampaign needs to be saved before Event creation" if self.id.nil?

      (args[0]).merge!(:campaign_id => self.id)

      event = ActionKitApi::Event.new(*args)
    end
1047634
def create_item_returning_id(self, api):
        
        resp = api.create_item(self)
        item = resp.json()
        return item['id']
913011
def create_ticket(self, ticket=None, **kwargs):
        
        if not ticket:
            ticket = self.create_ticket_str()
        if 'service' in kwargs:
            kwargs['service'] = clean_service_url(kwargs['service'])
        if 'expires' not in kwargs:
            expires = now() + timedelta(seconds=self.model.TICKET_EXPIRE)
            kwargs['expires'] = expires
        t = self.create(ticket=ticket, **kwargs)
        logger.debug("Created %s %s" % (t.name, t.ticket))
        return t
1124202
def create_initial_category(apps, schema_editor):
    '''  '''
    DiscountCategory = apps.get_model('discounts','DiscountCategory')
    db_alias = schema_editor.connection.alias
    DiscountCategory.objects.using(db_alias).create(
        id=1,name='General Discounts',order=1,cannotCombine=False
    )
135162
def delete_discount(self, **params):
        """"""
        url = self.instance_url() + '/discount'
        d = self.request('delete', url)
        d.addCallback(lambda response: self.refresh_from(
            {'discount': None}, api_key, True))
        return d.addCallback(lambda _: self.subscription)
729190
def create_session(self, **params):
        
        return self.make_request(self.PRICING_SESSION_URL,
                                 method='post',
                                 headers=self._session_headers(),
                                 callback=lambda resp: resp.headers[
                                     'location'],
                                 data=params)
1211589
def create(cls, id=None, **kwargs):
        
        what = cls(**kwargs)
        if id:
            setattr(what, cls.primaryKey, id)
        what.save()
        return what
1186470
public function create($priceRuleId, DiscountCode &$discountCode)
    {
        $data = $discountCode->exportData();
        $endpoint = '/admin/price_rules/'.$priceRuleId.'/discount_codes.json';
        $response = $this->request($endpoint, 'POST', array(
            'discount_code' => $data
        ));
        $discountCode->setData($response['discount_code']);
    }
937816
def save_as_new_record
      new_attributes = attributes.reject { |k, _v| k.to_s =~ /^(id|uuid)$/ }
      self.class.create(new_attributes)
    end
799122
def create_key(self, title, key, read_only=False):
        
        assert isinstance(title, (str, unicode)), title
        assert isinstance(key, (str, unicode)), key
        assert isinstance(read_only, bool), read_only
        post_parameters = {
            "title": title,
            "key": key,
            "read_only": read_only,
        }
        headers, data = self._requester.requestJsonAndCheck(
            "POST",
            self.url + "/keys",
            input=post_parameters
        )
        return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True)
219136
def duplicate(self):
        '''
        
        '''
        instance = self.__class__(name=self.name, description=self.description,
                                  unit=self.unit, quantity=self.quantity,
                                  date=self.date, unit_price=self.unit_price,
                                  gin=self.gin, gtin=self.gtin, sscc=self.sscc)
        for tax in self.taxes:
            instance.taxes.append(tax.duplicate())
        for discount in self.discounts:
            instance.discounts.append(discount.duplicate())
        return instance
452873
def customer_discount_webhook_handler(event):
	

	crud_type = CrudType.determine(event=event)
	discount_data = event.data.get("object", {})
	coupon_data = discount_data.get("coupon", {})
	customer = event.customer

	if crud_type.created or crud_type.updated:
		coupon, _ = _handle_crud_like_event(
			target_cls=models.Coupon, event=event, data=coupon_data, id=coupon_data.get("id")
		)
		coupon_start = discount_data.get("start")
		coupon_end = discount_data.get("end")
	else:
		coupon = None
		coupon_start = None
		coupon_end = None

	customer.coupon = coupon
	customer.coupon_start = convert_tstamp(coupon_start)
	customer.coupon_end = convert_tstamp(coupon_end)
	customer.save()
47442
def list_discounts(location_id, opts = {})
      data, _status_code, _headers = list_discounts_with_http_info(location_id, opts)
      return data
    end
1044358
def create_new_code(cls,**kwargs):
        '''
        
        '''
        prefix = kwargs.pop('prefix','')

        new = False
        while not new:
            # Standard is a ten-letter random string of uppercase letters
            random_string = ''.join(random.choice(string.ascii_uppercase) for z in range(10))
            if not Voucher.objects.filter(voucherId='%s%s' % (prefix, random_string)).exists():
                new = True

        return Voucher.objects.create(voucherId='%s%s' % (prefix, random_string),**kwargs)
594901
def create(self, vals, check=True):
        
        if 'folio_id' in vals:
            folio = self.env['hotel.folio'].browse(vals['folio_id'])
            vals.update({'order_id': folio.order_id.id})
        return super(HotelServiceLine, self).create(vals)
206407
public function addDiscArt()
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $articleIds = $this->_getActionIds('oxarticles.oxid');
        $discountListId = $config->getRequestParameter('synchoxid');

        // adding
        if ($config->getRequestParameter('all')) {
            $articleTable = $this->_getViewName('oxarticles');
            $articleIds = $this->_getAll(parent::_addFilter("select $articleTable.oxid " . $this->_getQuery()));
        }
        if ($discountListId && $discountListId != self::NEW_DISCOUNT_LIST_ID && is_array($articleIds)) {
            foreach ($articleIds as $articleId) {
                $this->addArticleToDiscount($discountListId, $articleId);
            }
        }
    }