Code Duplication    Length = 14-15 lines in 2 locations

src/Payment/LuckyMoney/API.php 1 location

@@ 182-196 (lines=15) @@
179
     *
180
     * @return \EasyWeChat\Support\Collection
181
     */
182
    protected function request($api, array $params, $method = 'post')
183
    {
184
        $params = array_filter($params);
185
        $params['mch_id'] = $this->merchant->merchant_id;
186
        $params['nonce_str'] = uniqid();
187
        $params['sign'] = \EasyWeChat\Payment\generate_sign($params, $this->merchant->key, 'md5');
188
189
        $options = [
190
            'body' => XML::build($params),
191
            'cert' => $this->merchant->get('cert_path'),
192
            'ssl_key' => $this->merchant->get('key_path'),
193
        ];
194
195
        return $this->parseResponse($this->getHttp()->request($api, $method, $options));
196
    }
197
198
    /**
199
     * Parse Response XML to array.

src/Payment/MerchantPay/API.php 1 location

@@ 122-135 (lines=14) @@
119
     *
120
     * @return \EasyWeChat\Support\Collection
121
     */
122
    protected function request($api, array $params, $method = 'post')
123
    {
124
        $params = array_filter($params);
125
        $params['nonce_str'] = uniqid();
126
        $params['sign'] = \EasyWeChat\Payment\generate_sign($params, $this->merchant->key, 'md5');
127
128
        $options = [
129
            'body' => XML::build($params),
130
            'cert' => $this->merchant->get('cert_path'),
131
            'ssl_key' => $this->merchant->get('key_path'),
132
        ];
133
134
        return $this->parseResponse($this->getHttp()->request($api, $method, $options));
135
    }
136
137
    /**
138
     * Parse Response XML to array.