示例#1
0
 /**
  * Authorize.net SIM integration.
  * Requires to setup ONLY "Silent Post URL" at mechants account
  * 
  * @param Payment_Invoice $invoice
  * @return array
  */
 public function singlePayment(Payment_Invoice $invoice)
 {
     $b = $invoice->getBuyer();
     $fp_sequence = uniqid();
     $fp_timestamp = time();
     $finger = $this->_getFingerprint($invoice->getTotalWithTax(), $invoice->getCurrency(), $fp_sequence, $fp_timestamp);
     $params = array('x_fp_hash' => $finger, 'x_fp_sequence' => $fp_sequence, 'x_fp_timestamp' => $fp_timestamp, 'x_login' => $this->getParam('apiLoginId'), 'x_version' => '3.1', 'x_show_form' => 'PAYMENT_FORM', 'x_method' => 'CC', 'x_amount' => $invoice->getTotalWithTax(), 'x_currency_code' => $invoice->getCurrency(), 'x_invoice_id' => $invoice->getId(), 'x_invoice_num' => $invoice->getNumber(), 'x_test_request' => $this->testMode ? 'TRUE' : 'FALSE', 'x_address' => $b->getAddress(), 'x_city' => $b->getCity(), 'x_country' => $b->getCountry(), 'x_email' => $b->getEmail(), 'x_first_name' => $b->getFirstName(), 'x_last_name' => $b->getLastName(), 'x_phone' => $b->getPhone(), 'x_company' => $b->getCompany(), 'x_state' => $b->getState(), 'x_zip' => $b->getZip(), 'x_delim_data' => 'FALSE', 'x_relay_response' => 'FALSE', 'x_receipt_link_method' => 'GET', 'x_receipt_link_text' => 'Go back merchant', 'x_receipt_link_url' => $this->getParam('return_url'));
     return $params;
 }
示例#2
0
 public function ipn($data, Payment_Invoice $invoice)
 {
     $tx = new Payment_Transaction();
     $tx->setAmount($invoice->getTotal());
     $tx->setCurrency($invoice->getCurrency());
     $tx->setId(md5(uniqid($invoice->getNumber())));
     $tx->setIsValid(true);
     $tx->setStatus(Payment_Transaction::STATUS_COMPLETE);
     $tx->setType(Payment_Transaction::TXTYPE_PAYMENT);
     return $tx;
 }
 /**
  * @see http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Tag_Reference.html
  */
 public function singlePayment(Payment_Invoice $invoice)
 {
     //replace in text nodes
     $what = array('&', '<', '>');
     $to = array('&#x26;', '&#x3c;', '&#x3e;');
     $xml = new DOMDocument('1.0', 'UTF-8');
     $root = $xml->createElement('checkout-shopping-cart');
     $root->setAttribute('xmlns', 'http://checkout.google.com/schema/2');
     $xml->appendChild($root);
     $shoppingCart = $xml->createElement('shopping-cart');
     $root->appendChild($shoppingCart);
     $items = $xml->createElement('items');
     $shoppingCart->appendChild($items);
     foreach ($invoice->getItems() as $i) {
         $item = $xml->createElement('item');
         $itemName = $xml->createElement('item-name', str_replace($what, $to, $i->getTitle()));
         $itemDescription = $xml->createElement('item-description', str_replace($what, $to, $i->getDescription()));
         $unitPrice = $xml->createElement('unit-price', $i->getPrice());
         $unitPrice->setAttribute('currency', $invoice->getCurrency());
         $quantity = $xml->createElement('quantity', $i->getQuantity());
         $digitalContent = $xml->createElement('digital-content');
         $description = $xml->createElement('description', str_replace($what, $to, '<a href="' . $this->getParam('return_url') . '">Click here to return to site</a>'));
         $digitalContent->appendChild($description);
         $item->appendChild($itemName);
         $item->appendChild($itemDescription);
         $item->appendChild($unitPrice);
         $item->appendChild($quantity);
         $item->appendChild($digitalContent);
         $items->appendChild($item);
     }
     $checkoutFlowSupport = $xml->createElement('checkout-flow-support');
     $root->appendChild($checkoutFlowSupport);
     $merchantCheckoutSupport = $xml->createElement('merchant-checkout-flow-support');
     $checkoutFlowSupport->appendChild($merchantCheckoutSupport);
     $continueShoppingUrl = $xml->createElement('continue-shopping-url', str_replace($what, $to, $this->getParam('continue_shopping_url')));
     $merchantCheckoutSupport->appendChild($continueShoppingUrl);
     $merchantPrivateDdata = $xml->createElement('merchant-private-data');
     $shoppingCart->appendChild($merchantPrivateDdata);
     $invoiceId = $xml->createElement('invoice', $invoice->getNumber());
     $merchantPrivateDdata->appendChild($invoiceId);
     $str = $xml->saveXML();
     $response = $this->_makeRequest($str);
     if (isset($response->{'redirect-url'})) {
         return urldecode($response->{'redirect-url'});
     } else {
         throw new Payment_Exception('Connection to Google Checkout servers failed');
     }
     return false;
 }
