Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.2.0-b1
-
Component/s: None
-
Labels:None
Description
Error when deleting a payment account:
components/gateways/merchant/braintree/braintree.php on line 606 Message: Call to undefined method Braintree\CreditCard::remove()
Solution, replace:
$card = Braintree_CreditCard::remove($account_reference_id);
With
$card = Braintree_CreditCard::delete($account_reference_id);
Error when creating second payment account:
Undefined property on Braintree\Customer: customer on line 49 in /home/billingpreapp100/public_html/components/gateways/merchant/braintree/lib/Braintree/Base.php
Solution, replace braintree::storeCc with
public function storeCc(array $card_info, array $contact, $client_reference_id = null) { $this->loadApi(); // Format card and customer data to be submitted to BrainTree $params = $this->getCardStorageParameters($card_info, $contact); $customer = null; // Retrieve an existing customer from BrainTree if set if (!is_null($client_reference_id)) { try { $customer = Braintree_Customer::find($client_reference_id); } catch (Braintree\Exception\NotFound $ex) { // Do nothing } } // No customer exists, create a new one if (is_null($customer)) { $result = Braintree_Customer::create($params['customer']); // Log customer creation $this->logActions( 'Customer::Create', $result->success, $result, $params['customer'] ); // Customer creation failed if (!$result->success) { return false; } $customer = $result->customer; } // Create new credit card for the customer $params['card']['customerId'] = $customer->id; $card = Braintree_CreditCard::create($params['card']); // Log card creation $this->logActions( 'CreditCard::Create', $card->success, $card, $params['card'] ); // Card creation failed if (!$card->success) { return false; } return [ 'client_reference_id' => $customer->id, 'reference_id' => $card->creditCard->token ]; }