public function update($subscriptionId, $attributes) { Braintree_Util::verifyKeys(self::_updateSignature(), $attributes); $path = $this->_config->merchantPath() . '/subscriptions/' . $subscriptionId; $response = $this->_http->put($path, array('subscription' => $attributes)); return $this->_verifyGatewayResponse($response); }
public function conditionallyVerifyKeys($params) { if (array_key_exists("customerId", $params)) { Braintree_Util::verifyKeys($this->generateWithCustomerIdSignature(), $params); } else { Braintree_Util::verifyKeys($this->generateWithoutCustomerIdSignature(), $params); } }
function testVerifyKeys() { $signature = array('amount', 'customerId', 'orderId', 'paymentMethodToken', 'type', array('creditCard' => array('token', 'cvv', 'expirationDate', 'number')), array('customer' => array('id', 'company', 'email', 'fax', 'firstName', 'lastName', 'phone', 'website')), array('billing' => array('firstName', 'lastName', 'company', 'countryName', 'extendedAddress', 'locality', 'postalCode', 'region', 'streetAddress')), array('shipping' => array('firstName', 'lastName', 'company', 'countryName', 'extendedAddress', 'locality', 'postalCode', 'region', 'streetAddress')), array('options' => array('storeInVault', 'submitForSettlement', 'addBillingAddressToPaymentMethod')), array('customFields' => array('_anyKey_'))); // test valid $userKeys = array('amount' => '100.00', 'customFields' => array('HEY' => 'HO', 'WAY' => 'NO'), 'creditCard' => array('number' => '5105105105105100', 'expirationDate' => '05/12')); $n = Braintree_Util::verifyKeys($signature, $userKeys); $this->assertNull($n); $userKeys = array('amount' => '100.00', 'customFields' => array('HEY' => 'HO', 'WAY' => 'NO'), 'bogus' => 'FAKE', 'totallyFake' => 'boom', 'creditCard' => array('number' => '5105105105105100', 'expirationDate' => '05/12')); // test invalid $this->setExpectedException('InvalidArgumentException'); Braintree_Util::verifyKeys($signature, $userKeys); }
public function update($token, $attribs) { Braintree_Util::verifyKeys(self::updateSignature(), $attribs); return $this->_doUpdate('/payment_methods/any/' . $token, array('payment_method' => $attribs)); }
/** * @ignore * @access public * @param array $attribs * @return object */ private static function create($attribs) { Braintree_Util::verifyKeys(self::createSignature(), $attribs); return self::_doCreate('/transactions', array('transaction' => $attribs)); }
/** * updates the creditcard record * * if calling this method in static context, $token * is the 2nd attribute. $token is not sent in object context. * * @access public * @param array $attributes * @param string $token (optional) * @return object Braintree_Result_Successful or Braintree_Result_Error */ public static function update($token, $attributes) { Braintree_Util::verifyKeys(self::updateSignature(), $attributes); self::_validateId($token); return self::_doUpdate('put', '/payment_methods/' . $token, array('creditCard' => $attributes)); }
/** * updates the customer record * * if calling this method in static context, customerId * is the 2nd attribute. customerId is not sent in object context. * * @access public * @param array $attributes * @param string $customerId (optional) * @return object Braintree_Result_Successful or Braintree_Result_Error */ public function update($customerId, $attributes) { Braintree_Util::verifyKeys(self::updateSignature(), $attributes); $this->_validateId($customerId); return $this->_doUpdate('put', '/customers/' . $customerId, array('customer' => $attributes)); }
/** * 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); }
public static function update($merchant_account_id, $attributes) { Braintree_Util::verifyKeys(self::updateSignature(), $attributes); return self::_doUpdate('/merchant_accounts/' . $merchant_account_id . '/update_via_api', array('merchant_account' => $attributes)); }
/** * 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 update($subscriptionId, $attributes) { Braintree_Util::verifyKeys(self::_updateSignature(), $attributes); $response = Braintree_Http::put('/subscriptions/' . $subscriptionId, array('subscription' => $attributes)); return self::_verifyGatewayResponse($response); }
/** * Returns the trData string for updating a customer. * * The customerId of the customer to update is required. * * <code> * $trData = Braintree_TransparentRedirect::updateCustomerData(array( * 'redirectUrl' => 'http://example.com/redirect_here', * 'customerId' => 'customer123', * )); * </code> * * @param array $params * @return string */ public function updateCustomerData($params) { Braintree_Util::verifyKeys(self::$_updateCustomerSignature, $params); if (!isset($params['customerId'])) { throw new InvalidArgumentException('expected params to contain customerId of customer to update'); } $params["kind"] = Braintree_TransparentRedirect::UPDATE_CUSTOMER; return $this->_data($params); }
/** * updates the paypalAccount record * * if calling this method in context, $token * is the 2nd attribute. $token is not sent in object context. * * @access public * @param array $attributes * @param string $token (optional) * @return object Braintree_Result_Successful or Braintree_Result_Error */ public function update($token, $attributes) { Braintree_Util::verifyKeys(self::updateSignature(), $attributes); $this->_validateId($token); return $this->_doUpdate('put', '/payment_methods/paypal_account/' . $token, array('paypalAccount' => $attributes)); }
public static function create($attribs) { Braintree_Util::verifyKeys(self::createSignature(), $attribs); return self::_doCreate('/payment_methods', array('payment_method' => $attribs)); }
public static function create($attribs) { Braintree_Util::verifyKeys(self::createSignature(), $attribs); return self::_doCreate('/merchant_accounts/create_via_api', array('merchant_account' => $attribs)); }