示例#4
0
 public function singlePayment(Payment_Invoice $invoice)
 {
     $c = $invoice->getBuyer();
     $params = array('ap_merchant' => $this->getParam('email'), 'ap_purchasetype' => 'service', 'ap_currency' => $invoice->getCurrency(), 'ap_alerturl' => $this->getParam('notify_url'), 'ap_returnurl' => $this->getParam('return_url'), 'ap_cancelurl' => $this->getParam('cancel_url'), 'ap_fname' => $c->getFirstName(), 'ap_lname' => $c->getLastName(), 'ap_contactemail' => $c->getEmail(), 'ap_contactphone' => $c->getPhone(), 'ap_addressline1' => $c->getAddress(), 'ap_city' => $c->getCity(), 'ap_stateprovince' => $c->getState(), 'ap_zippostalcode' => $c->getZip(), 'ap_country' => $c->getCountry(), 'apc_1' => $invoice->getId(), 'apc_2' => $invoice->getNumber());
     $i = 1;
     foreach ($invoice->getItems() as $item) {
         $params['ap_itemcode_' . $i] = $item->getId();
         $params['ap_itemname_' . $i] = $item->getTitle();
         $params['ap_description_' . $i] = $item->getDescription();
         $params['ap_amount_' . $i] = $item->getPrice() + $item->getTax();
         $params['ap_quantity_' . $i] = $item->getQuantity();
         $i++;
     }
     return $params;
 }
 /**
  * Return form params
  * @see http://www.2checkout.com/community/blog/category/knowledge-base/tech-support/3rd-party-carts/parameter-sets
  * @param Payment_Invoice $invoice
  */
 public function singlePayment(Payment_Invoice $invoice)
 {
     $b = $invoice->getBuyer();
     $full_name = $b->getFirstName() . ' ' . $b->getLastName();
     //Used to specify an approved URL on-the-fly, but is limited to the same domain that is used for your 2Checkout account, otherwise it will fail. This parameter will over-ride any URL set on the Site Management page.
     $data['x_receipt_link_URL'] = $this->getParam('return_url');
     $data['return_url'] = $this->getParam('notify_url');
     $data['sid'] = $this->getParam('vendor_nr');
     $data['mode'] = '2CO';
     $data['total'] = $this->moneyFormat($invoice->getTotalWithTax());
     $data['fixed'] = 1;
     $data['lang'] = 'en';
     $data['skip_landing'] = 1;
     $data['id_type'] = 1;
     $data['merchant_order_id'] = $invoice->getId();
     // will be returned as vendor_order_id in IPN
     $data['card_holder_name'] = $full_name;
     $data['phone'] = $b->getPhone();
     $data['phone_extension'] = '';
     $data['email'] = $b->getEmail();
     $data['street_address'] = $b->getAddress();
     $data['city'] = $b->getCity();
     $data['state'] = $b->getState();
     $data['zip'] = $b->getZip();
     $data['country'] = $b->getCountry();
     $data['ship_name'] = $full_name;
     $data['ship_steet_address'] = $b->getAddress();
     $data['ship_city'] = $b->getCity();
     $data['ship_state'] = $b->getState();
     $data['ship_zip'] = $b->getZip();
     $data['ship_country'] = $b->getCountry();
     $data['cart_order_id'] = $invoice->getNumber();
     foreach ($invoice->getItems() as $i => $item) {
         $data['li_' . $i . '_type'] = 'product';
         $data['li_' . $i . '_tangible'] = 'N';
         $data['li_' . $i . '_product_id'] = $item->getId();
         $data['li_' . $i . '_name'] = $item->getTitle();
         $data['li_' . $i . '_quantity'] = $item->getQuantity();
         $data['li_' . $i . '_description'] = $item->getDescription();
         $data['li_' . $i . '_price'] = $item->getTotalWithTax();
     }
     if ($this->testMode) {
         $data['demo'] = 'Y';
     }
     return $data;
 }
