Add a coupon code to a quote.

        :param quote_id: Shopping cart ID (quote ID)
        :param coupon_code, string, Coupon code
        :param store_view: Store view ID or code
        :return: boolean, True if the coupon code is added
352136
def add(self, quote_id, coupon_code, store_view=None):
        
        return bool(
            self.call('cart_coupon.add', [quote_id, coupon_code, store_view])
        )
26586
function user_has_gv_account($c_id) {
    global $db;
    $gv_result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$c_id . "'");
    if ($gv_result->RecordCount() > 0) {
      return $gv_result->fields['amount'];
    }
    return 0; // use 0 because 'false' was preventing checkout_payment from continuing
  }
495371
def post_event_discounts(self, id, **data):
        
        
        return self.post("/events/{0}/discounts/".format(id), data=data)
628560
def query_coupon(self, coupon_id, user_id,
                     op_user_id=None, device_info=None):
        
        data = {
            'coupon_id': coupon_id,
            'openid': user_id,
            'appid': self.appid,
            'op_user_id': op_user_id,
            'device_info': device_info,
            'version': '1.0',
            'type': 'XML',
        }
        return self._post('promotion/query_coupon', data=data)
119794
static final HllSketchImpl promoteHeapListOrSetToHll(final CouponList src) {
    final HllArray tgtHllArr = HllArray.newHeapHll(src.lgConfigK, src.tgtHllType);
    final PairIterator srcItr = src.iterator();
    tgtHllArr.putKxQ0(1 << src.lgConfigK);
    while (srcItr.nextValid()) {
      tgtHllArr.couponUpdate(srcItr.getPair());
    }
    tgtHllArr.putHipAccum(src.getEstimate());

    tgtHllArr.putOutOfOrderFlag(false);
    return tgtHllArr;
  }
485107
public function loadByOrderIdAndQuoteId($orderId, $quoteId)
    {
        $collection = $this->addFieldToFilter('order_id', $orderId)
            ->addFieldToFilter('quote_id', $quoteId)
            ->setPageSize(1);

        if ($collection->getSize()) {
            return $collection->getFirstItem();
        }

        return false;
    }
280603
async function prevQuote(store) {
  await store.update(state => {
    state.quoteId = state.quoteId - 1
    if (state.quoteId <= 0) {
      state.quoteId = MAX_QUOTE_ID
    }
  })
}
696084
def QA_SU_save_deal(dealist, client=DATABASE):
    

    if isinstance(dealist, pd.DataFrame):

        collection = client.deal

        collection.create_index(
            [('account_cookie',
              ASCENDING),
             ('trade_id',
              ASCENDING)],
            unique=True
        )
        try:
            dealist = QA_util_to_json_from_pandas(dealist.reset_index())
            collection.insert_many(dealist, ordered=False)
        except Exception as e:

            pass
473578
private function createCustomerFirstAbandonedCart($quoteCollection, $storeId, $campaignId)
    {
        $result = 0;
        foreach ($quoteCollection as $quote) {
            $websiteId = $this->helper->storeManager->getStore($storeId)->getWebsiteId();
            if (! $this->updateDataFieldAndCreateAc($quote, $websiteId, $storeId)) {
                continue;
            }

            //send campaign; check if valid to be sent
            if ($this->isLostBasketCustomerEnabled(self::CUSTOMER_LOST_BASKET_ONE, $storeId)) {
                $this->sendEmailCampaign(
                    $quote->getCustomerEmail(),
                    $quote,
                    $campaignId,
                    self::CUSTOMER_LOST_BASKET_ONE,
                    $websiteId
                );
            }

            $this->totalCustomers++;
            $result = $this->totalCustomers;
        }

        return $result;
    }
1205708
def config_id_exists(search_id):
    
    response = utils.checked_api_call(pnc_api.build_configs, 'get_specific', id=search_id)
    if not response:
        return False
    return True
514449
function(view_config, id) {

		if (Lava.schema.DEBUG && !Lava.isValidId(id)) Lava.t();
		view_config.id = id;

	}
370614
def _hook_id(self, info):
        
        if isinstance(info, dict) and 'id' in info.keys():
            self.id = info['id']
745810
def add(self, discount_name, target_types, target_ids, discount_types, discount_values, session):
        ''''''
        request = TOPRequest('taobao.fenxiao.discount.add')
        request['discount_name'] = discount_name
        request['target_types'] = target_types
        request['target_ids'] = target_ids
        request['discount_types'] = discount_types
        request['discount_values'] = discount_values
        self.create(self.execute(request, session), fields=['discount_id'])
        return self.discount_id
1286151
public static CouponputGetResult couponputGet(String accessToken, ShopInfo shopInfo) {
        return couponputGet(accessToken, JsonUtil.toJSONString(shopInfo));
    }
1370498
def onchange_partner_id(self):
        '''
        
        '''
        if self.partner_id:
            partner_rec = self.env['res.partner'].browse(self.partner_id.id)
            order_ids = [folio.order_id.id for folio in self]
            if not order_ids:
                self.partner_invoice_id = partner_rec.id
                self.partner_shipping_id = partner_rec.id
                self.pricelist_id = partner_rec.property_product_pricelist.id
                raise _('Not Any Order For  %s ' % (partner_rec.name))
            else:
                self.partner_invoice_id = partner_rec.id
                self.partner_shipping_id = partner_rec.id
                self.pricelist_id = partner_rec.property_product_pricelist.id
979065
public void cart_cartId_coupon_DELETE(String cartId, String coupon) throws IOException {
		String qPath = "/order/cart/{cartId}/coupon";
		StringBuilder sb = path(qPath, cartId);
		query(sb, "coupon", coupon);
		execN(qPath, "DELETE", sb.toString(), null);
	}
1280826
def ack(self, id, transaction=None, receipt=None):
        
        assert id is not None, "'id' is required"
        headers = {HDR_MESSAGE_ID: id}
        if transaction:
            headers[HDR_TRANSACTION] = transaction
        if receipt:
            headers[HDR_RECEIPT] = receipt
        self.send_frame(CMD_ACK, headers)