/** * updates the address record * * if calling this method in context, * customerOrId is the 2nd attribute, addressId 3rd. * customerOrId & addressId are not sent in object context. * * * @access public * @param array $attributes * @param mixed $customerOrId (only used in call) * @param string $addressId (only used in call) * @return object Braintree_Result_Successful or Braintree_Result_Error */ public function update($customerOrId, $addressId, $attributes) { $this->_validateId($addressId); $customerId = $this->_determineCustomerId($customerOrId); Braintree_Util::verifyKeys(self::updateSignature(), $attributes); $path = $this->_config->merchantPath() . '/customers/' . $customerId . '/addresses/' . $addressId; $response = $this->_http->put($path, array('address' => $attributes)); return $this->_verifyGatewayResponse($response); }
function testSearch_daysPastDue() { $creditCard = Braintree_SubscriptionTestHelper::createCreditCard(); $triallessPlan = Braintree_SubscriptionTestHelper::triallessPlan(); $subscription = Braintree_Subscription::create(array('paymentMethodToken' => $creditCard->token, 'planId' => $triallessPlan['id']))->subscription; Braintree_Http::put('/subscriptions/' . $subscription->id . '/make_past_due', array('daysPastDue' => 5)); $found = false; $collection = Braintree_Subscription::search(array(Braintree_SubscriptionSearch::daysPastDue()->between(2, 10))); foreach ($collection as $item) { $found = true; $this->assertTrue($item->daysPastDue <= 10); $this->assertTrue($item->daysPastDue >= 2); } $this->assertTrue($found); }
public static function cancelRelease($transactionId) { self::_validateId($transactionId); $response = Braintree_Http::put('/transactions/' . $transactionId . '/cancel_release', array()); return self::_verifyGatewayResponse($response); }
public static function escrow($transactionId) { $http = new Braintree_Http(Braintree_Configuration::$global); $path = Braintree_Configuration::$global->merchantPath() . '/transactions/' . $transactionId . '/escrow'; $http->put($path); }
public static function escrow($transactionId) { Braintree_Http::put('/transactions/' . $transactionId . '/escrow'); }
function test_rangeNode_settledAt() { $transaction = Braintree_Transaction::saleNoValidate(array('amount' => '1000.00', 'creditCard' => array('number' => '4111111111111111', 'expirationDate' => '05/12'), 'options' => array('submitForSettlement' => true))); Braintree_Http::put('/transactions/' . $transaction->id . '/settle'); $transaction = Braintree_Transaction::find($transaction->id); $twenty_min_ago = date_create("now -20 minutes", new DateTimeZone("UTC")); $ten_min_ago = date_create("now -10 minutes", new DateTimeZone("UTC")); $ten_min_from_now = date_create("now +10 minutes", new DateTimeZone("UTC")); $collection = Braintree_Transaction::search(array(Braintree_TransactionSearch::id()->is($transaction->id), Braintree_TransactionSearch::settledAt()->between($twenty_min_ago, $ten_min_ago))); $this->assertEquals(0, $collection->maximumCount()); $collection = Braintree_Transaction::search(array(Braintree_TransactionSearch::id()->is($transaction->id), Braintree_TransactionSearch::settledAt()->between($ten_min_ago, $ten_min_from_now))); $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($transaction->id, $collection->firstItem()->id); }
function testRetryCharge_WithAmount() { $subscription = Braintree_SubscriptionTestHelper::createSubscription(); Braintree_Http::put('/subscriptions/' . $subscription->id . '/make_past_due'); $result = Braintree_Subscription::retryCharge($subscription->id, 1000); $this->assertTrue($result->success); $transaction = $result->transaction; $this->assertEquals(1000, $transaction->amount); $this->assertNotNull($transaction->processorAuthorizationCode); $this->assertEquals(Braintree_Transaction::SALE, $transaction->type); $this->assertEquals(Braintree_Transaction::AUTHORIZED, $transaction->status); }
private static function _doUpdate($url, $params) { $response = Braintree_Http::put($url, $params); return self::_verifyGatewayResponse($response); }
/** * updates the address record * * if calling this method in static context, * customerOrId is the 2nd attribute, addressId 3rd. * customerOrId & addressId are not sent in object context. * * * @access public * @param array $attributes * @param mixed $customerOrId (only used in static call) * @param string $addressId (only used in static call) * @return object Braintree_Result_Successful or Braintree_Result_Error */ public static function update($customerOrId, $addressId, $attributes) { self::_validateId($addressId); $customerId = self::_determineCustomerId($customerOrId); Braintree_Util::verifyKeys(self::updateSignature(), $attributes); $response = Braintree_Http::put('/customers/' . $customerId . '/addresses/' . $addressId, array('address' => $attributes)); return self::_verifyGatewayResponse($response); }
public static function settle($transactionId) { Braintree_Http::put('/transactions/' . $transactionId . '/settle'); }
public static function cancel($subscriptionId) { $response = Braintree_Http::put('/subscriptions/' . $subscriptionId . '/cancel'); return self::_verifyGatewayResponse($response); }
public static function submitForSettlement($transactionId, $amount = null) { self::_validateId($transactionId); $response = Braintree_Http::put('/transactions/' . $transactionId . '/submit_for_settlement', array('transaction' => array('amount' => $amount))); return self::_verifyGatewayResponse($response); }
function testRetryCharge_WithAmount() { $subscription = Braintree_SubscriptionTestHelper::createSubscription(); $http = new Braintree_Http(Braintree_Configuration::$global); $path = Braintree_Configuration::$global->merchantPath() . '/subscriptions/' . $subscription->id . '/make_past_due'; $http->put($path); $result = Braintree_Subscription::retryCharge($subscription->id, 1000); $this->assertTrue($result->success); $transaction = $result->transaction; $this->assertEquals(1000, $transaction->amount); $this->assertNotNull($transaction->processorAuthorizationCode); $this->assertEquals(Braintree_Transaction::SALE, $transaction->type); $this->assertEquals(Braintree_Transaction::AUTHORIZED, $transaction->status); }