public static function generate($settlement_date, $groupByCustomField = NULL)
 {
     return Braintree_Configuration::gateway()->settlementBatchSummary()->generate($settlement_date, $groupByCustomField);
 }
Exemple #2
0
 public static function updateFromTransparentRedirect($queryString)
 {
     return Braintree_Configuration::gateway()->customer()->updateFromTransparentRedirect($queryString);
 }
Exemple #3
0
 public static function generateWithoutCustomerIdSignature()
 {
     return Braintree_Configuration::gateway()->clientToken()->generateWithoutCustomerIdSignature();
 }
 public static function create($token)
 {
     return Braintree_Configuration::gateway()->paymentMethodNonce()->create($token);
 }
 public static function update($merchant_account_id, $attributes)
 {
     return Braintree_Configuration::gateway()->merchantAccount()->update($merchant_account_id, $attributes);
 }
Exemple #6
0
 public static function cancel($subscriptionId)
 {
     return Braintree_Configuration::gateway()->subscription()->cancel($subscriptionId);
 }
 public static function parseAndValidateQueryString($queryString)
 {
     return Braintree_Configuration::gateway()->transparentRedirect()->parseAndValidateQueryString($queryString);
 }
 public static function find($nonce)
 {
     return Braintree_Configuration::gateway()->paymentMethodNonce()->find($nonce);
 }
Exemple #9
0
 public static function updateNoValidate($customerOrId, $addressId, $attributes)
 {
     return Braintree_Configuration::gateway()->address()->updateNoValidate($customerOrId, $addressId, $attributes);
 }
Exemple #10
0
 public static function delete($token)
 {
     return Braintree_Configuration::gateway()->creditCard()->delete($token);
 }
Exemple #11
0
 public static function all()
 {
     return Braintree_Configuration::gateway()->addOn()->all();
 }
 public static function delete($token)
 {
     return Braintree_Configuration::gateway()->paymentMethod()->delete($token);
 }
 public static function search($query)
 {
     return Braintree_Configuration::gateway()->creditCardVerification()->search($query);
 }
Exemple #14
0
 public static function sale($token, $transactionAttribs)
 {
     return Braintree_Configuration::gateway()->payPalAccount()->sale($token, $transactionAttribs);
 }
Exemple #15
0
 public static function refund($transactionId, $amount = null)
 {
     return Braintree_Configuration::gateway()->transaction()->refund($transactionId, $amount);
 }
 /**
  * Validate the credentials inputted into the admin area
  *
  * @param bool|false $prettyResponse
  * @param bool|false $alreadyInit
  * @param bool|false $merchantAccountId
  * @param bool|false $throwException
  *
  * @return bool|string
  * @throws \Exception
  */
 public function validateCredentials($prettyResponse = false, $alreadyInit = false, $merchantAccountId = false, $throwException = false)
 {
     // Try to init the environment
     try {
         if (!$alreadyInit) {
             // If we're within the admin we want to grab these values from whichever store we're modifying
             if (Mage::app()->getStore()->isAdmin()) {
                 Braintree_Configuration::environment($this->getAdminConfigValue(self::BRAINTREE_ENVIRONMENT_PATH));
                 Braintree_Configuration::merchantId($this->getAdminConfigValue(self::BRAINTREE_MERCHANT_ID_PATH));
                 Braintree_Configuration::publicKey($this->getAdminConfigValue(self::BRAINTREE_PUBLIC_KEY_PATH));
                 Braintree_Configuration::privateKey($this->getAdminConfigValue(self::BRAINTREE_PRIVATE_KEY_PATH));
             } else {
                 $this->init();
             }
         }
         // Attempt to retrieve the gateway plans to check
         Braintree_Configuration::gateway()->plan()->all();
     } catch (Exception $e) {
         // Do we want to rethrow the exception?
         if ($throwException) {
             throw $e;
         }
         // Otherwise give the user a little bit more information
         if ($prettyResponse) {
             return '<span style="color: red;font-weight: bold;" id="braintree-valid-config">' . Mage::helper('gene_braintree')->__('Invalid Credentials') . '</span><br />' . Mage::helper('gene_braintree')->__('Payments cannot be processed until this is resolved, due to this the methods will be hidden within the checkout');
         }
         // Otherwise return with a boolean
         return false;
     }
     // Check to see if we've been passed the merchant account ID?
     if (!$merchantAccountId) {
         if (Mage::app()->getStore()->isAdmin()) {
             $merchantAccountId = $this->getAdminConfigValue(self::BRAINTREE_MERCHANT_ACCOUNT_ID_PATH);
         } else {
             $merchantAccountId = $this->getMerchantAccountId();
         }
     }
     // Validate the merchant account ID
     try {
         Braintree_Configuration::gateway()->merchantAccount()->find($merchantAccountId);
     } catch (Exception $e) {
         // Do we want to rethrow the exception?
         if ($throwException) {
             throw $e;
         }
         // Otherwise do we want a pretty response?
         if ($prettyResponse) {
             return '<span style="color: orange;font-weight: bold;" id="braintree-valid-config">' . Mage::helper('gene_braintree')->__('Invalid Merchant Account ID') . '</span><br />' . Mage::helper('gene_braintree')->__('Payments cannot be processed until this is resolved. We cannot find your merchant account ID associated with the other credentials you\'ve provided, please update this field');
         }
         // Finally return a boolean
         return false;
     }
     if ($prettyResponse) {
         return '<span style="color: green;font-weight: bold;" id="braintree-valid-config">' . Mage::helper('gene_braintree')->__('Valid Credentials') . '</span><br />' . Mage::helper('gene_braintree')->__('You\'re ready to accept payments via Braintree');
     }
     return true;
 }
 /**
  * settlement pending a transaction by id in sandbox
  *
  * @param string $id transaction id
  * @param Braintree_Configuration $config gateway config
  * @return object Braintree_Transaction
  */
 public static function settlementPending($transactionId)
 {
     return Braintree_Configuration::gateway()->testing()->settlementPending($transactionId);
 }