Code Duplication    Length = 15-15 lines in 4 locations

catalog/includes/apps/braintree/lib/Braintree/CreditCardVerificationGateway.php 1 location

@@ 40-54 (lines=15) @@
37
        }
38
    }
39
40
    public function fetch($query, $ids)
41
    {
42
        $criteria = [];
43
        foreach ($query as $term) {
44
            $criteria[$term->name] = $term->toparam();
45
        }
46
        $criteria["ids"] = CreditCardVerificationSearch::ids()->in($ids)->toparam();
47
        $path = $this->_config->merchantPath() . '/verifications/advanced_search';
48
        $response = $this->_http->post($path, ['search' => $criteria]);
49
50
        return Util::extractattributeasarray(
51
            $response['creditCardVerifications'],
52
            'verification'
53
        );
54
    }
55
56
    public function search($query)
57
    {

catalog/includes/apps/braintree/lib/Braintree/CustomerGateway.php 1 location

@@ 45-59 (lines=15) @@
42
        return new ResourceCollection($response, $pager);
43
    }
44
45
    public function fetch($query, $ids)
46
    {
47
        $criteria = [];
48
        foreach ($query as $term) {
49
            $criteria[$term->name] = $term->toparam();
50
        }
51
        $criteria["ids"] = CustomerSearch::ids()->in($ids)->toparam();
52
        $path = $this->_config->merchantPath() . '/customers/advanced_search';
53
        $response = $this->_http->post($path, ['search' => $criteria]);
54
55
        return Util::extractattributeasarray(
56
            $response['customers'],
57
            'customer'
58
        );
59
    }
60
61
    /**
62
     * Creates a customer using the given +attributes+. If <tt>:id</tt> is not passed,

catalog/includes/apps/braintree/lib/Braintree/SubscriptionGateway.php 1 location

@@ 73-87 (lines=15) @@
70
        return new ResourceCollection($response, $pager);
71
    }
72
73
    public function fetch($query, $ids)
74
    {
75
        $criteria = [];
76
        foreach ($query as $term) {
77
            $criteria[$term->name] = $term->toparam();
78
        }
79
        $criteria["ids"] = SubscriptionSearch::ids()->in($ids)->toparam();
80
        $path = $this->_config->merchantPath() . '/subscriptions/advanced_search';
81
        $response = $this->_http->post($path, ['search' => $criteria]);
82
83
        return Util::extractAttributeAsArray(
84
            $response['subscriptions'],
85
            'subscription'
86
        );
87
    }
88
89
    public function update($subscriptionId, $attributes)
90
    {

catalog/includes/apps/braintree/lib/Braintree/TransactionGateway.php 1 location

@@ 333-347 (lines=15) @@
330
        }
331
    }
332
333
    public function fetch($query, $ids)
334
    {
335
        $criteria = [];
336
        foreach ($query as $term) {
337
            $criteria[$term->name] = $term->toparam();
338
        }
339
        $criteria["ids"] = TransactionSearch::ids()->in($ids)->toparam();
340
        $path = $this->_config->merchantPath() . '/transactions/advanced_search';
341
        $response = $this->_http->post($path, ['search' => $criteria]);
342
343
        return Util::extractattributeasarray(
344
            $response['creditCardTransactions'],
345
            'transaction'
346
        );
347
    }
348
349
    /**
350
     * void a transaction by id