创建卡券.

@param string $cardType
@param array  $baseInfo
@param array  $especial
@param array  $advancedInfo

@return \EntWeChat\Support\Collection
430527
public function create($cardType = 'member_card', array $baseInfo = [], array $especial = [], array $advancedInfo = [])
    {
        $params = [
            'card' => [
                'card_type'           => strtoupper($cardType),
                strtolower($cardType) => array_merge(['base_info' => $baseInfo], $especial, ['advanced_info' => $advancedInfo]),
            ],
        ];

        return $this->parseJSON('json', [self::API_CREATE_CARD, $params]);
    }
964951
public function getCard($cardID)
    {
        $tokenContext = new TokenContext("", 'get');
        $token = $this->accessTokenProvider->getToken($tokenContext);

        $responseModel = $this->cardClient->getCard($cardID, (string)$token);
        if ($responseModel instanceof ErrorResponseModel) {
            throw new CardClientException(
                "error response from card service", $responseModel->getCode(), $responseModel->getMessage()
            );
        }

        $card = $this->parseRawCard($responseModel->getRawSignedModel(), $responseModel->isOutdated());

        if (!$this->cardVerifier->verifyCard($card)) {
            throw new CardVerificationException('Validation errors have been detected');
        }

        return $card;
    }
937834
public function attachExtension($cardId, array $extension = [])
    {
        $timestamp = time();
        $nonce = str_random(6);
        $ticket = $this->getTicket()['ticket'];

        $ext = array_merge(['timestamp' => $timestamp, 'nonce_str' => $nonce], Arr::only(
            $extension,
            ['code', 'openid', 'outer_id', 'balance', 'fixed_begintimestamp', 'outer_str']
        ));

        $ext['signature'] = $this->dictionaryOrderSignature($ticket, $timestamp, $cardId, $ext['code'] ?? '', $ext['openid'] ?? '', $nonce);

        return [
            'cardId' => $cardId,
            'cardExt' => json_encode($ext),
        ];
    }
1097176
public function createCustomer($paymentType, $customerId, $payment, $additional = [])
    {
        $this->integrityCheck();
        $createCustomerRes = $this->mpay24Sdk->createCustomer($paymentType, $customerId, $payment, $additional);
        $this->recordedLastMessageExchange('CreateCustomer');

        return $createCustomerRes;
    }
1095416
public static function queryByType( $parentId, $parentType, $type = ModelComment::TYPE_COMMENT, $config = [] ) {

		//$type	= isset( $config[ 'type' ] ) ? $config[ 'type' ] : self::TYPE_COMMENT;
		$status	= isset( $config[ 'status' ] ) ? $config[ 'status' ] : self::STATUS_APPROVED;

		return self::queryByParent( $parentId, $parentType, $config )->andWhere( [ 'type' => $type, 'status' => $status ] );
	}
760242
public function setPaycell($card_id, $is_open = true)
    {
        $url = "https://api.weixin.qq.com/card/paycell/set?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['card_id' => $card_id, 'is_open' => $is_open]);
    }
