Get a single promotion

@link https://cheddargetter.com/developers#single-promotion
@param string $code Coupon code
@param string|null $id CG id for the promotion
@return CheddarGetter_Response
@throws CheddarGetter_Response_Exception
325090
public function getPromotion($code, $id = null)
    {
        $this->_requireIdentifier($code, $id);
        return new CheddarGetter_Response(
                                                                                    $this->request('/promotions/get' . (($id) ? '/id/'.$id : '/code/' . urlencode($code)))
                                                                                );
    }
1011831
public function getMembercardUserInfo($code, $card_id)
    {
        $params = array();
        $params['code'] = $code;
        $params['card_id'] = $card_id;
        $rst = $this->_request->post($this->_url . 'card/membercard/userinfo/get', $params);
        return $this->_client->rst($rst);
    }
1232094
public function actionConfirm($id, $code)
    {
        $user = $this->finder->findUserById($id);

        if ($user === null || $this->module->emailChangeStrategy == Module::STRATEGY_INSECURE) {
            throw new NotFoundHttpException();
        }

        $event = $this->getUserEvent($user);

        $this->trigger(self::EVENT_BEFORE_CONFIRM, $event);
        $user->attemptEmailChange($code);
        $this->trigger(self::EVENT_AFTER_CONFIRM, $event);

        return $this->redirect(['account']);
    }
231243
function addNoscript($code, $id = null) {
        if($id) {
            $this->noscript[$id] = $code;
        } else {
            $this->noscript[] = $code;
        }
        
        return $this;
    }
1004953
public function getStoreWebsiteIdByCode($code)
    {

        // query whether or not, the requested store website is available
        if (isset($this->storeWebsites[$code])) {
            return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID];
        }

        // throw an exception, if not
        throw new \Exception(sprintf('Found invalid website code "%s"', $code));
    }
297401
protected static function deleteDiscountCouponByIdAsyncWithHttpInfo($discount_coupon_id) 
    {
        $returnType = '';  
        $request = self::deleteDiscountCouponByIdRequest($discount_coupon_id); 

        return self::getHttpClient()
            ->sendAsync($request, self::createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
1319622
protected function getTokenByAuthorizationCodeGrant($code)
    {
        try {
            $token = $this->getAuthorizationServer()->getAccessToken('authorization_code', [
                'code' => $code,
            ]);

            $this->getFrameworkBridge()->persistUserToken($token);

            return $token;
        } catch (IdentityProviderException $e) {
            return null;
        }
    }
680134
public function generate(Exception $exception, string $id, int $code)
    {
        $errors = $this->path ? json_decode(file_get_contents($this->path), true) : [500 => ['name' => 'Internal Server Error', 'message' => 'An error has occurred and this resource cannot be displayed.']];

        if (isset($errors[$code])) {
            $info = array_merge(['id' => $id, 'code' => $code], $errors[$code]);
        } else {
            $info = array_merge(['id' => $id, 'code' => 500], $errors[500]);
        }

        if ($exception instanceof HttpExceptionInterface) {
            $msg = (string) $exception->getMessage();
            $info['detail'] = (strlen($msg) > 4) ? $msg : $info['message'];
            $info['summary'] = (strlen($msg) < 36 && strlen($msg) > 4) ? $msg : 'Houston, We Have A Problem.';
        } else {
            $info['detail'] = $info['message'];
            $info['summary'] = 'Houston, We Have A Problem.';
        }

        unset($info['message']);

        return $info;
    }
786607
@Override
    public WxResp card_code_get(String code, String cardId) {
    	return card_code_get(code, cardId, null);
    }
1226087
public function deactivate(string $cardId, string $code)
    {
        $params = [
            'card_id' => $cardId,
            'code' => $code,
        ];

        return $this->httpPostJson('card/generalcard/unactivate', $params);
    }
765198
public function invoices($code = null)
    {
        if (! $code) {
            $code = $this->data->code;
        }

        return $this->client->get('/{code}/invoices', [$code])
                            ->setDataKey('invoices')
                            ->getResults();
    }
1162086
final public function get($id = null)
    {
        if ($id !== null) {
            $this->where($this->pk, '=', $id);
            $this->pkval = $id;
        }

        return $this->_get();
    }
1078676
public function getInfo(string $id, string $code): array
    {
        return $this->httpClient->postJson('card/invoice/reimburse/getinvoiceinfo', ['card_id' => $id, 'encrypt_code' => $code]);
    }
488087
public function actionConfirm($id, $code)
    {
        $user = User::findOne($id);
        if ($user === null || Yii::$app->settings->get('enableConfirmation','user') == false) {
            return $this->goBack();
        }
        $user->attemptEmailConfirmation($code);
        return $this->redirect(['/user/settings/profile']);
    }
1168813
public function getCode($code, $card_id = null, $check_consume = null)
    {
        $data = ['code' => $code];
        is_null($card_id) || $data['card_id'] = $card_id;
        is_null($check_consume) || $data['check_consume'] = $check_consume;
        $url = "https://api.weixin.qq.com/card/code/get?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
65946
public static function getMessageByCode($code)
    {
        return isset(self::$_httpCodes[$code]) ? self::$_httpCodes[$code] : null;
    }
841416
protected function UserGetGroupIdByCode($code)
    {
        $rsGroups = CGroup::GetList(($by = 'c_sort'), ($order = 'desc'), [
            'STRING_ID' => $code,
        ]);
        if ($ob = $rsGroups->Fetch()) {
            return $ob['ID'];
        } else {
            return null;
        }
    }