Create a new Gift Card Adjustment
181314
def add_adjustment(self, adjustment):
        
        resource = self.post("adjustments", adjustment.encode())
        return GiftCardAdjustment(GiftCard.format.decode(resource.body))
890309
def adjust!(other)
      @x0 = other.x0 if other.x0 < @x0
      @y0 = other.y0 if other.y0 < @y0
      @x1 = other.x1 if other.x1 > @x1
      @y1 = other.y1 if other.y1 > @y1
    end
1172271
def calculate        
      self.update_column(:subtotal  , self.calculate_subtotal  )
      self.update_column(:tax       , self.calculate_tax       )
      self.update_column(:shipping  , self.calculate_shipping  )
      self.update_column(:handling  , self.calculate_handling  )
      self.update_column(:gift_wrap , self.calculate_gift_wrap )
      
      # Calculate the total without the discounts first       
      self.discounts.each{ |d| d.update_column(:amount, 0.0) } if self.discounts
      self.update_column(:discount  , 0.00)
      self.update_column(:total     , self.calculate_total     )
            
      # Now calculate the discounts and re-calculate the total
      self.update_column(:discount  , self.calculate_discount  )
      self.update_column(:total     , self.calculate_total     )      
      
      self.update_column(:cost      , self.calculate_cost      )
      self.update_column(:profit    , self.calculate_profit    )              
    end
647015
public static CreateResult create(String accessToken, GiftCard giftCard) {
		Create<GiftCard> card = new Create<GiftCard>();
		card.setCard(giftCard);
		return create(accessToken, card);
	}
415900
void adjustLeft(float newValue) {
    	Object[] o = (Object[])attributes.get(Chunk.TAB);
    	if (o != null) {
    		attributes.put(Chunk.TAB, new Object[]{o[0], o[1], o[2], new Float(newValue)});
    	}
    }
995522
public function customWxcard($card_id = '', $card_ext = [], $openid, $kf_account = '')
    {
        $queryStr                       = [];
        $queryStr['touser']             = $openid;
        $queryStr['msgtype']            = 'wxcard';
        $queryStr['wxcard']['card_id']  = $card_id;
        $queryStr['wxcard']['card_ext'] = $card_ext;

        $queryStr['customservice']['kf_account'] = $kf_account;

        $this->module = 'message';

        $res = $this->_post('custom/send', $queryStr);

        return $res;
    }
410377
def update(self, portfolio, date, perfs=None):
        '''
        
        '''
        # Make the manager aware of current simulation
        self.portfolio = portfolio
        self.perfs = perfs
        self.date = date
697019
def adjust(self):
        

        if self._fro is None and self._to is not None:
            self._fro = dict(
                [(value.lower(), key) for key, value in self._to.items()])
        if self._to is None and self._fro is not None:
            self._to = dict(
                [(value.lower(), key) for key, value in self._fro.items()])
561087
public function modifyCardStock($card_id, $increase_stock_value = 0, $reduce_stock_value = 0)
    {
        if (empty($card_id)) {
            return false;
        }
        $result = $this->httpPost(static::WECHAT_MODIFY_CARD_STOCK . 'access_token=' . $this->getAccessToken(), [
            'card_id' => $card_id,
            'increase_stock_value' => $increase_stock_value,
            'reduce_stock_value' => $reduce_stock_value
        ]);

        return isset($result['errmsg']) && $result['errmsg'] === 'ok' ? true : false;
    }
710800
public void setAdjustment(String name, String amount)
    {
        HashMap<String, String> adjustment = new HashMap<String, String>();
        adjustment.put("name", name);
        adjustment.put("amount", amount);
        this.adjustments.add(adjustment);
    }
365718
def applyVoucherCodeTemporarily(sender,**kwargs):
    '''
    
    '''
    logger.debug('Signal fired to apply temporary vouchers.')

    reg = kwargs.pop('registration')
    voucherId = reg.data.get('gift','')

    try:
        voucher = Voucher.objects.get(voucherId=voucherId)
    except ObjectDoesNotExist:
        logger.debug('No applicable vouchers found.')
        return

    tvu = TemporaryVoucherUse(voucher=voucher,registration=reg,amount=0)
    tvu.save()
    logger.debug('Temporary voucher use object created.')
115900
def modify(self, **params):
        """"""
        data = self.api_client.update_account(self.id, **params)
        self.update(data)
        return data
877042
public function updateCard(string $token): void
    {
        $customer = $this->asStripeCustomer();
        $token = Token::retrieve($token, ['api_key' => $this->getStripeKey()]);
        // If the given token already has the card as their default source, we can just
        // bail out of the method now. We don't need to keep adding the same card to
        // the user's account each time we go through this particular method call.
        if ($token->card->id === $customer->default_source) {
            return;
        }
        $card = $customer->sources->create(['source' => $token]);
        $customer->default_source = $card->id;
        $customer->save();
        // Next, we will get the default source for this user so we can update the last
        // four digits and the card brand on this user record in the database, which
        // is convenient when displaying on the front-end when updating the cards.
        $source = $customer->default_source
            ? $customer->sources->retrieve($customer->default_source)
            : null;

        $this->fillCardDetails($source);

        $this->save();
    }
1321416
function adjust(color, prop, amount){
  utils.assertColor(color, 'color');
  utils.assertString(prop, 'prop');
  utils.assertType(amount, 'unit', 'amount');
  var hsl = color.hsla.clone();
  prop = { hue: 'h', saturation: 's', lightness: 'l' }[prop.string];
  if (!prop) throw new Error('invalid adjustment property');
  var val = amount.val;
  if ('%' == amount.type){
    val = 'l' == prop && val > 0
      ? (100 - hsl[prop]) * val / 100
      : hsl[prop] * (val / 100);
  }
  hsl[prop] += val;
  return hsl.rgba;
}
1094636
def create(cls, cards, custom_headers=None):
        

        if custom_headers is None:
            custom_headers = {}

        request_map = {
            cls.FIELD_CARDS: cards
        }
        request_map_string = converter.class_to_json(request_map)
        request_map_string = cls._remove_field_for_request(request_map_string)

        api_client = client.ApiClient(cls._get_api_context())
        request_bytes = request_map_string.encode()
        endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id())
        response_raw = api_client.post(endpoint_url, request_bytes,
                                       custom_headers)

        return BunqResponseCardBatch.cast_from_bunq_response(
            cls._from_json(response_raw, cls._OBJECT_TYPE_POST)
        )
1096252
def modify_customer(self, handle, address, phone, email=None, vat=None, fax=None,
                        company_name=None, additional_data=None, extension_additional_data=None):
        """"""

        self.request(E.modifyCustomerRequest(
            E.handle(handle),
            E.vat(vat or ''),
            _get_phone_xml('phone', phone),
            _get_phone_xml('fax', fax),
            E.address(
                E.street(address.street),
                E.number(address.number),
                E.suffix(address.suffix or ''),
                E.zipcode(address.zipcode),
                E.city(address.city),
                E.state(address.state or ''),
                E.country(address.country),
            ),
            E.email(email or ''),
            _additional_data(additional_data),
            _extension_additional_data(extension_additional_data),
        ))

        return True
55759
protected function recalculateTotal(): void
    {
        $this->total = $this->itemsTotal + $this->adjustmentsTotal;

        if ($this->total < 0) {
            $this->total = 0;
        }
    }