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']);
    }
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']);
    }
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' ] ) ; }
Create a new discount

@link   https://help.shopify.com/api/reference/discount#create
@param  integer $priceRuleId
@param  DiscountCode $discountCode
@return void
Create a new discount