本文整理匯總了PHP中Am_Paysystem_Abstract類的典型用法代碼示例。如果您正苦於以下問題:PHP Am_Paysystem_Abstract類的具體用法?PHP Am_Paysystem_Abstract怎麽用?PHP Am_Paysystem_Abstract使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Am_Paysystem_Abstract類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createInvoices
/**
*
* @param User
* @param Am_Paysystem_Abstract $payplugin
* @param array $product_ids array of product_id to use for generation
* @param int $invCnt count of invoices per user
* @param int $invVar variation of count of invoices per user
* @param int $prdCnt count of products per invoice
* @param int $prdVar variation of products per invoice
*/
public function createInvoices($user, $payplugin, $product_ids, $invCnt, $invVar, $prdCnt, $prdVar)
{
$invoiceLimit = $this->getLimit($invCnt, $invVar);
for ($j = 1; $j <= $invoiceLimit; $j++) {
//subscribe user for some subscriptions
$invoice = $this->getDi()->invoiceTable->createRecord();
$productLimit = $this->getLimit($prdCnt, $prdVar);
for ($k = 1; $k <= $productLimit; $k++) {
$invoice->add(Am_Di::getInstance()->productTable->load(array_rand($product_ids)), 1);
}
$invoice->setUser($user);
$invoice->setPaysystem($payplugin->getId());
$invoice->calculate();
$invoice->save();
$transaction = new Am_Paysystem_Transaction_Manual($payplugin);
$transaction->setAmount($invoice->first_total)->setInvoice($invoice)->setTime(new DateTime('-' . rand(0, 200) . ' days'))->setReceiptId('demo-' . uniqid() . microtime(true));
$invoice->addPayment($transaction);
// $cc = $this->createCcRecord($user);
//
// Am_Paysystem_Transaction_CcDemo::_setTime(new DateTime('-'.rand(0,200).' days'));
// $payplugin->doBill($invoice, true, $cc);
$transaction = null;
unset($transaction);
$invoice = null;
unset($invoice);
}
}
示例2: __construct
public function __construct(Am_Paysystem_Abstract $plugin, Am_Request $request, Zend_Controller_Response_Http $response, $invokeArgs)
{
$DR = preg_replace("/\\s/", "+", $request->get('DR', $_GET['DR']));
$rc4 = new Crypt_RC4($plugin->getConfig('secret', 'ebskey'));
$QueryString = base64_decode($DR);
$rc4->decrypt($QueryString);
$QueryString = split('&', $QueryString);
foreach ($QueryString as $param) {
$param = split('=', $param);
$request->setParam($param[0], $param[1]);
}
parent::__construct($plugin, $request, $request, $invokeArgs);
}
示例3: createInvoices
/**
*
* @param User
* @param Am_Paysystem_Abstract $payplugin
* @param array $product_ids array of product_id to use for generation
* @param int $invCnt count of invoices per user
* @param int $invVar variation of count of invoices per user
* @param int $prdCnt count of products per invoice
* @param int $prdVar variation of products per invoice
* @param int $start timestamp period begin
* @param int $end timestamp period end
*/
public function createInvoices($user, $payplugin, $product_ids, $invCnt, $invVar, $prdCnt, $prdVar, $start, $end, $coupons = array())
{
$invoiceLimit = $this->getLimit($invCnt, $invVar);
for ($j = 1; $j <= $invoiceLimit; $j++) {
$tm = mt_rand($start, $end);
/* @var $invoice Invoice */
$invoice = $this->getDi()->invoiceTable->createRecord();
$productLimit = max(1, $this->getLimit($prdCnt, $prdVar));
for ($k = 1; $k <= $productLimit; $k++) {
try {
$product = Am_Di::getInstance()->productTable->load(array_rand($product_ids));
if (!($err = $invoice->isProductCompatible($product))) {
$invoice->add($product, 1);
}
} catch (Am_Exception_InputError $e) {
}
}
if (!count($invoice->getItems())) {
continue;
}
if (count($coupons) && rand(1, 5) == 5) {
$invoice->setCouponCode($coupons[array_rand($coupons)]);
$invoice->validateCoupon();
}
$invoice->tm_added = sqlTime($tm);
$invoice->setUser($user);
$invoice->calculate();
$invoice->setPaysystem($payplugin->getId());
$invoice->save();
$this->getDi()->setService('dateTime', new DateTime('@' . $tm));
if ($invoice->isZero()) {
$tr = new Am_Paysystem_Transaction_Free($this->getDi()->plugins_payment->loadGet('free'));
$tr->setInvoice($invoice)->setTime(new DateTime('@' . $tm))->process();
} else {
$tr = new Am_Paysystem_Transaction_Manual($payplugin);
$tr->setAmount($invoice->first_total)->setInvoice($invoice)->setTime(new DateTime('@' . $tm))->setReceiptId('demo-' . substr(sprintf('%.4f', microtime(true)), -7))->process();
//recurring payments
$i = 1;
while ((double) $invoice->second_total && $invoice->rebill_date < sqlDate($end) && $invoice->rebill_times >= $i && !$invoice->isCancelled()) {
$this->getDi()->setService('dateTime', new DateTime('@' . amstrtotime($invoice->rebill_date)));
$tr = new Am_Paysystem_Transaction_Manual($payplugin);
$tr->setAmount($invoice->second_total)->setInvoice($invoice)->setTime(new DateTime('@' . amstrtotime($invoice->rebill_date)))->setReceiptId('demo-rebill-' . $i++ . '-' . substr(sprintf('%.4f', microtime(true)), -7))->process();
if (rand(1, 5) == 5) {
//20% probability
$invoice->setCancelled(true);
}
}
// $cc = $this->createCcRecord($user);
//
// Am_Paysystem_Transaction_CcDemo::_setTime(new DateTime('-'.rand(0,200).' days'));
// $payplugin->doBill($invoice, true, $cc);
}
$tr = null;
unset($tr);
$invoice = null;
unset($invoice);
}
}
示例4: isNotAcceptableForInvoice
public function isNotAcceptableForInvoice(Invoice $invoice)
{
if ($invoice->rebill_times) {
return "Interkassa cannot handle products with recurring payment plan";
}
return parent::isNotAcceptableForInvoice($invoice);
}
示例5: isNotAcceptableForInvoice
public function isNotAcceptableForInvoice(Invoice $invoice)
{
if ($invoice->rebill_times && $invoice->first_period != $invoice->second_period) {
return "WorldPay cannot handle products with different first and second period";
}
return parent::isNotAcceptableForInvoice($invoice);
}
示例6: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
list($action, $status, $id) = explode("-", $request->getActionName());
if ($action != 'status') {
if ($action != 'ipn' && $action != 'thanks' || $request->get('transaction_status') == 'SETTLED') {
parent::directAction($request, $response, $invokeArgs);
}
return;
}
if (!in_array($status, array('return', 'ok', 'fail'))) {
throw new Am_Exception_InternalError("Bad status-request {$status}");
}
if (!$id) {
throw new Am_Exception_InternalError("Invoice ID is absent");
}
if (!($this->invoice = $this->getDi()->invoiceTable->findFirstByPublicId($id))) {
throw new Am_Exception_InternalError("Invoice not found by id [{$id}]");
}
switch ($status) {
case 'return':
$url = $request->get('transactionStatus') == 'REJECTED' ? $this->getCancelUrl() : $this->getReturnUrl();
break;
case 'ok':
$url = $this->getReturnUrl();
break;
case 'fail':
$url = $this->getCancelUrl();
break;
}
$response->setRedirect($url);
}
示例7: init
function init()
{
parent::init();
$this->getDi()->productTable->customFields()->add(new Am_CustomFieldText('web_id', '2000Charge.com website ID'));
$this->getDi()->productTable->customFields()->add(new Am_CustomFieldText(self::PRICEPOINT, 'Mapping code given by 2000Charge'));
$this->getDi()->productTable->customFields()->add(new Am_CustomFieldSelect('payment_option', 'Payment Option', 'Display Only Specified Payment Options', null, array('options' => $this->payment_options)));
}
示例8: directAction
function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ($request->getActionName() == 'ipn') {
echo 'OK';
}
return parent::directAction($request, $response, $invokeArgs);
}
示例9: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ($request->getFiltered('INVNUM', $request->getFiltered('INVOICE')) == '') {
$response->setRedirect($this->getRootUrl() . '/thanks');
} else {
parent::directAction($request, $response, $invokeArgs);
}
}
示例10: init
function init()
{
parent::init();
$opt = array('' => 'Using plugin settings');
if ($this->isConfigured()) {
Am_Di::getInstance()->productTable->customFields()->add(new Am_CustomFieldSelect('bitpay_speed_risk', 'Bitpay speed/risk', null, null, array('options' => $opt + $this->transactionSpeedOptions)));
}
}
示例11: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ($request->getActionName() == 'thanks') {
return $this->thanksAction($request, $response, $invokeArgs);
} else {
return parent::directAction($request, $response, $invokeArgs);
}
}
示例12: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
try {
parent::directAction($request, $response, $invokeArgs);
} catch (Am_Exception_Paysystem_TransactionInvalid $ex) {
//nothing
}
echo 'ok';
}
示例13: directAction
function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
try {
parent::directAction($request, $response, $invokeArgs);
} catch (Exception $e) {
$this->getDi()->errorLogTable->logException($e);
}
echo "<!--success-->";
}
示例14: _initSetupForm
public function _initSetupForm(Am_Form_Setup $form)
{
$form->addText('vendor_name')->setLabel(array('Client ID', 'Your Client ID will be supplied when your service is activated.
It will be in the format “ABC01”, where ABC is your organisation’s
unique three letter code.
It is used for logging into the NAB Transact administration, reporting and search tool.'));
$form->addAdvCheckbox('testing')->setLabel('Test Mode');
parent::_initSetupForm($form);
}
示例15: getConfig
function getConfig($key = null, $default = null)
{
switch ($key) {
case 'auto_create':
return true;
default:
return parent::getConfig($key, $default);
}
}