/** * creates gateway instance from given options. * * @param array $options An array contains: * login * password * currency (optional) * * @return Gateway The gateway instance. */ public function __construct($options = array()) { Options::required('login, password', $options); if (isset($options['currency'])) { self::$default_currency = $options['currency']; } $this->options = new Options($options); }
/** * * @param array $options */ private function add_invoice($options) { Options::required('order_id', $options); $this->post .= "<order_id>{$options['order_id']}</order_id>"; if (isset($options['commcard_invoice'])) { $this->post .= "<commcard_invoice>{$options['commcard_invoice']}</commcard_invoice>"; } if (isset($options['commcard_tax_amount'])) { $this->post .= "<commcard_tax_amount>{$this->amount($options['commcard_tax_amount'])}</commcard_tax_amount>"; } if (isset($options['customer_id'])) { $this->post .= "<cust_id>{$this->amount($options['customer_id'])}</cust_id>"; } }
/** * * @param number $money * @param string $identification * @param array $options * * @return Response */ public function credit($money, $identification, $options = array()) { if (false == $this->use_tokenization) { Options::required('creditcard', $options); } $this->build_authorized_request('Return', $money, $identification, $options); return $this->commit('Return', $money); }
/** * {@inheritdoc} * Optional $options are: * - 'occurrences' Number of billing occurrences or payments for the * subscription. Default is 9999 for a no end date * (an ongoing subscription). */ public function recurring($money, CreditCard $creditcard, $options = array()) { $options = new Options($options); Options::required('frequency, period, start_date, billing_address', $options); Options::required('first_name, last_name', $options['billing_address']); if (null == $options->occurrences) { $options->occurrences = '9999'; } if (null == $options->trial_occurrences) { $options->trial_occurrences = 0; } $amount = $this->amount($money); $ref_id = $options['order_id']; $this->xml = "<refId>{$ref_id}</refId>"; $this->xml .= "<subscription>"; $this->arb_add_subscription($amount, $options); $this->arb_add_creditcard($creditcard); $this->arb_add_address($options['billing_address']); $this->xml .= "</subscription>"; return $this->recurring_commit('create'); }
public function recurring($money, $options = array()) { Options::required('start_date, period, frequency, token, description', $options); $this->post = array(); $params = array('METHOD' => 'CreateRecurringPaymentsProfile', 'PROFILESTARTDATE' => $options['start_date'], 'BILLINGPERIOD' => $options['period'], 'BILLINGFREQUENCY' => $options['frequency'], 'AMT' => $this->amount($money), 'TOKEN' => urlencode(trim($options['token'])), 'DESC' => $options['description']); $this->add_address($options); $this->post = array_merge($this->post, $params, $this->get_optional_params($options)); return $this->commit('CreateRecurringPaymentsProfile'); }
/** * 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); }
public function createCustomer(CreditCard $creditcard, $options) { $this->post = array(); Options::required('first_name, last_name, email, customer_id', $options); $options = new Options($options); $this->add_customer_data($options); $this->add_address($options); $this->add_recurring_creditcard($creditcard, true); $this->post['reference'] = $options->customer_id; return $this->commit('customers'); }