Code Duplication    Length = 14-15 lines in 2 locations

src/Payment/LuckyMoney/API.php 1 location

@@ 168-182 (lines=15) @@
165
     *
166
     * @return \EntWeChat\Support\Collection
167
     */
168
    protected function request($api, array $params, $method = 'post')
169
    {
170
        $params = array_filter($params);
171
        $params['mch_id'] = $this->merchant->merchant_id;
172
        $params['nonce_str'] = uniqid();
173
        $params['sign'] = \EntWeChat\Payment\generate_sign($params, $this->merchant->key, 'md5');
174
175
        $options = [
176
            'body'    => XML::build($params),
177
            'cert'    => $this->merchant->get('cert_path'),
178
            'ssl_key' => $this->merchant->get('key_path'),
179
        ];
180
181
        return $this->parseResponse($this->getHttp()->request($api, $method, $options));
182
    }
183
184
    /**
185
     * Parse Response XML to array.

src/Payment/MerchantPay/API.php 1 location

@@ 103-116 (lines=14) @@
100
     *
101
     * @return \EntWeChat\Support\Collection
102
     */
103
    protected function request($api, array $params, $method = 'post')
104
    {
105
        $params = array_filter($params);
106
        $params['nonce_str'] = uniqid();
107
        $params['sign'] = \EntWeChat\Payment\generate_sign($params, $this->merchant->key, 'md5');
108
109
        $options = [
110
            'body'    => XML::build($params),
111
            'cert'    => $this->merchant->get('cert_path'),
112
            'ssl_key' => $this->merchant->get('key_path'),
113
        ];
114
115
        return $this->parseResponse($this->getHttp()->request($api, $method, $options));
116
    }
117
118
    /**
119
     * Parse Response XML to array.