public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $client = new SoapClient(self::WSDL); $invoice = $payment->getInvoice(); $user = $invoice->getUser(); $data = array('paccount_id' => $this->getConfig('paccount_id'), 'type' => 'REFUND', 'transaction_ip' => $user->last_ip, 'amount_cnts' => 100 * $amount, 'client_reference' => $invoice->public_id, 'client_customer_id' => $user->pk(), 'affiliate_id' => 0, 'site_url' => $this->getDi()->config->get('site_url'), 'member_login' => $user->login, 'support_url' => $this->getDi()->config->get('site_url'), 'support_tel' => 'N/A', 'support_email' => $this->getDi()->config->get('admin_email'), 'customer_lang' => 'en', 'customer_useragent' => $user->last_user_agent, 'billing_invoicing_id' => 0, 'billing_description' => $invoice->getLineDescription(), 'billing_preauth_duration' => 0, 'billing_rebill_period' => 0, 'billing_rebill_duration' => 0, 'billing_rebill_price_cnts' => 100 * $invoice->second_total, 'billing_initial_transaction_id' => $payment->receipt_id); $param = array($this->getConfig('apiKey'), $user->data()->get(self::COMENPAY_CARD_TOKEN), $user->data()->get(self::COMENPAY_CARD_KEY), $data); $request = new SoapRequestWrapperComenpay($client, 'Transaction', $param); $t = new Am_Paysystem_Transaction_CreditCard_Comenpay_Transaction_Refund($this, $invoice, $request, $payment->receipt_id, $amount); $t->run($result); }
function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $this->invoice = $payment->getInvoice(); $params = array('key' => $this->getConfig('key'), 'ref' => $payment->receipt_id, 'uid' => $payment->user_id, 'type' => 1); $params['sign'] = $this->calculateSignature($params, $this->getConfig('secret')); $requst = new Am_HttpRequest(self::URL_TICKET, Am_HttpRequest::METHOD_POST); $requst->addPostParameter($params); $log = $this->logRequest($requst); $responce = $requst->send(); $log->add($responce); if ($responce->getStatus() != 200) { $result->setFailed('Incorrect HTTP response status: ' . $responce->getStatus()); return; } $res = Am_Controller::decodeJson($responce->getBody()); if ($res['result'] == 1) { $trans = new Am_Paysystem_Transaction_Manual($this); $trans->setAmount($amount); $trans->setReceiptId($payment->receipt_id); $result->setSuccess($trans); return; } $result->setFailed($res['errors']); }
function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $trans = new Am_Paysystem_Transaction_WepayOnsite_Checkout_Refund($this, $payment->getInvoice(), $payment->receipt_id, $amount); $trans->run($result); }
public function __construct(Am_Paysystem_Abstract $plugin, InvoicePayment $payment, $amount) { $this->plugin = $plugin; $this->user = $payment->getUser(); $this->invoice = $payment->getInvoice(); $this->request = new Am_HttpRequest(Am_Paysystem_PaymillDd::API_ENDPOINT . 'refunds/' . $payment->receipt_id, Am_HttpRequest::METHOD_POST); $this->request->setAuth($this->plugin->getConfig('private_key'), ''); $this->request->addPostParameter(array('amount' => ($amount ? $amount : $payment->amount) * 100)); }
function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $request = new Am_HttpRequest("https://" . $this->getConfig('login') . ":" . $this->getConfig('password') . "@payment.architrade.com/cgi-adm/refund.cgi"); $invoice = $payment->getInvoice(); $currency = $this->getCurrencyCode($invoice); $post_params = new stdclass(); $post_params->merchant = $this->getConfig('merchant'); $post_params->amount = $amount * 100; $count = $this->getDi()->db->selectCol("SELECT COUNT(*) FROM ?_invoice_payment\n WHERE invoice_id=?d AND dattm < ?\n ", $payment->invoice_id, $payment->dattm); $post_params->orderId = $invoice->public_id . "-" . sprintf("%03d", array_shift($count)); $post_params->transact = $invoice->data()->get(self::TICKET); $post_params->textreply = 'true'; $post_params->currency = $currency; $post_params->md5key = md5($s2 = $this->getConfig('key2') . md5($s1 = $this->getConfig('key1') . "merchant=" . $this->getConfig('merchant') . "&orderid=" . $invoice->public_id . "&transact=" . $invoice->data()->get(self::TICKET) . "&amount=" . $amount)); $request->addPostParameter((array) $post_params); $response = $request->send(); $response = $this->parseResponse($response->getBody()); if ($response['result'] === 0) { $trans = new Am_Paysystem_Transaction_Manual($this); $trans->setAmount($amount); $trans->setReceiptId($payment->receipt_id . '-dibs-refund'); $result->setSuccess($trans); } else { $result->setFailed(array('Error Processing Refund!')); } }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $dpsBillingId = $payment->getInvoice()->data()->get(self::DPS_BILLING_ID); if (!$dpsBillingId) { return $result->setFailed(array("No saved DPS_BILLING_ID for invoice")); } $transaction = new Am_Paysystem_Transaction_CreditCard_PaymentExpress_Refund($this, $payment->getInvoice(), $dpsBillingId, $amount); $transaction->run($result); }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $customerVaultId = $this->getDi()->userTable->load($payment->user_id)->data()->get(self::CUSTOMER_VAULT_ID); $tr = new Am_Paysystem_Paymentsystemsworldwide_Transaction_Refund($this, $payment->getInvoice(), $payment->receipt_id, $amount, $customerVaultId); $tr->run($result); }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $isVoid = $payment->amount == $amount; if ($isVoid) { $request = $this->createHttpRequest(); $request->addPostParameter('x_Type', 'VOID'); $request->addPostParameter('x_Trans_Id', $payment->transaction_id); $request = $this->_sendRequest($request); $transaction = new Am_Paysystem_Transaction_AuthorizeAim_Refund($this, $payment->getInvoice(), $request, $payment->transaction_id); $transaction->run($result); } if (!$isVoid || $result->isFailure()) { // Transaction is settled already, attempt to run CREDIT $ccRecord = $this->getDi()->getInstance()->CcRecordTable->findFirstBy(array('user_id' => $payment->getUser()->pk())); if (!$ccRecord) { $result->setFailed('User does not have cc record on file'); return; } $result->reset(); $cc = str_replace('*', '', $ccRecord->cc); $request = $this->createHttpRequest(); $request->addPostParameter('x_Type', 'CREDIT'); $request->addPostParameter('x_Trans_Id', $payment->transaction_id); $request->addPostParameter('x_card_num', $cc); $request->addPostParameter('x_Amount', $amount); $request = $this->_sendRequest($request); $transaction = new Am_Paysystem_Transaction_AuthorizeAim_Refund($this, $payment->getInvoice(), $request, $payment->transaction_id); $transaction->run($result); } }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $this->getTicketSession(); $transaction = new Am_Paysystem_Transaction_CreditCard_Intuit_Refund($this, $payment->getInvoice(), $amount); $transaction->run($result); }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $transaction = new Am_Paysystem_Transaction_CcDemo_Refund($this, $payment->getInvoice(), new Am_Request(array('receipt_id' => 'rr')), false); $transaction->setAmount($amount); $result->setSuccess($transaction); }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { if (!$this->getApi()) { throw new Am_Exception_Paysystem_NotConfigured("No 2Checkout API username/password configured - could not do refund"); } $log = $this->getDi()->invoiceLogRecord; $log->setInvoice($payment->getInvoice()); $return = $this->getApi()->refundInvoice($payment->receipt_id, 5, "Customer Request"); $log->add($return); if ($return['response_code'] == 'OK') { $result->setSuccess(); } else { $result->setFailed($return['response_message']); } }
function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $r = new Am_HttpRequest(self::URL, Am_HttpRequest::METHOD_POST); $r->addPostParameter('userkey', $this->getConfig('api_key')); $r->addPostParameter('type', self::REFUND); $r->addPostParameter('version', '2.6'); $r->addPostParameter('transid', $payment->transaction_id); $r->addPostParameter('merchantMID', $this->getPlugin()->getConfig('mid', 1)); $tr = new Am_Paysystem_Transaction_Altcharge_Refund($this, $payment->getInvoice(), $r, $doFirst, $payment->transaction_id); $tr->run($result); }
function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $trans = new Am_Paysystem_Transaction_AuthorizeCim_CreateCustomerProfileTransactionRefund($this, $payment->getInvoice(), $payment, $amount); $trans->run($result); }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $request = $this->_sendRequest($this->createHttpRequest()); $request->addPostParameter('x_Type', 'CREDIT'); $request->addPostParameter('x_Trans_Id', $this->getConfig('test_mode') ? 0 : $payment->transaction_id); $request->addPostParameter('x_Amount', $amount); $echeck = $this->loadEcheck($payment->getInvoice()); $request->addPostParameter('x_bank_acct_num', $echeck->echeck_ban); $request->addPostParameter('x_bank_aba_code', $echeck->echeck_aba); $request->addPostParameter('x_bank_acct_type', $echeck->echeck_type); $request->addPostParameter('x_bank_name', $echeck->check_bank_name); $request->addPostParameter('x_bank_acct_name', $echeck->echeck_account_name); $request->addPostParameter('x_echeck_type', $echeck->echeck_type == self::TYPE_BUSINESSCHECKING ? 'CCD' : 'PPD'); $transaction = new Am_Paysystem_Transaction_AuthorizeEcheck_Refund($this, $payment->getInvoice(), $request, $payment->transaction_id, $amount); $transaction->run($result); }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $customerVaultId = $this->getDi()->userTable->load($payment->user_id)->data()->get($this->getCustomerVaultVariable()); $tr = new Am_Paysystem_Networkmerchants_Transaction_Refund($this, $payment->getInvoice(), $payment->receipt_id, $amount, $customerVaultId); $tr->run($result); }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $transaction = new Am_Paysystem_Transaction_Ewayrapid3_Refund($this, $payment->getInvoice(), $payment->transaction_id, $amount); $transaction->run($result); }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $trans = new Am_Paysystem_Transaction_CreditCard_Braintree_Refund($this, $payment->getInvoice(), null, null, $payment); $trans->run($result); return $result; }
public function cancelInvoice(InvoicePayment $payment, Am_Paysystem_Result $result) { $log = $this->getDi()->invoiceLogRecord; $log->setInvoice($payment->getInvoice()); try { $cl = @new SoapClient("http://vas.mikro-odeme.com/services/MSubscriberManagementService.asmx?wsdl"); $res = $cl->DeactivateSubscriber(array('token' => array('UserCode' => $this->getConfig('user_code'), 'Pin' => $this->getConfig('pin')), 'subscriberId' => $payment->getInvoice()->data()->get('mo_subscriber'))); } catch (Exception $e) { throw new Am_Exception_InputError('Unable to contact payment server:' . $e->getMessage()); } if ($res->DeactivateSubscriberResult->StatusCode > 0) { throw new Am_Exception_InputError("Error in data format: " . $res->DeactivateSubscriberResult->ErrorMessage); } }
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount) { $tr = new Am_Paysystem_Transaction_Paymill_Refund($this, $payment->getInvoice(), $payment->receipt_id, $amount); $tr->run($result); }
function __construct(InvoicePayment $payment) { $this->invoice = $payment->getInvoice(); $this->payment = $payment; }