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

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