Code Duplication    Length = 13-14 lines in 2 locations

src/Payment/LuckyMoney/API.php 1 location

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

src/Payment/MerchantPay/API.php 1 location

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