public function __construct(Am_Paysystem_Abstract $plugin) { $this->plugin = $plugin; parent::__construct($this->plugin->getConfig('testing') ? self::SANDBOX_URL : self::LIVE_URL, self::METHOD_POST); if ($adapter = $this->plugin->createHttpRequest()->getConfig('adapter')) { $this->setConfig('adapter', $adapter); } $this->addPostParameter('VERSION', '63.0')->addPostParameter('SIGNATURE', $this->plugin->getConfig('api_signature'))->addPostParameter('USER', $this->plugin->getConfig('api_username'))->addPostParameter('PWD', $this->plugin->getConfig('api_password')); }
function getConfig($key = null, $default = null) { switch ($key) { case 'auto_create': return true; default: return parent::getConfig($key, $default); } }
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); }
public function __construct(Am_Paysystem_Abstract $plugin, Invoice $invoice, $transactionId, $amount = null) { $this->transactionId = $transactionId; $this->amount = $amount > 0 ? $amount : null; $request = new Am_HttpRequest(Am_Paysystem_Paymill::API_ENDPOINT . 'refunds/' . $transactionId, 'POST'); $request->setAuth($plugin->getConfig('private_key'), ''); if ($this->amount > 0) { $request->addPostParameter('amount', sprintf('%.02f', $amount) * 100)->addPostParameter('description', 'Refund from aMember script. Username: '******', invoice: ' . $invoice->public_id); } parent::__construct($plugin, $invoice, $request, true); }
public function __construct(Am_Paysystem_Abstract $plugin, Invoice $invoice, $doFirst) { $request = new Am_HttpRequest($plugin->getConfig('testing') ? Am_Paysystem_Payflow::TEST_URL : Am_Paysystem_Payflow::LIVE_URL, Am_HttpRequest::METHOD_POST); parent::__construct($plugin, $invoice, $request, $doFirst); $this->addRequestParams(); }
public function __construct(Am_Paysystem_Abstract $plugin, Invoice $invoice, $charge_id, $amount = null) { $this->charge_id = $charge_id; $this->amount = $amount > 0 ? $amount : null; $request = new Am_HttpRequest('https://api.stripe.com/v1/charges/' . $this->charge_id . '/refund', 'POST'); $request->setAuth($plugin->getConfig('secret_key'), ''); if ($this->amount > 0) { $request->addPostParameter('amount', sprintf('%.2f', $this->amount) * 100); } parent::__construct($plugin, $invoice, $request, true); }
public function __construct(Am_Paysystem_Abstract $plugin, Invoice $invoice, $doFirst, $dpsBillingId) { $xmlOut = ''; $xmlOut .= '<Txn>'; $xmlOut .= '<PostUsername>' . $plugin->getConfig('PostUsername') . '</PostUsername>'; $xmlOut .= '<PostPassword>' . $plugin->getConfig('PostPassword') . '</PostPassword>'; $xmlOut .= '<Amount>' . $invoice->second_total . '</Amount>'; $xmlOut .= '<InputCurrency>' . $invoice->currency . '</InputCurrency>'; $xmlOut .= '<MerchantReference>' . $invoice->getLineDescription() . '</MerchantReference>'; $xmlOut .= '<TxnType>' . $this->txnType . '</TxnType>'; $xmlOut .= '<TxnId>' . $invoice->public_id . '</TxnId>'; $xmlOut .= '<BillingId></BillingId>'; $xmlOut .= '<DpsBillingId>' . $dpsBillingId . '</DpsBillingId>'; $xmlOut .= '</Txn>'; $request = new Am_HttpRequest_PaymentExpress($xmlOut, $this->requestType, (bool) $plugin->getConfig('debugMode')); $request->setUrl(Am_Paysystem_PaymentExpress::URL_RECURRING); parent::__construct($plugin, $invoice, $request, $doFirst); }
function createRecurringPaymentProfile(Invoice $invoice, CcRecord $cc = null, $token = null, $payerId = null) { if (!$cc && !$token) { throw new Am_Exception_Paysystem("Either [token] or [cc] must be specified for " . __METHOD__); } $periodConvert = array(Am_Period::DAY => 'Day', Am_Period::MONTH => 'Month', Am_Period::YEAR => 'Year'); $this->addPostParameter('METHOD', 'CreateRecurringPaymentsProfile'); if ($token) { $this->addPostParameter('TOKEN', $token); $this->addPostParameter('PAYERID', $payerId); } $this->addPostParameter('DESC', $invoice->getTerms()); $this->addPostParameter('PROFILESTARTDATE', gmdate('Y-m-d\\TH:i:s.00\\Z', strtotime($invoice->calculateRebillDate(1) . ' 00:00:01'))); $this->addPostParameter('PROFILEREFERENCE', $invoice->getRandomizedId('site')); //$this->addPostParameter('MAXFAILEDPAYMENTS', ''); //$this->addPostParameter('AUTOBILLOUTAMT', 'AddToNextBilling'); $p = new Am_Period($invoice->first_period); $pp = $periodConvert[$p->getUnit()]; if (!$pp) { throw new Am_Exception_Configuration("Could not find billing unit for invoice#{$invoice->invoice_id}.first_period: {$invoice->first_period}"); } /// first period - removed as handled with START_DATE //$this->addPostParameter('TRIALBILLINGPERIOD', $pp); //$this->addPostParameter('TRIALBILLINGFREQUENCY', $p->getCount()); //$this->addPostParameter('TRIALTOTALBILLINGCYCLES', '1'); //$this->addPostParameter('TRIALAMT', $invoice->second_total); // bill at the end of trial period // it may take up to 24hours to process it! so enabled only for credit card payments if ($cc && $invoice->first_total > 0) { $this->addPostParameter('INITAMT', $invoice->first_total); } // bill right now /// second period $p = new Am_Period($invoice->second_period); $pp = $periodConvert[$p->getUnit()]; if (!$pp) { throw new Am_Exception_Configuration("Could not find billing unit for invoice#{$invoice->invoice_id}.second_period: {$invoice->second_period}"); } $this->addPostParameter('BILLINGPERIOD', $pp); $this->addPostParameter('BILLINGFREQUENCY', $p->getCount()); if ($invoice->rebill_times != IProduct::RECURRING_REBILLS) { $this->addPostParameter('TOTALBILLINGCYCLES', $invoice->rebill_times); } $this->addPostParameter('AMT', $invoice->second_total - $invoice->second_tax); // bill at end of each payment period $this->addPostParameter('TAXAMT', $invoice->second_tax); $this->addPostParameter('CURRENCYCODE', $invoice->currency); // @todo $this->addPostParameter('NOTIFYURL', $this->plugin->getPluginUrl('ipn')); $i = 0; foreach ($invoice->getItems() as $item) { /* @var $item InvoiceItem */ $this->addPostParameter("L_PAYMENTREQUEST_0_NAME{$i}", $item->item_title); $this->addPostParameter("L_PAYMENTREQUEST_0_NUMBER{$i}", $item->item_id); $this->addPostParameter("L_PAYMENTREQUEST_0_QTY{$i}", $item->qty); $i++; } $this->addPostParameter('L_BILLINGTYPE0', 'RecurringPayments'); $this->addPostParameter('L_BILLINGAGREEMENTDESCRIPTION0', $invoice->getTerms()); if ($cc) { $this->setCC($invoice, $cc); } if ($this->plugin->getConfig('send_shipping')) { $this->setShippingAddress($invoice); } return $this; }