606384
public function getCardMemberCardDetail($begin_date, $end_date, $card_id)
    {
        $data = ['begin_date' => $begin_date, 'end_date' => $end_date, 'card_id' => $card_id];
        $url = "https://api.weixin.qq.com/datacube/getcardmembercarddetail?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
488422
public ResponseBuilder withSimpleCard(String cardTitle, String cardText) {
        this.card = SimpleCard.builder()
                .withContent(cardText)
                .withTitle(cardTitle)
                .build();
        return this;
    }
979883
public function getcardbizuininfo($begin_date, $end_date, $cond_source = 0)
    {
        if (empty($begin_date) || empty($end_date) || !is_numeric($cond_source) || $cond_source < 0 || $cond_source > 1) {
            $this->setError('参数错误');

            return false;
        }

        if (is_numeric($begin_date)) {
            $begin_date = date('Y-m-d', $begin_date);
        }

        if (is_numeric($end_date)) {
            $end_date = date('Y-m-d', $end_date);
        }

        $queryStr                = [];
        $queryStr['begin_date']  = $begin_date;
        $queryStr['end_date']    = $end_date;
        $queryStr['cond_source'] = intval($cond_source);

        $this->apitype = 'datacube';
        $this->module  = 'getcardbizuininfo';
        $res           = $this->_post('', $queryStr);

        return $res;
    }
740545
public function sendWxcardByTag($tag_id, $card_id, array $card_ext = array(), $is_to_all = false)
    {
        $ret = array();
        $ret['filter']['group_id'] = $tag_id;
        $ret['filter']['is_to_all'] = $is_to_all;
        $ret['msgtype'] = 'wxcard';
        $ret['wxcard']['card_id'] = $card_id;
        if (! empty($card_ext)) {
            $ret['wxcard']['card_ext'] = json_encode($card_ext);
        }
        return $this->sendAll($ret);
    }
1068716
public function create($type = 'member_card', $base_info = [], $especial = [], $advanced_info = [])
    {
        if (!is_string($type) || !is_array($base_info) || !is_array($especial)) {
            $this->setError('参数缺失');

            return false;
        }

        $card                      = [];
        $card['card']              = [];
        $card['card']['card_type'] = strtoupper($type);

        $type = strtolower($type);

        $card['card'][$type] = [];

        $card_info              = [];
        $card_info['base_info'] = $base_info;

        $card['card'][$type] = array_merge($card_info, $especial, $advanced_info);

        $this->apitype = 'card';
        $this->module  = 'create';

        $res = $this->_post('', $card);

        return $res;
    }
195257
public function normalize($transaction, $format = null, array $context = array())
    {
        /** @var  $transaction Transaction */
        $credentials = $transaction->getCredentials();

        $createTransactionRequest = array();

        if ($format == 'xml') {
            $createTransactionRequest['@xmlns'] = 'AnetApi/xml/v1/schema/AnetApiSchema.xsd';
        }

        $merchantAuthentication = array(
            'name' => $credentials->getCredential('username'),
            'transactionKey' => $credentials->getCredential('password'),
        );

        $transactionRequest = array(
            "transactionType" => $this->getTransactionType($transaction)
        );

        if ($transaction->getType()->getValue() != Transaction\TransactionType::VOID) {
            $transactionRequest['amount'] = $transaction->getAmount();
        }

        $account = $transaction->getAccount();
        if (in_array($transaction->getType()->getValue(), array(
            Transaction\TransactionType::SALE,
            Transaction\TransactionType::AUTH,
            Transaction\TransactionType::REFUND))
        ){
            $payment = array();
            if ($account instanceof CardAccount) {
                if ($account instanceof SwipedCardAccount
                    && $transaction->getType()->getValue() != Transaction\TransactionType::REFUND
                ){
                    $payment['trackData'] = array();
                    if ($account->getTrackOne()) {
                        $payment['trackData']['track1'] = $account->getTrackOne();
                    } elseif ($account->getTrackTwo()) {
                        $payment['trackData']['track2'] = $account->getTrackTwo();
                    }
                } else {
                    $payment = array(
                        'creditCard' => array(
                            'cardNumber' => $account->getAccountNumber(),
                            'expirationDate' => $account->getExpMonth()->getLongMonth() . $account->getExpYear()->getShortYear(),
                        )
                    );

                    if (isset($options['enable_cvv']) && true === $options['enable_cvv']
                        && $transaction->getType()->getValue() != Transaction\TransactionType::REFUND) {
                        $payment['creditCard']['cardCode'] = $account->getCvv();
                    }
                }
            } elseif ($account instanceof BankAccount) {
                $payment = array(
                    'bankAccount' => array(
                        'accountType' => 'checking',
                        'routingNumber' => $account->getRoutingNumber(),
                        'accountNumber' => $account->getAccountNumber(),
                        'nameOnAccount' => $account->getName()
                    )
                );
            } else {
                throw new InvalidArgumentException(sprintf("Unsupported Account Type %s", get_class($account)));
            }

            $transactionRequest['payment'] = $payment;
        }

        if ($context['event_id']) {
            $transactionRequest['order'] = array();
            $transactionRequest['order']['invoiceNumber'] = $context['event_id'];
        }


        if (in_array($transaction->getType()->getValue(), array(
            Transaction\TransactionType::CAPTURE,
            Transaction\TransactionType::REFUND,
            Transaction\TransactionType::VOID))
        ) {
            $transactionRequest['refTransId'] = $transaction->getParent()->getResult()->getExternalId();
        }


        if (in_array($transaction->getType()->getValue(), array(
            Transaction\TransactionType::SALE,
            Transaction\TransactionType::AUTH))
        ) {
                $names = explode(' ', $account->getName(), 2);
                $firstName = isset($names[0]) ? $names[0] : '';
                $lastName = isset($names[1]) ? $names[1] : '';

                if (isset($context['email'])) {
                    $transactionRequest['customer'] = array(
                        'email' => $context['email']
                    );
                }

                $transactionRequest['billTo'] = array(
                    'firstName' => $firstName,
                    'lastName' => $lastName,
                    'address' => $account->getAddress(),
                    'city' => $account->getCity(),
                    'state' => $account->getRegion(),
                    'zip' => $account->getPostalCode(),
                    'country' => $account->getCountry(),
                );
        }

        if ($account instanceof SwipedCardAccount
            && !in_array($transaction->getType()->getValue(), array(Transaction\TransactionType::REFUND, Transaction\TransactionType::VOID))
        ){
            $transactionRequest['retail'] = array(
                'marketType' => 2,
                'deviceType' => 7
            );
        }

        if (isset($context['test']) && $context['test'])  {
            $transactionRequest['transactionSettings']['setting'][] = array(
                'settingName' => 'testRequest',
                'settingValue' => 'true'
            );
        }

        if (isset($context['userFields'])) {
            $transactionRequest['userFields'] = array();
            $transactionRequest['userFields']['userField'] = array();
            foreach ($context['userFields'] as $name => $value) {
                $transactionRequest['userFields']['userField'][] = array(
                    'name' => $name,
                    'value' => $value
                );
            }
        }

        $createTransactionRequest['merchantAuthentication'] = $merchantAuthentication;
        $createTransactionRequest['transactionRequest'] = $transactionRequest;

        return $createTransactionRequest;
    }
1355330
public static function create(array $cards, array $customHeaders = []): BunqResponseCardBatch
    {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->post(
            vsprintf(
                self::ENDPOINT_URL_CREATE,
                [static::determineUserId()]
            ),
            [self::FIELD_CARDS => $cards],
            $customHeaders
        );

        return BunqResponseCardBatch::castFromBunqResponse(
            static::fromJson($responseRaw, self::OBJECT_TYPE_POST)
        );
    }
1292931
public function update($cardId, $type, array $attributes = [])
    {
        $card = [];
        $card['card_id'] = $cardId;
        $card[strtolower($type)] = $attributes;

        return $this->httpPostJson('card/update', $card);
    }
758300
public function updateCard($card_id, array $member_card)
    {
        $url = "https://api.weixin.qq.com/card/update?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['card_id' => $card_id, 'member_card' => $member_card]);
    }
96633
public function create(array $base, array $properties = array(), $type = self::TYPE_GENERAL_COUPON)
    {
        $key = strtolower($type);
        $card = array_merge(array('base_info' => $base), $properties);
        $params = array(
            'card' => array(
                'card_type' => $type,
                $key => $card,
            ),
        );

        $result = $this->http->jsonPost(self::API_CREATE, $params);

        return $result['card_id'];
    }
493010
public function createCustomer($type, $customerId ,$payment = [], $additional = [])
    {
        $request = new CreateCustomer($this->config->getMerchantId());

        $request->setPType($type);
        $request->setPaymentData($payment);
        $request->setCustomerId($customerId);
        $request->setAdditional($additional);

        $this->request = $request->getXml();

        $this->send();

        $result = new CreateCustomerResponse($this->response);

        return $result;
    }