function testCreate_withExistingBillingAddress()
 {
     $customer = Braintree_Customer::createNoValidate();
     $existingAddress = Braintree_Address::createNoValidate(array('customerId' => $customer->id, 'firstName' => 'John'));
     $result = Braintree_CreditCard::create(array('customerId' => $customer->id, 'number' => '5105105105105100', 'expirationDate' => '05/12', 'billingAddressId' => $existingAddress->id));
     $this->assertTrue($result->success);
     $address = $result->creditCard->billingAddress;
     $this->assertEquals($existingAddress->id, $address->id);
     $this->assertEquals('John', $address->firstName);
 }
Beispiel #2
0
 function testUpdateNoValidate()
 {
     $customer = Braintree_Customer::createNoValidate();
     $createdAddress = Braintree_Address::createNoValidate(array('customerId' => $customer->id, 'firstName' => 'Old First', 'lastName' => 'Old Last', 'company' => 'Old Company', 'streetAddress' => '1 E Old St', 'extendedAddress' => 'Apt Old', 'locality' => 'Old Chicago', 'region' => 'Old Region', 'postalCode' => 'Old Postal', 'countryName' => 'United States of America'));
     $address = Braintree_Address::updateNoValidate($customer->id, $createdAddress->id, array('firstName' => 'New First', 'lastName' => 'New Last', 'company' => 'New Company', 'streetAddress' => '1 E New St', 'extendedAddress' => 'Apt New', 'locality' => 'New Chicago', 'region' => 'New Region', 'postalCode' => 'New Postal', 'countryName' => 'Mexico'));
     $this->assertEquals('New First', $address->firstName);
     $this->assertEquals('New Last', $address->lastName);
     $this->assertEquals('New Company', $address->company);
     $this->assertEquals('1 E New St', $address->streetAddress);
     $this->assertEquals('Apt New', $address->extendedAddress);
     $this->assertEquals('New Chicago', $address->locality);
     $this->assertEquals('New Region', $address->region);
     $this->assertEquals('New Postal', $address->postalCode);
     $this->assertEquals('Mexico', $address->countryName);
 }