public function testCloneTransaction_RaisesErrorOnInvalidProperty() { $this->setExpectedException('InvalidArgumentException'); Braintree\Transaction::cloneTransaction('an id', ['amount' => '123.45', 'invalidProperty' => 'foo']); }
/** * Clone original transaction * @param string $transactionId * @param array $attributes * @return mixed */ public function cloneTransaction($transactionId, array $attributes) { return Transaction::cloneTransaction($transactionId, $attributes); }
public function testCloneWithValidations() { $result = Braintree\Transaction::credit(['amount' => '100.00', 'creditCard' => ['number' => '5105105105105100', 'expirationDate' => '05/2011']]); $this->assertTrue($result->success); $transaction = $result->transaction; $cloneResult = Braintree\Transaction::cloneTransaction($transaction->id, ['amount' => '123.45']); $this->assertFalse($cloneResult->success); $baseErrors = $cloneResult->errors->forKey('transaction')->onAttribute('base'); $this->assertEquals(Braintree\Error\Codes::TRANSACTION_CANNOT_CLONE_CREDIT, $baseErrors[0]->code); }