Skip to content
Browse files

add some dockblocks

  • Loading branch information...
1 parent 14a793a commit dfb12a79dae327f412f8cb9bc50cf8725b91116e @akDeveloper committed
View
74 lib/AktiveMerchant/Billing/Gateway.php
@@ -73,9 +73,7 @@
* @var string
*/
public static $display_name;
-
- private $debit_cards = array('switch', 'solo');
-
+
/**
* Request instance.
*
@@ -92,6 +90,8 @@
*/
protected $adapter;
+ private $debit_cards = array('switch', 'solo');
+
public function money_format()
{
$class = get_class($this);
@@ -138,6 +138,12 @@ public function supports($card_type)
return in_array($card_type, $this->supported_cardtypes());
}
+ /**
+ * Checks if gateway is in test mode.
+ *
+ * @access public
+ * @return boolean
+ */
public function isTest()
{
return Base::$gateway_mode == 'test';
@@ -167,17 +173,30 @@ public function amount($money)
protected function card_brand($source)
{
$result = isset($source->brand) ? $source->brand : $source->type;
+
return strtolower($result);
}
public function requires_start_date_or_issue_number(CreditCard $creditcard)
{
$card_band = $this->card_brand($creditcard);
- if (empty($card_band))
+
+ if (empty($card_band)) {
+
return false;
+ }
+
return in_array($this->card_brand($creditcard), $this->debit_cards);
}
+ /**
+ * Sets the request instance.
+ * Usefull for testing purposes.
+ *
+ * @param RequestInterface $request
+ * @access public
+ * @return void
+ */
public function setRequest(RequestInterface $request)
{
$this->request = $request;
@@ -199,7 +218,7 @@ public function getAdapter()
/**
* Sets a custom adapter to perform the request.
- * Adapter must implements AdaperInterface.
+ * Adapter must implements AdapterInterface.
*
* @param AdapterInterface $adapter
* @access public
@@ -269,13 +288,27 @@ private function ssl_request($method, $endpoint, $data, $options = array())
}
- // Utils
+ /* -( Utils ) -------------------------------------------------------- */
+ /**
+ * Returns a unique identifier.
+ *
+ * @access public
+ * @since Method available since Release 1.0.0
+ * @return string
+ */
public function generateUniqueId()
{
return substr(uniqid(rand(), true), 0, 10);
}
+ /**
+ * Returns a unique identifier.
+ *
+ * @access public
+ * @deprecated Method deprecated in Release 1.0.0
+ * @return string
+ */
public function generate_unique_id()
{
trigger_error('generate_unique_id method is deprecated. Use generateUniqueId');
@@ -299,18 +332,34 @@ protected function urlize($params)
return rtrim($string, "& ");
}
+ /**
+ * required_options
+ *
+ * @param string comma seperated parameters. Represent keys of $options array
+ * @param array the key/value hash of options to compare with
+ * @access protected
+ * @return boolean
+ */
protected function required_options($required, $options = array())
{
return Options::required($required, $options);
}
/**
- * CreditCardFormatting
+ * Formats values from a credit card.
+ *
+ * Used to format mont or year values to 2 or 4 digit numbers.
+ *
+ * @param integer $number The number to format
+ * @param string $options 'two_digits' or 'four_digits'
+ * @access protected
+ * @return void
*/
protected function cc_format($number, $options)
{
- if (empty($number))
+ if (empty($number)) {
return '';
+ }
switch ($options) {
case 'two_digits':
@@ -327,9 +376,12 @@ protected function cc_format($number, $options)
}
/**
- * Numeric Currency Codes
- *
- * Return numeric represantation of ISO 4217 currency code.
+ * Lookup for numeric currency codes and returns numeric represantation
+ * of ISO 4217 currency code.
+ *
+ * @param string $code
+ * @access protected
+ * @return string|false
*/
protected function currency_lookup($code)
{
View
4 lib/AktiveMerchant/Billing/Gateways/CentinelPaypal.php
@@ -16,4 +16,6 @@
class CentinelPaypal extends Centinel
{
const LIVE_URL = 'https://paypal.cardinalcommerce.com/maps/txns.asp';
-}
+
+ public static $display_name = 'Centinel 3D Secure for Paypal';
+}
View
15 lib/AktiveMerchant/Billing/Interfaces/Charge.php
@@ -10,7 +10,7 @@
* Interface for a merchant gateway that supports authorize, purchase, and capture.
*
* @package Aktive-Merchant
- * @author Andreas Kollaros
+ * @author Andreas Kollaros
* @license MIT {@link http://opensource.org/licenses/mit-license.php}
*/
interface Charge
@@ -20,7 +20,7 @@
*
* The authorization can be charged with the {@link capture()} method.
*
- * @param float $money Amount of money to authorize
+ * @param number $money Amount of money to authorize
* @param \AktiveMerchant\Billing\CreditCard $creditcard Credit card to authorize
* @param array $options Additional options to the driver. Common options include:
* <ul>
@@ -42,21 +42,20 @@
* <li>ip - IP address of customer
* </ul>
* @access public
- * @return \AktiveMerchant\Billing\Response Response object
* @throws \AktiveMerchant\Billing\Exception If the request fails
- * @package Aktive-Merchant
+ * @return \AktiveMerchant\Billing\Response Response object
*/
public function authorize($money, CreditCard $creditcard, $options = array());
/**
* Charge a credit card.
*
- * @param float $money Amount of money to charge
+ * @param number $money Amount of money to charge
* @param \AktiveMerchant\Billing\CreditCard $creditcard Credit card to charge
* @param array $options Additional options to the driver. For details see {@link authorize()}.
* @access public
- * @return \AktiveMerchant\Billing\Response Response object
* @throws \AktiveMerchant\Billing\Exception If the request fails
+ * @return \AktiveMerchant\Billing\Response Response object
*/
public function purchase($money, CreditCard $creditcard, $options = array());
@@ -65,12 +64,12 @@ public function purchase($money, CreditCard $creditcard, $options = array());
*
* Charges a card after a prior authorization by {@link authorize()}.
*
- * @param float $money Amount of money to charge
+ * @param number $money Amount of money to charge
* @param string $authorization Authorization transaction ID (from {@link \AktiveMerchant\Billing\Response::authorization()})
* @param array $options Additional options to the driver. For details see {@link authorize()}.
* @access public
- * @return \AktiveMerchant\Billing\Response Response object
* @throws \AktiveMerchant\Billing\Exception If the request fails
+ * @return \AktiveMerchant\Billing\Response Response object
*/
public function capture($money, $authorization, $options = array());
}
View
21 lib/AktiveMerchant/Billing/Interfaces/Credit.php
@@ -8,7 +8,7 @@
* Interface for a merchant gateway that supports credit and void.
*
* @package Aktive-Merchant
- * @author Andreas Kollaros
+ * @author Andreas Kollaros
* @license MIT {@link http://opensource.org/licenses/mit-license.php}
*/
interface Credit
@@ -16,22 +16,27 @@
/**
* Credit a charge back to an account.
*
- * @param float $money Amount of money to charge
- * @param string $identification Authorization transaction ID (from {@link \AktiveMerchant\Billing\Response::authorization()})
- * @param array $options Additional options to the driver. For details see {@link authorize()}.
+ * @param number $money Amount of money to charge
+ * @param string $identification Authorization transaction ID
+ * (from {@link \AktiveMerchant\Billing\Response::authorization()})
+ * @param array $options Additional options to the driver.
+ * For details see {@link \AktiveMerchant\Billing\Interfaces\Charge::authorize()}.
* @access public
- * @return \AktiveMerchant\Billing\Response Response object
* @throws \AktiveMerchant\Billing\Exception If the request fails
+ * @return \AktiveMerchant\Billing\Response Response object
*/
public function credit($money, $identification, $options = array());
/**
* Void an earlier transaction that has not yet been settled.
*
- * @param string $authorization Authorization transaction ID (from {@link \AktiveMerchant\Billing\Response::authorization()})
- * @param array $options Additional options to the driver. For details see {@link authorize()}.
+ * @param string $authorization Authorization transaction ID
+ * (from {@link \AktiveMerchant\Billing\Response::authorization()})
+ * @param array $options Additional options to the driver. For details
+ * see {@link \AktiveMerchant\Billing\Interfaces\Charge::authorize()}.
* @access public
- * @return \AktiveMerchant\Billing\Response Response object
+ * @throws \AktiveMerchant\Billing\Exception If the request fails
+ * @return \AktiveMerchant\Billing\Response Response object
*/
public function void($authorization, $options = array());
}
View
4 lib/AktiveMerchant/Common/Options.php
@@ -115,10 +115,12 @@ public function offsetGet($offset)
/**
* Checks if keys in $required parameter exist in the given $options array.
*
- * @throws AktiveMerchant\Billing\Exception If a required parameter is missing
+ * @throws \InvalidArgumentException If a required parameter is missing
*
* @param string comma seperated parameters. Represent keys of $options array
* @param array the key/value hash of options to compare with
+ *
+ * @return boolean
*/
public static function required($required, $options = array())
{
View
78 template/Example.php
@@ -27,24 +27,17 @@ class Example extends Gateway implements
const LIVE_URL = 'https://example.com/live';
/**
- * Money format supported by this gateway.
- * Can be 'dollars' or 'cents'
- *
- * @var string Money format 'dollars' | 'cents'
+ * {@inheritdoc}
*/
public static $money_format = 'dollars';
/**
- * The countries supported by the gateway as 2 digit ISO country codes.
- *
- * @var array
+ * {@inheritdoc}
*/
- public static $supported_countries = array('US', 'GR');
+ public static $supported_countries = array();
/**
- * The card types supported by the payment gateway
- *
- * @var array
+ * {@inheritdoc}
*/
public static $supported_cardtypes = array(
'visa',
@@ -56,23 +49,17 @@ class Example extends Gateway implements
);
/**
- * The homepage URL of the gateway
- *
- * @var string
+ * {@inheritdoc}
*/
public static $homepage_url = 'http://www.example.net';
/**
- * The display name of the gateway
- *
- * @var string
+ * {@inheritdoc}
*/
public static $display_name = 'New Gateway';
/**
- * The currency supported by the gateway as ISO 4217 currency code.
- *
- * @var string The ISO 4217 currency code
+ * {@inheritdoc}
*/
public static $default_currency = 'USD';
@@ -84,7 +71,7 @@ class Example extends Gateway implements
private $options;
/**
- *
+ * Contains the main body of the request.
*
* @var array
*/
@@ -109,16 +96,7 @@ public function __construct($options = array())
}
/**
- * Binds the given amount to customer creditcard
- *
- * creditcard is not charged yet. a capture action required for charging the
- * creditcard.
- *
- * @param number $money
- * @param CreditCard $creditcard
- * @param array $options
- *
- * @return Response
+ * {@inheritdoc}
*/
public function authorize($money, CreditCard $creditcard, $options=array())
{
@@ -131,12 +109,7 @@ public function authorize($money, CreditCard $creditcard, $options=array())
}
/**
- *
- * @param number $money
- * @param CreditCard $creditcard
- * @param array $options
- *
- * @return Response
+ * {@inheritdoc}
*/
public function purchase($money, CreditCard $creditcard, $options=array())
{
@@ -149,12 +122,7 @@ public function purchase($money, CreditCard $creditcard, $options=array())
}
/**
- *
- * @param number $money
- * @param string $authorization (unique value received from authorize action)
- * @param array $options
- *
- * @return Response
+ * {@inheritdoc}
*/
public function capture($money, $authorization, $options = array())
{
@@ -165,11 +133,7 @@ public function capture($money, $authorization, $options = array())
}
/**
- *
- * @param string $authorization
- * @param array $options
- *
- * @return Response
+ * {@inheritdoc}
*/
public function void($authorization, $options = array())
{
@@ -210,15 +174,15 @@ private function add_customer_data($options)
*
* Each of these keys must have an address array like:
* <code>
- * $address['name']
- * $address['company']
- * $address['address1']
- * $address['address2']
- * $address['city']
- * $address['state']
- * $address['country']
- * $address['zip']
- * $address['phone']
+ * $address['name']
+ * $address['company']
+ * $address['address1']
+ * $address['address2']
+ * $address['city']
+ * $address['state']
+ * $address['country']
+ * $address['zip']
+ * $address['phone']
* </code>
* common pattern for address is
* <code>

0 comments on commit dfb12a7

Please sign in to comment.
Something went wrong with that request. Please try again.