protected function addDiscountLines(array $params, array $options)
    {
        if (isset($options['discount'])) {
            $type = Arr::get($options, 'discount_type');
            if (!in_array($type, ['loyalty', 'campaign', 'coupon', 'sign'])) {
                $type = 'loyalty';
            }

            $code = Arr::get($options, 'discount_code', '---');
            if (strlen($code) < 3) {
                $code .= str_repeat('-', 3 - strlen($code));
            }

            $params['discount_lines'][] = [
                'type'   => $type,
                'code'   => $code,
                'amount' => $options['discount'],
            ];
        }

        return $params;
    }
protected function addDiscountLines(array $params, array $options)
    {
        if (isset($options['discount'])) {
            $type = Arr::get($options, 'discount_type');
            if (!in_array($type, ['loyalty', 'campaign', 'coupon', 'sign'])) {
                $type = 'loyalty';
            }

            $code = Arr::get($options, 'discount_code', '---');
            if (strlen($code) < 3) {
                $code .= str_repeat('-', 3 - strlen($code));
            }

            $params['discount_lines'][] = [
                'type'   => $type,
                'code'   => $code,
                'amount' => $options['discount'],
            ];
        }

        return $params;
    }
protected function addDiscountLines ( array $ params , array $ options ) { if ( isset ( $ options [ 'discount' ] ) ) { $ type = Arr :: get ( $ options , 'discount_type' ) ; if ( ! in_array ( $ type , [ 'loyalty' , 'campaign' , 'coupon' , 'sign' ] ) ) { $ type = 'loyalty' ; } $ code = Arr :: get ( $ options , 'discount_code' , '---' ) ; if ( strlen ( $ code ) < 3 ) { $ code .= str_repeat ( '-' , 3 - strlen ( $ code ) ) ; } $ params [ 'discount_lines' ] [ ] = [ 'type' => $ type , 'code' => $ code , 'amount' => $ options [ 'discount' ] , ] ; } return $ params ; }
Add order discount lines param.

@param string[] $params
@param string[] $options

@return array
Add order discount lines param .