Code Duplication    Length = 14-15 lines in 2 locations

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.

src/Payment/LuckyMoney/API.php 1 location

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