示例#6
0
 private function _getHash(Payment_Invoice $invoice)
 {
     $shastring = $this->getParam('hashKey') . $this->getParam('merchantId') . $this->getParam('subId') . $invoice->getNumber() . 'ideal' . $this->_getValidUntil();
     $i = 1;
     foreach ($invoice->getItems() as $item) {
         $shastring .= $i . $item->getDescription() . $item->getQuantity() . (int) ($item->getPrice() * 100);
         $i++;
     }
     //Replace forbidden chars
     $shastring = str_replace(" ", "", $shastring);
     $shastring = str_replace("\t", "", $shastring);
     $shastring = str_replace("\n", "", $shastring);
     $shastring = str_replace("&amp;", "&", $shastring);
     $shastring = str_replace("&lt;", "<", $shastring);
     $shastring = str_replace("&gt;", "gt-teken", $shastring);
     $shastring = str_replace("&quot;", "\"", $shastring);
     return sha1($shastring);
 }
示例#7
0
 /**
  * Init single payment call to webservice
  * Invoice id is passed via notify_url
  *
  * @return string
  */
 public function singlePayment(Payment_Invoice $invoice)
 {
     $buyer = $invoice->getBuyer();
     return WebToPay::buildRequest(array('projectid' => $this->getParam('projectid'), 'sign_password' => $this->getParam('sign_password'), 'orderid' => $invoice->getNumber(), 'amount' => $this->moneyFormat($invoice->getTotalWithTax()), 'currency' => $invoice->getCurrency(), 'accepturl' => $this->getParam('return_url'), 'cancelurl' => $this->getParam('cancel_url'), 'callbackurl' => $this->getParam('notify_url'), 'paytext' => $invoice->getTitle(), 'p_firstname' => $buyer->getFirstName(), 'p_lastname' => $buyer->getLastName(), 'p_email' => $buyer->getEmail(), 'p_street' => $buyer->getAddress(), 'p_city' => $buyer->getCity(), 'p_state' => $buyer->getState(), 'p_zip' => $buyer->getZip(), 'p_countrycode' => $buyer->getCountry(), 'lang' => 'ENG', 'test' => $this->testMode));
 }
 public function singlePayment(Payment_Invoice $invoice)
 {
     $c = $invoice->getBuyer();
     $params = array('pay_to_email' => $this->getParam('email'), 'transaction_id' => $invoice->getNumber(), 'return_url' => $this->getParam('return_url'), 'cancel_url' => $this->getParam('cancel_url'), 'status_url' => $this->getParam('notify_url'), 'merchant_fields' => 'invoice_id', 'invoice_id' => $invoice->getNumber(), 'pay_from_email' => $c->getEmail(), 'firstname' => $c->getFirstname(), 'lastname' => $c->getLastname(), 'address' => $c->getAddress(), 'phone_number' => $c->getPhone(), 'postal_code' => $c->getZip(), 'city' => $c->getCity(), 'state' => $c->getState(), 'country' => $c->getCountry(), 'amount' => $invoice->getTotal(), 'currency' => $invoice->getCurrency());
     return $params;
 }
 /**
  * @see http://www.libertyreserve.com/en/help/sciguide
  * @param Payment_Invoice $invoice
  * @return array - list of parameters to be posted to serviceUrl via POST method
  */
 public function singlePayment(Payment_Invoice $invoice)
 {
     $params = array('lr_acc' => $this->getParam('accountNumber'), 'lr_amnt' => $invoice->getTotal(), 'lr_currency' => 'LR' . $invoice->getCurrency(), 'lr_merchant_ref' => $invoice->getNumber(), 'lr_success_url' => $this->getParam('return_url'), 'lr_success_url_method' => 'GET', 'lr_fail_url' => $this->getParam('cancel_url'), 'lr_fail_url_method' => 'GET', 'lr_status_url' => $this->getParam('notify_url'), 'lr_status_url_method' => 'POST', 'lr_comments' => $invoice->getTitle(), 'bb_invoice_id' => $invoice->getId());
     return $params;
 }