/** * credit a customer for the passed transaction * * @access public * @param int $customerId * @param array $transactionAttribs * @return Result\Successful|Result\Error */ public function credit($customerId, $transactionAttribs) { $this->_validateId($customerId); return Transaction::credit(array_merge($transactionAttribs, ['customerId' => $customerId])); }
/** * create a credit on the card for the passed transaction * * @access public * @param array $attribs * @return Result\Successful|Result\Error */ public function credit($token, $transactionAttribs) { $this->_validateId($token); return Transaction::credit(array_merge($transactionAttribs, ['paymentMethodToken' => $token])); }
public function testCredit_withServiceFeeNotAllowed() { $result = Braintree\Transaction::credit(['amount' => '100.00', 'creditCard' => ['number' => '5105105105105100', 'expirationDate' => '05/12'], 'serviceFeeAmount' => '12.75']); $this->assertFalse($result->success); $errors = $result->errors->forKey('transaction')->onAttribute('base'); $this->assertEquals(Braintree\Error\Codes::TRANSACTION_SERVICE_FEE_IS_NOT_ALLOWED_ON_CREDITS, $errors[0]->code); }