diff --git a/.gitignore b/.gitignore index e643e22..cd89d59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -app/design/frontend/base/default/template/securesubmit.zip -app/design/frontend/base/default/template/securesubmit/hps-styles.css +app/design/frontend/base/default/template/transit.zip +app/design/frontend/base/default/template/transit/hps-styles.css diff --git a/README.md b/README.md index 701785e..ee6037c 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,29 @@ -## SecureSubmit Magento Payment Gateway +## TransIT Magento Payment Gateway -This extension allows Magento to use the Heartland Payment Systems Gateway. All card data is tokenized using Heartland's SecureSubmit product. +This extension allows Magento to use the Heartland Payment Systems Gateway. All card data is tokenized using Heartland's TransIT product. ## Installation -To pull the latest stable version of this plugin, please use MagentoConnect. To install the development version, download and extract the files in this repo to the root of your Magento install. +Example OpenMage LTS `composer.json`: + +```json +{ + "minimum-stability": "dev", + "prefer-stable": true, + "require": { + "aydin-hassan/magento-core-composer-installer": "*", + "openmage/magento-lts": "19.4.6", + "hps/hps_transit": "*" + }, + "extra": { + "magento-core-package-type": "magento-source", + "magento-root-dir": "htdocs" + } +} +``` ## Usage + Download the contents and extract to the root of your Magento install folder. ## Contributing @@ -15,4 +32,4 @@ Download the contents and extract to the root of your Magento install folder. 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request \ No newline at end of file +5. Create new Pull Request diff --git a/app/code/community/Hps/Securesubmit/Block/Masterpass/Client/Js.php b/app/code/community/Hps/Securesubmit/Block/Masterpass/Client/Js.php deleted file mode 100644 index 0909377..0000000 --- a/app/code/community/Hps/Securesubmit/Block/Masterpass/Client/Js.php +++ /dev/null @@ -1,14 +0,0 @@ -setTemplate('securesubmit/masterpass/js.phtml'); - } - - public function isSandbox() - { - return '1' === Mage::getStoreConfig('payment/hps_masterpass/use_sandbox'); - } -} diff --git a/app/code/community/Hps/Securesubmit/Block/Masterpass/Connect.php b/app/code/community/Hps/Securesubmit/Block/Masterpass/Connect.php deleted file mode 100644 index 7a257c5..0000000 --- a/app/code/community/Hps/Securesubmit/Block/Masterpass/Connect.php +++ /dev/null @@ -1,16 +0,0 @@ -getCustomerId(); - $customer = Mage::getModel('customer/customer')->load($customerId); - return $customer->getMasterpassLongAccessToken(); - } -} diff --git a/app/code/community/Hps/Securesubmit/Block/Masterpass/Form.php b/app/code/community/Hps/Securesubmit/Block/Masterpass/Form.php deleted file mode 100644 index e4ee356..0000000 --- a/app/code/community/Hps/Securesubmit/Block/Masterpass/Form.php +++ /dev/null @@ -1,81 +0,0 @@ -getBlockClassName('core/template'); - $mark = new $mark; - $mark->setTemplate('securesubmit/masterpass/mark.phtml') - ->setMarkHref('http://www.mastercard.com/mc_us/wallet/learnmore/en') - ->setMarkSrc('https://www.mastercard.com/mc_us/wallet/img/en/US/mp_mc_acc_030px_gif.gif') - ; // known issue: code above will render only static mark image - $this->setTemplate('securesubmit/masterpass/form.phtml') - ->setMethodTitle('') - ->setMethodLabelAfterHtml($mark->toHtml()) - ; - } - - public function getCards() - { - $customerId = Mage::getSingleton('customer/session')->getCustomerId(); - if (!$customerId) { - return false; - } - - $cards = $this->getSession()->getMasterPassCards(); - if ($cards) { - return $cards; - } - - $customer = Mage::getModel('customer/customer')->load($customerId); - $result = Mage::helper('hps_securesubmit/masterpass') - ->preApproval($customer->getMasterpassLongAccessToken()); - - if (!$result) { - return false; - } - - $cards = $result->preCheckoutData->Cards->Card; - $cards = $this->responseCardsToObject($cards); - $customer->unsMasterpassLongAccessToken() - ->setMasterpassLongAccessToken((string)$result->longAccessToken) - ->save(); - - $this->getSession()->setMasterPassCards($cards); - $this->getSession()->setMasterPassWalletName((string)$result->preCheckoutData->WalletName); - $this->getSession()->setMasterPassWalletId((string)$result->preCheckoutData->ConsumerWalletId); - $this->getSession()->setMasterPassPreCheckoutTransactionId((string)$result->preCheckoutTransactionId); - return $cards; - } - - protected function responseCardsToObject($resp) - { - $cards = array(); - foreach ($resp as $card) { - $cards[] = (object)array( - 'CardHolderName' => (string)$card->CardHolderName, - 'CardId' => (string)$card->CardId, - 'LastFour' => (string)$card->LastFour, - 'CardAlias' => (string)$card->CardAlias, - 'SelectedAsDefault' => (string)$card->SelectedAsDefault, - 'BrandName' => (string)$card->BrandName, - 'ExpiryMonth' => (string)$card->ExpiryMonth, - 'ExpiryYear' => (string)$card->ExpiryYear, - ); - } - return $cards; - } - - protected function getSession() - { - return Mage::getSingleton('hps_securesubmit/session'); - } -} diff --git a/app/code/community/Hps/Securesubmit/Block/Masterpass/Info.php b/app/code/community/Hps/Securesubmit/Block/Masterpass/Info.php deleted file mode 100644 index 0b3fcdf..0000000 --- a/app/code/community/Hps/Securesubmit/Block/Masterpass/Info.php +++ /dev/null @@ -1,22 +0,0 @@ -getInfo(); - - $data[Mage::helper("payment")->__("Payment Type")] = "MasterPass"; - //$data[Mage::helper('payment')->__('Email Address')] = print_r($info, true); - - return $transport->setData(array_merge($data, $transport->getData())); - } -} diff --git a/app/code/community/Hps/Securesubmit/Block/Masterpass/Review.php b/app/code/community/Hps/Securesubmit/Block/Masterpass/Review.php deleted file mode 100644 index bc7c1b0..0000000 --- a/app/code/community/Hps/Securesubmit/Block/Masterpass/Review.php +++ /dev/null @@ -1,218 +0,0 @@ -_quote = $quote; - return $this; - } - - /** - * Return quote billing address - * - * @return Mage_Sales_Model_Quote_Address - */ - public function getBillingAddress() - { - return $this->_quote->getBillingAddress(); - } - - /** - * Return quote shipping address - * - * @return Mage_Sales_Model_Quote_Address - */ - public function getShippingAddress() - { - if ($this->_quote->getIsVirtual()) { - return false; - } - return $this->_quote->getShippingAddress(); - } - - /** - * Get HTML output for specified address - * - * @param Mage_Sales_Model_Quote_Address - * @return string - */ - public function renderAddress($address) - { - return $address->getFormated(true); - } - - /** - * Return carrier name from config, base on carrier code - * - * @param $carrierCode string - * @return string - */ - public function getCarrierName($carrierCode) - { - if ($name = Mage::getStoreConfig("carriers/{$carrierCode}/title")) { - return $name; - } - return $carrierCode; - } - - /** - * Get either shipping rate code or empty value on error - * - * @param Varien_Object $rate - * @return string - */ - public function renderShippingRateValue(Varien_Object $rate) - { - if ($rate->getErrorMessage()) { - return ''; - } - return $rate->getCode(); - } - - /** - * Get shipping rate code title and its price or error message - * - * @param Varien_Object $rate - * @param string $format - * @param string $inclTaxFormat - * @return string - */ - public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)') - { - $renderedInclTax = ''; - if ($rate->getErrorMessage()) { - $price = $rate->getErrorMessage(); - } else { - $price = $this->_getShippingPrice($rate->getPrice(), - $this->helper('tax')->displayShippingPriceIncludingTax()); - - $incl = $this->_getShippingPrice($rate->getPrice(), true); - if (($incl != $price) && $this->helper('tax')->displayShippingBothPrices()) { - $renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl); - } - } - return sprintf($format, $this->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax); - } - - /** - * Getter for current shipping rate - * - * @return Mage_Sales_Model_Quote_Address_Rate - */ - public function getCurrentShippingRate() - { - return $this->_currentShippingRate; - } - - /** - * Set paypal actions prefix - */ - public function setPaypalActionPrefix($prefix) - { - $this->_paypalActionPrefix = $prefix; - } - - /** - * Return formatted shipping price - * - * @param float $price - * @param bool $isInclTax - * - * @return bool - */ - protected function _getShippingPrice($price, $isInclTax) - { - return $this->_formatPrice($this->helper('tax')->getShippingPrice($price, $isInclTax, $this->_address)); - } - - /** - * Format price base on store convert price method - * - * @param float $price - * @return string - */ - protected function _formatPrice($price) - { - return $this->_quote->getStore()->convertPrice($price, true); - } - - /** - * Retrieve payment method and assign additional template values - * - * @return Hps_Securesubmit_Block_Paypal_Review - */ - protected function _beforeToHtml() - { - $methodInstance = $this->_quote->getPayment()->getMethodInstance(); - $this->setPaymentMethodTitle($methodInstance->getTitle()); - - $this->setShippingRateRequired(true); - if ($this->_quote->getIsVirtual()) { - $this->setShippingRateRequired(false); - } else { - // prepare shipping rates - $this->_address = $this->_quote->getShippingAddress(); - $groups = $this->_address->getGroupedAllShippingRates(); - if ($groups && $this->_address) { - $this->setShippingRateGroups($groups); - // determine current selected code & name - foreach ($groups as $code => $rates) { - foreach ($rates as $rate) { - if ($this->_address->getShippingMethod() == $rate->getCode()) { - $this->_currentShippingRate = $rate; - break(2); - } - } - } - } - - $canEditShippingAddress = $this->_quote->getMayEditShippingAddress() && $this->_quote->getPayment() - ->getAdditionalInformation(Hps_Securesubmit_Model_Paypal_Checkout::PAYMENT_INFO_BUTTON) == 1; - // misc shipping parameters - $this->setShippingMethodSubmitUrl($this->getUrl("securesubmit/masterpass/saveShippingMethod")) - ->setCanEditShippingAddress($canEditShippingAddress) - ->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod()) - ; - } - - $this->setEditUrl($this->getUrl("securesubmit/masterpass/edit")) - ->setPlaceOrderUrl($this->getUrl("securesubmit/masterpass/placeOrder")); - - return parent::_beforeToHtml(); - } -} diff --git a/app/code/community/Hps/Securesubmit/Block/Masterpass/Review/Billing.php b/app/code/community/Hps/Securesubmit/Block/Masterpass/Review/Billing.php deleted file mode 100644 index 451536a..0000000 --- a/app/code/community/Hps/Securesubmit/Block/Masterpass/Review/Billing.php +++ /dev/null @@ -1,34 +0,0 @@ -_address)) { - if ($this->isCustomerLoggedIn() || $this->getQuote()->getBillingAddress()) { - $this->_address = $this->getQuote()->getBillingAddress(); - if (!$this->_address->getFirstname()) { - $this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname()); - } - if (!$this->_address->getLastname()) { - $this->_address->setLastname($this->getQuote()->getCustomer()->getLastname()); - } - } else { - $this->_address = Mage::getModel('sales/quote_address'); - } - } - - return $this->_address; - } -} diff --git a/app/code/community/Hps/Securesubmit/Block/Masterpass/Review/Details.php b/app/code/community/Hps/Securesubmit/Block/Masterpass/Review/Details.php deleted file mode 100644 index df79707..0000000 --- a/app/code/community/Hps/Securesubmit/Block/Masterpass/Review/Details.php +++ /dev/null @@ -1,35 +0,0 @@ -_address)) { - $this->_address = $this->getQuote()->getShippingAddress(); - } - return $this->_address; - } - - /** - * Return review quote totals - * - * @return array - */ - public function getTotals() - { - return $this->getQuote()->getTotals(); - } -} diff --git a/app/code/community/Hps/Securesubmit/Block/Masterpass/Review/Shipping.php b/app/code/community/Hps/Securesubmit/Block/Masterpass/Review/Shipping.php deleted file mode 100644 index ec72ad0..0000000 --- a/app/code/community/Hps/Securesubmit/Block/Masterpass/Review/Shipping.php +++ /dev/null @@ -1,28 +0,0 @@ -_address)) { - if ($this->isCustomerLoggedIn() || $this->getQuote()->getShippingAddress()) { - $this->_address = $this->getQuote()->getShippingAddress(); - } else { - $this->_address = Mage::getModel('sales/quote_address'); - } - } - - return $this->_address; - } -} diff --git a/app/code/community/Hps/Securesubmit/Helper/Altpayment/Abstract.php b/app/code/community/Hps/Securesubmit/Helper/Altpayment/Abstract.php deleted file mode 100644 index 688e78e..0000000 --- a/app/code/community/Hps/Securesubmit/Helper/Altpayment/Abstract.php +++ /dev/null @@ -1,425 +0,0 @@ -collectTotals(); - - - if (!$credit && !$quote->getGrandTotal() && !$quote->hasNominalItems()) { - Mage::throwException(Mage::helper('hps_securesubmit')->__($this->_methodCode . ' does not support processing orders with zero amount. To complete your purchase, proceed to the standard checkout process.')); - } - - $quote->reserveOrderId()->save(); - - return $this->startCheckout( - $quote, - $returnUrl, - $cancelUrl, - $credit - ); - } - - public function startCheckout( - $quote, - $returnUrl, - $cancelUrl, - $credit = null - ) { - $amount = $quote->getBaseGrandTotal(); - $currency = $quote->getBaseCurrencyCode(); - $address = null; - // supress or export shipping address - if ($quote->getIsVirtual()) { - $this->setRequireBillingAddress(1); - $this->setSuppressShipping(true); - } else { - $address = $quote->getShippingAddress(); - $isOverriden = 0; - if (true === $address->validate()) { - $isOverriden = 1; - } - $quote->getPayment()->setAdditionalInformation( - 'shipping_overriden', - $isOverriden - ); - $quote->getPayment()->save(); - } - - // add line items - $cart = Mage::getModel('hps_securesubmit/altpayment_cart', array($quote)); - $totals = $cart->getTotals(); - - $buyer = new HpsBuyerData(); - $buyer->returnUrl = $returnUrl; - $buyer->cancelUrl = $cancelUrl; - $buyer->credit = $credit; - $billingAddress = $quote->getBillingAddress(); - - if ($billingAddress !== null && $billingAddress->getFirstname() !== null) { - $regionModel = Mage::getModel('directory/region')->load($billingAddress->getRegionId()); - $buyer->address = new HpsAddress(); - $buyer->name = $billingAddress->getFirstname() . ' ' . $billingAddress->getMiddlename() . ' ' . $billingAddress->getLastname(); - $buyer->address = new HpsAddress(); - $buyer->address->address = $billingAddress->getStreet(1); - $buyer->address->address2 = $billingAddress->getStreet(2); - $buyer->address->city = $billingAddress->getCity(); - $buyer->address->state = $regionModel->getCode(); - $buyer->address->zip = $billingAddress->getPostcode(); - $buyer->address->country = $billingAddress->getCountryId(); - $buyer->phoneNumber = $billingAddress->getTelephone(); - } - - $payment = new HpsPaymentData(); - $payment->subtotal = sprintf("%0.2f", round($totals[Hps_Securesubmit_Model_Altpayment_Cart::TOTAL_SUBTOTAL], 3)); - $payment->shippingAmount = sprintf("%0.2f", round($totals[Hps_Securesubmit_Model_Altpayment_Cart::TOTAL_SHIPPING], 3)); - $payment->taxAmount = sprintf("%0.2f", round($totals[Hps_Securesubmit_Model_Altpayment_Cart::TOTAL_TAX], 3)); - $payment->paymentType = (Mage::getStoreConfig('payment/' . $this->_methodCode . '/payment_action') == 'authorize_capture' - ? 'Sale' : 'Authorization'); - - $discount = 0; - if (isset($totals[Hps_Securesubmit_Model_Altpayment_Cart::TOTAL_DISCOUNT])) { - $discount = sprintf("-%0.2f", round($totals[Hps_Securesubmit_Model_Altpayment_Cart::TOTAL_DISCOUNT], 3)); - $payment->subtotal += $discount; - } - - // import/suppress shipping address, if any - $shippingInfo = null; - if ($address !== null && $address->getRegionId() !== null && $address->getFirstname() !== null) { - $regionModel = Mage::getModel('directory/region')->load($address->getRegionId()); - $shippingInfo = new HpsShippingInfo(); - $shippingInfo->name = $address->getFirstname() . ' ' . $address->getMiddlename() . ' ' . $address->getLastname(); - $shippingInfo->address = new HpsAddress(); - $shippingInfo->address->address = $address->getStreet(1); - $shippingInfo->address->address2 = $address->getStreet(2); - $shippingInfo->address->city = $address->getCity(); - $shippingInfo->address->state = $regionModel->getCode(); - $shippingInfo->address->zip = $address->getPostcode(); - $shippingInfo->address->country = $address->getCountryId(); - - if ($address->getEmail()) { - $buyer->emailAddress = $address->getEmail(); - } - } - - $lineItems = array(); - if(empty($payment->taxAmount)){ - $lineItems = $this->exportLineItems($cart); - - if ($discount != 0) { - $discountItem = new HpsLineItem(); - $discountItem->name = 'Discount'; - $discountItem->number = 'discount'; - $discountItem->amount = $discount; - $lineItems[] = $discountItem; - unset($discountItem); - } - } - - $orderData = new HpsOrderData(); - $orderData->orderNumber = str_shuffle('abcdefghijklmnopqrstuvwxyz'); - $orderData->ipAddress = $_SERVER['REMOTE_ADDR']; - $orderData->browserHeader = $_SERVER['HTTP_ACCEPT']; - $orderData->userAgent = $_SERVER['HTTP_USER_AGENT']; - $orderData->originUrl = $returnUrl; - $orderData->termUrl = $cancelUrl; - $orderData->checkoutType = HpsCentinelCheckoutType::LIGHTBOX; - - if ($credit) { - $orderData->checkoutType = HpsCentinelCheckoutType::PAIRING; - } - - return $this->getService()->createSession( - $amount, - $currency, - $buyer, - $payment, - $shippingInfo, - $lineItems, - $orderData - ); - } - - public function prepareOrderReview($quote) - { - $quote->setMayEditShippingAddress(false); - $quote->setMayEditShippingMethod( - '' == $quote->getPayment()->getAdditionalInformation('shipping_method') - ); - $this->ignoreAddressValidation($quote); - $quote->collectTotals()->save(); - } - - /** - * Place the order when customer returned from altpayment service - * Until this moment all quote data must be valid - * - * @param string $token - * @param string $shippingMethodCode - */ - public function place($quote, $token, $shippingMethodCode = null) - { - if ($shippingMethodCode) { - $this->updateShippingMethod($shippingMethodCode); - } - - $isNewCustomer = false; - switch ($this->getCheckoutMethod($quote)) { - case Mage_Checkout_Model_Type_Onepage::METHOD_GUEST: - $quote = $this->_prepareGuestQuote($quote); - break; - case Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER: - $quote = $this->_prepareNewCustomerQuote($quote); - $isNewCustomer = true; - break; - default: - $quote = $this->_prepareCustomerQuote($quote); - break; - } - - $this->ignoreAddressValidation($quote); - $quote->collectTotals(); - $service = Mage::getModel('sales/service_quote', $quote); - $service->submitAll(); - $quote->save(); - - if ($isNewCustomer) { - try { - $this->_involveNewCustomer(); - } catch (Exception $e) { - Mage::logException($e); - } - } - - /** @var $order Mage_Sales_Model_Order */ - $order = $service->getOrder(); - if (!$order) { - return false; - } - - switch ($order->getState()) { - // even after placement altpayment service can disallow to authorize/capture, - // but will wait until bank transfers money - case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT: - // TODO - break; - // regular placement, when everything is ok - case Mage_Sales_Model_Order::STATE_PROCESSING: - case Mage_Sales_Model_Order::STATE_COMPLETE: - case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW: - $order->sendNewOrderEmail(); - break; - } - return $order; - } - - public function authenticate( - $orderId, - $oauthToken, - $oauthVerifier, - $payload, - $resourceUrl, - $orderData = null - ) { - return $this->getService()->authenticate( - $orderId, - $oauthToken, - $oauthVerifier, - $payload, - $resourceUrl, - $orderData - ); - } - - /** - * Make sure addresses will be saved without validation errors - */ - public function ignoreAddressValidation($quote) - { - $quote->getBillingAddress()->setShouldIgnoreValidation(true); - if (!$quote->getIsVirtual()) { - $quote->getShippingAddress()->setShouldIgnoreValidation(true); - } - } - - /** - * Get checkout method - * - * @return string - */ - protected function getCheckoutMethod($quote) - { - if (Mage::getSingleton('customer/session')->isLoggedIn()) { - return Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER; - } - if (!$quote->getCheckoutMethod()) { - if (Mage::helper('checkout')->isAllowedGuestCheckout($quote)) { - $quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_GUEST); - } else { - $quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER); - } - } - return $quote->getCheckoutMethod(); - } - - protected function getCheckoutDetails($token) - { - return $this->getService()->sessionInfo($token); - } - - /** - * Prepare quote for guest checkout order submit - */ - protected function _prepareGuestQuote($quote) - { - $quote->setCustomerId(null) - ->setCustomerEmail($quote->getBillingAddress()->getEmail()) - ->setCustomerIsGuest(true) - ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID); - return $quote; - } - - /** - * Checks if customer with email coming from Express checkout exists - * - * @return int - */ - protected function _lookupCustomerId($quote) - { - return Mage::getModel('customer/customer') - ->setWebsiteId(Mage::app()->getWebsite()->getId()) - ->loadByEmail($quote->getCustomerEmail()) - ->getId(); - } - - /** - * Prepare quote for customer registration and customer order submit - * and restore magento customer data from quote - */ - protected function _prepareNewCustomerQuote($quote) - { - $billing = $quote->getBillingAddress(); - $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); - - $customerId = $this->_lookupCustomerId($quote); - if ($customerId) { - Mage::getSingleton('customer/session')->loginById($customerId); - return $this->_prepareCustomerQuote($quote); - } - - $customer = $quote->getCustomer(); - /** @var $customer Mage_Customer_Model_Customer */ - $customerBilling = $billing->exportCustomerAddress(); - $customer->addAddress($customerBilling); - $billing->setCustomerAddress($customerBilling); - $customerBilling->setIsDefaultBilling(true); - if ($shipping && !$shipping->getSameAsBilling()) { - $customerShipping = $shipping->exportCustomerAddress(); - $customer->addAddress($customerShipping); - $shipping->setCustomerAddress($customerShipping); - $customerShipping->setIsDefaultShipping(true); - } elseif ($shipping) { - $customerBilling->setIsDefaultShipping(true); - } - - if ($quote->getCustomerDob() && !$billing->getCustomerDob()) { - $billing->setCustomerDob($quote->getCustomerDob()); - } - - if ($quote->getCustomerTaxvat() && !$billing->getCustomerTaxvat()) { - $billing->setCustomerTaxvat($quote->getCustomerTaxvat()); - } - - if ($quote->getCustomerGender() && !$billing->getCustomerGender()) { - $billing->setCustomerGender($quote->getCustomerGender()); - } - - Mage::helper('core')->copyFieldset('checkout_onepage_billing', 'to_customer', $billing, $customer); - $customer->setEmail($quote->getCustomerEmail()); - $customer->setPrefix($quote->getCustomerPrefix()); - $customer->setFirstname($quote->getCustomerFirstname()); - $customer->setMiddlename($quote->getCustomerMiddlename()); - $customer->setLastname($quote->getCustomerLastname()); - $customer->setSuffix($quote->getCustomerSuffix()); - $customer->setPassword($customer->decryptPassword($quote->getPasswordHash())); - $customer->setPasswordHash($customer->hashPassword($customer->getPassword())); - $customer->save(); - $quote->setCustomer($customer); - - return $quote; - } - - /** - * Prepare quote for customer order submit - */ - protected function _prepareCustomerQuote($quote) - { - $billing = $quote->getBillingAddress(); - $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); - - $customer = Mage::getSingleton('customer/session')->getCustomer(); - if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) { - $customerBilling = $billing->exportCustomerAddress(); - $customer->addAddress($customerBilling); - $billing->setCustomerAddress($customerBilling); - } - if ($shipping && ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) - || (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook()))) { - $customerShipping = $shipping->exportCustomerAddress(); - $customer->addAddress($customerShipping); - $shipping->setCustomerAddress($customerShipping); - } - - if (isset($customerBilling) && !$customer->getDefaultBilling()) { - $customerBilling->setIsDefaultBilling(true); - } - if ($shipping && isset($customerBilling) && !$customer->getDefaultShipping() && $shipping->getSameAsBilling()) { - $customerBilling->setIsDefaultShipping(true); - } elseif ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) { - $customerShipping->setIsDefaultShipping(true); - } - $quote->setCustomer($customer); - - return $quote; - } - - protected function exportLineItems($cart) - { - if (!$cart) { - return; - } - - // add cart line items - $items = $cart->getItems(); - - if (empty($items)) { - return; - } - - $result = array(); - foreach ($items as $item) { - $lineItem = new HpsLineItem(); - $lineItem->number = $item->getDataUsingMethod('id'); - $lineItem->quantity = $item->getDataUsingMethod('qty'); - $lineItem->name = $item->getDataUsingMethod('name'); - $lineItem->amount = $item->getDataUsingMethod('amount'); - $result[] = $lineItem; - } - return $result; - } - - protected function getService() - { - throw new Exception('AltPayment service not configured'); - } -} diff --git a/app/code/community/Hps/Securesubmit/Helper/Jwt.php b/app/code/community/Hps/Securesubmit/Helper/Jwt.php deleted file mode 100644 index f1524c5..0000000 --- a/app/code/community/Hps/Securesubmit/Helper/Jwt.php +++ /dev/null @@ -1,160 +0,0 @@ - - * @license Custom https://github.com/hps/heartland-php/blob/master/LICENSE.txt - * @link https://developer.heartlandpaymentsystems.com - */ - -/** - * JWT encoding - * - * PHP Version 5.2+ - * - * @category Authentication - * @package HPS - * @author Heartland Payment Systems - * @license Custom https://github.com/hps/heartland-php/blob/master/LICENSE.txt - * @link https://developer.heartlandpaymentsystems.com - */ -class Hps_Securesubmit_Helper_Jwt extends Mage_Core_Helper_Abstract -{ - /** - * Encodes a JWT with a `$key` and a `$payload` - * - * @param string $key key used to sign the JWT - * @param mixed $payload payload to be included - * - * @return string - */ - public static function encode($key = '', $payload = array()) - { - $header = array('typ' => 'JWT', 'alg' => 'HS256'); - - $parts = array( - self::urlsafeBase64Encode(json_encode($header)), - self::urlsafeBase64Encode(json_encode($payload)), - ); - $signingData = implode('.', $parts); - $signature = self::sign($key, $signingData); - $parts[] = self::urlsafeBase64Encode($signature); - - return implode('.', $parts); - } - - /** - * Signs a set of `$signingData` with a given `$key` - * - * @param string $key key used to sign the JWT - * @param string $signingData data to be signed - * - * @return string - */ - public static function sign($key, $signingData) - { - return hash_hmac('sha256', $signingData, $key, true); - } - - /** - * Verify a JWT - * - * @param string $jwt JWT to be verified - * @param string $key signing key - * - * @return boolean - */ - public static function verify($jwt, $key) - { - $parts = explode('.', $jwt); - - if (count($parts) !== 3) { - return false; - } - - list($header, $payload, $signature) = $parts; - $signingData = sprintf('%s.%s', $header, $payload); - $hash = hash_hmac('sha256', $signingData, $key, true); - $signature = self::urlsafeBase64Dencode($signature); - - return self::hashEquals($signature, $hash); - } - - /** - * Creates a url-safe base64 encoded value - * - * @param string $data data to be encoded - * - * @return string - */ - protected static function urlsafeBase64Encode($data) - { - return str_replace('=', '', strtr(base64_encode($data), '+/', '-_')); - } - - /** - * Decodes a url-safe base64 encoded value - * - * @param string $data base64 encoded value - * - * @return string - */ - protected static function urlsafeBase64Dencode($data) - { - $remainder = strlen($data) % 4; - if ($remainder) { - $padlen = 4 - $remainder; - $data .= str_repeat('=', $padlen); - } - return base64_decode(strtr($data, '-_', '+/')); - } - - /** - * Compares two hashes for equality - * - * @param string $signature previous value - * @param string $hash calculated value - * - * @return boolean - */ - protected static function hashEquals($signature, $hash) - { - if (function_exists('hash_equals')) { - return hash_equals($signature, $hash); - } - - if (self::safeStrLength($signature) !== self::safeStrLength($hash)) { - return false; - } - - $xor = $signature ^ $hash; - $result = 0; - - for ($i = self::safeStrLength($xor) - 1; 0 <= $i; $i--) { - $result |= ord($xor[$i]); - } - - return (0 === $result); - } - - /** - * Gets string length - * - * @param string $string value to check - * - * @return number - */ - protected static function safeStrLength($string) - { - if (function_exists('mb_strlen')) { - return mb_strlen($string); - } - - return strlen($string); - } -} diff --git a/app/code/community/Hps/Securesubmit/Helper/Masterpass.php b/app/code/community/Hps/Securesubmit/Helper/Masterpass.php deleted file mode 100644 index 0d81805..0000000 --- a/app/code/community/Hps/Securesubmit/Helper/Masterpass.php +++ /dev/null @@ -1,78 +0,0 @@ -transactionStatus = $status; - if ($pairingToken !== '' && $pairingVerifier !== '') { - $orderData->pairingToken = $pairingToken; - $orderData->pairingVerifier = $pairingVerifier; - $orderData->checkoutType = HpsCentinelCheckoutType::PAIRING_CHECKOUT; - } - - // Authenticate the request with the information we've gathered - $response = $this->getService()->authenticate( - $orderId, - $oauthToken, - $oauthVerifier, - $payload, - $checkoutResourceUrl, - $orderData - ); - - if ('0' !== $response->errorNumber) { - throw new Exception(); - } - - $data = (object)array_merge((array)$response, array( - 'status' => $status, - )); - } catch (Exception $e) { - $data = false; - } - return $data; - } - - public function preApproval($longAccessToken = '') - { - if ($longAccessToken == '') { - return false; - } - - return $this->getService()->preApproval($longAccessToken); - } - - protected function getService() - { - $config = new HpsCentinelConfig(); - if (!Mage::getStoreConfig('payment/hps_masterpass/use_sandbox')) { - $config->serviceUri = "https://api-uat.heartlandportico.com/paymentserver.v1/PosGatewayService.asmx"; - } - $config->processorId = Mage::getStoreConfig('payment/hps_masterpass/processor_id'); - $config->merchantId = Mage::getStoreConfig('payment/hps_masterpass/merchant_id'); - $config->transactionPwd = Mage::getStoreConfig('payment/hps_masterpass/transaction_pwd'); - return new HpsMasterPassService($config); - } -} diff --git a/app/code/community/Hps/Securesubmit/Model/Altpayment/Cart.php b/app/code/community/Hps/Securesubmit/Model/Altpayment/Cart.php deleted file mode 100644 index 2879770..0000000 --- a/app/code/community/Hps/Securesubmit/Model/Altpayment/Cart.php +++ /dev/null @@ -1,457 +0,0 @@ -_salesEntity = $salesEntity; - } else { - throw new Exception('Invalid sales entity provided.'); - } - } - /** - * Getter for the current sales entity - * - * @return Mage_Sales_Model_Order - * @return Mage_Sales_Model_Quote - */ - public function getSalesEntity() - { - return $this->_salesEntity; - } - /** - * Render and get line items - * By default returns false if the items are invalid - * - * @param bool $bypassValidation - * @return array|false - */ - public function getItems($bypassValidation = false) - { - $this->_render(); - if (!$bypassValidation && !$this->_areItemsValid) { - return false; - } - return $this->_items; - } - /** - * Render and get totals - * If the totals are invalid for any reason, they will be merged into one amount (subtotal is utilized for it) - * An option to substract discount from the subtotal is available - * - * @param bool $mergeDiscount - * @return array - */ - public function getTotals($mergeDiscount = false) - { - $this->_render(); - // cut down totals to one total if they are invalid - if (!$this->_areTotalsValid) { - $totals = array( - self::TOTAL_SUBTOTAL => $this->_totals[self::TOTAL_SUBTOTAL] + $this->_totals[self::TOTAL_TAX] - ); - if (!$this->_isShippingAsItem) { - $totals[self::TOTAL_SUBTOTAL] += $this->_totals[self::TOTAL_SHIPPING]; - } - if (!$this->_isDiscountAsItem) { - $totals[self::TOTAL_SUBTOTAL] -= $this->_totals[self::TOTAL_DISCOUNT]; - } - return $totals; - } elseif ($mergeDiscount) { - $totals = $this->_totals; - unset($totals[self::TOTAL_DISCOUNT]); - if (!$this->_isDiscountAsItem) { - $totals[self::TOTAL_SUBTOTAL] -= $this->_totals[self::TOTAL_DISCOUNT]; - } - return $totals; - } - return $this->_totals; - } - /** - * Add a line item - * - * @param string $name - * @param numeric $qty - * @param float $amount - * @param string $identifier - * @return Varien_Object - */ - public function addItem($name, $qty, $amount, $identifier = null) - { - $this->_shouldRender = true; - $item = new Varien_Object(array( - 'name' => $name, - 'qty' => $qty, - 'amount' => (float)$amount, - )); - if ($identifier) { - $item->setData('id', $identifier); - } - $this->_items[] = $item; - return $item; - } - /** - * Remove item from cart by identifier - * - * @param string $identifier - * @return bool - */ - public function removeItem($identifier) - { - foreach ($this->_items as $key => $item) { - if ($item->getId() == $identifier) { - unset($this->_items[$key]); - return true; - } - } - return false; - } - /** - * Compound the specified amount with the specified total - * - * @param string $code - * @param float $amount - * @param string $lineItemDescription - * @return Hps_Securesubmit_Model_Paypal_Cart - */ - public function updateTotal($code, $amount, $lineItemDescription = null) - { - $this->_shouldRender = true; - if (isset($this->_totals[$code])) { - $this->_totals[$code] += $amount; - if ($lineItemDescription) { - $this->_totalLineItemDescriptions[$code][] = $lineItemDescription; - } - } - return $this; - } - /** - * Get/Set whether to render the discount total as a line item - * - * @param $setValue - * @return bool|Hps_Securesubmit_Model_Paypal_Cart - */ - public function isDiscountAsItem($setValue = null) - { - return $this->_totalAsItem('_isDiscountAsItem', $setValue); - } - /** - * Get/Set whether to render the discount total as a line item - * - * @param $setValue - * @return bool|Hps_Securesubmit_Model_Paypal_Cart - */ - public function isShippingAsItem($setValue = null) - { - return $this->_totalAsItem('_isShippingAsItem', $setValue); - } - /** - * (re)Render all items and totals - */ - protected function _render() - { - if (!$this->_shouldRender) { - return; - } - // regular items from the sales entity - $this->_items = array(); - foreach ($this->_salesEntity->getAllItems() as $item) { - if (!$item->getParentItem()) { - $this->_addRegularItem($item); - } - } - end($this->_items); - $lastRegularItemKey = key($this->_items); - // regular totals - $shippingDescription = ''; - if ($this->_salesEntity instanceof Mage_Sales_Model_Order) { - $shippingDescription = $this->_salesEntity->getShippingDescription(); - $this->_totals = array( - self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), - self::TOTAL_TAX => $this->_salesEntity->getBaseTaxAmount(), - self::TOTAL_SHIPPING => $this->_salesEntity->getBaseShippingAmount(), - self::TOTAL_DISCOUNT => abs($this->_salesEntity->getBaseDiscountAmount()), - ); - $this->_applyHiddenTaxWorkaround($this->_salesEntity); - } else { - $address = $this->_salesEntity->getIsVirtual() ? - $this->_salesEntity->getBillingAddress() : $this->_salesEntity->getShippingAddress(); - $shippingDescription = $address->getShippingDescription(); - $this->_totals = array ( - self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), - self::TOTAL_TAX => $address->getBaseTaxAmount(), - self::TOTAL_SHIPPING => $address->getBaseShippingAmount(), - self::TOTAL_DISCOUNT => abs($address->getBaseDiscountAmount()), - ); - $this->_applyHiddenTaxWorkaround($address); - } - $originalDiscount = $this->_totals[self::TOTAL_DISCOUNT]; - // arbitrary items, total modifications - Mage::dispatchEvent('paypal_prepare_line_items', array('paypal_cart' => $this)); - // distinguish original discount among the others - if ($originalDiscount > 0.0001 && isset($this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT])) { - $this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT][] = Mage::helper('sales')->__('Discount (%s)', Mage::app()->getStore()->convertPrice($originalDiscount, true, false)); - } - // discount, shipping as items - if ($this->_isDiscountAsItem && $this->_totals[self::TOTAL_DISCOUNT]) { - $this->addItem(Mage::helper('paypal')->__('Discount'), 1, -1.00 * $this->_totals[self::TOTAL_DISCOUNT], - $this->_renderTotalLineItemDescriptions(self::TOTAL_DISCOUNT) - ); - } - $shippingItemId = $this->_renderTotalLineItemDescriptions(self::TOTAL_SHIPPING, $shippingDescription); - if ($this->_isShippingAsItem && (float)$this->_totals[self::TOTAL_SHIPPING]) { - $this->addItem(Mage::helper('paypal')->__('Shipping'), 1, (float)$this->_totals[self::TOTAL_SHIPPING], - $shippingItemId - ); - } - // compound non-regular items into subtotal - foreach ($this->_items as $key => $item) { - if ($key > $lastRegularItemKey && $item->getAmount() != 0) { - $this->_totals[self::TOTAL_SUBTOTAL] += $item->getAmount(); - } - } - $this->_validate(); - // if cart items are invalid, prepare cart for transfer without line items - if (!$this->_areItemsValid) { - $this->removeItem($shippingItemId); - } - $this->_shouldRender = false; - } - /** - * Merge multiple descriptions by a total code into a string - * - * @param string $code - * @param string $prepend - * @param string $append - * @param string $glue - * @return string - */ - protected function _renderTotalLineItemDescriptions($code, $prepend = '', $append = '', $glue = '; ') - { - $result = array(); - if ($prepend) { - $result[] = $prepend; - } - if (isset($this->_totalLineItemDescriptions[$code])) { - $result = array_merge($this->_totalLineItemDescriptions[$code]); - } - if ($append) { - $result[] = $append; - } - return implode($glue, $result); - } - /** - * Check the line items and totals according to PayPal business logic limitations - */ - protected function _validate() - { - $this->_areItemsValid = true; - $this->_areTotalsValid = false; - $referenceAmount = $this->_salesEntity->getBaseGrandTotal(); - $itemsSubtotal = 0; - foreach ($this->_items as $i) { - $itemsSubtotal = $itemsSubtotal + $i['qty'] * $i['amount']; - } - $sum = $itemsSubtotal + $this->_totals[self::TOTAL_TAX]; - if (!$this->_isShippingAsItem) { - $sum += $this->_totals[self::TOTAL_SHIPPING]; - } - if (!$this->_isDiscountAsItem) { - $sum -= $this->_totals[self::TOTAL_DISCOUNT]; - } - /** - * numbers are intentionally converted to strings because of possible comparison error - * see http://php.net/float - */ - // match sum of all the items and totals to the reference amount - if (sprintf('%.4F', $sum) != sprintf('%.4F', $referenceAmount)) { - $adjustment = $sum - $referenceAmount; - $this->_totals[self::TOTAL_SUBTOTAL] = $this->_totals[self::TOTAL_SUBTOTAL] - $adjustment; - } - // PayPal requires to have discount less than items subtotal - if (!$this->_isDiscountAsItem) { - $this->_areTotalsValid = round($this->_totals[self::TOTAL_DISCOUNT], 4) < round($itemsSubtotal, 4); - } else { - $this->_areTotalsValid = $itemsSubtotal > 0.00001; - } - $this->_areItemsValid = $this->_areItemsValid && $this->_areTotalsValid; - } - /** - * Check whether items are valid - * - * @return bool - */ - public function areItemsValid() - { - return $this->_areItemsValid; - } - /** - * Add a usual line item with amount and qty - * - * @param Varien_Object $salesItem - * @return Varien_Object - */ - protected function _addRegularItem(Varien_Object $salesItem) - { - if ($this->_salesEntity instanceof Mage_Sales_Model_Order) { - $qty = (int) $salesItem->getQtyOrdered(); - $amount = (float) $salesItem->getBasePrice(); - // TODO: nominal item for order - } else { - $qty = (int) $salesItem->getTotalQty(); - $amount = $salesItem->isNominal() ? 0 : (float) $salesItem->getBaseCalculationPrice(); - } - // workaround in case if item subtotal precision is not compatible with PayPal (.2) - $subAggregatedLabel = ''; - if ($amount - round($amount, 2)) { - $amount = $amount * $qty; - $subAggregatedLabel = ' x' . $qty; - $qty = 1; - } - // aggregate item price if item qty * price does not match row total - if (($amount * $qty) != $salesItem->getBaseRowTotal()) { - $amount = (float) $salesItem->getBaseRowTotal(); - $subAggregatedLabel = ' x' . $qty; - $qty = 1; - } - return $this->addItem($salesItem->getName() . $subAggregatedLabel, $qty, $amount, $salesItem->getSku()); - } - /** - * Get/Set for the specified variable. - * If the value changes, the re-rendering is commenced - * - * @param string $var - * @param $setValue - * @return bool|Hps_Securesubmit_Model_Paypal_Cart - */ - private function _totalAsItem($var, $setValue = null) - { - if (null !== $setValue) { - if ($setValue != $this->$var) { - $this->_shouldRender = true; - } - $this->$var = $setValue; - return $this; - } - return $this->$var; - } - /** - * Add "hidden" discount and shipping tax - * - * Go ahead, try to understand ]:-> - * - * Tax settings for getting "discount tax": - * - Catalog Prices = Including Tax - * - Apply Customer Tax = After Discount - * - Apply Discount on Prices = Including Tax - * - * Test case for getting "hidden shipping tax": - * - Make sure shipping is taxable (set shipping tax class) - * - Catalog Prices = Including Tax - * - Shipping Prices = Including Tax - * - Apply Customer Tax = After Discount - * - Create a shopping cart price rule with % discount applied to the Shipping Amount - * - run shopping cart and estimate shipping - * - go to PayPal - * - * @param Mage_Core_Model_Abstract $salesEntity - */ - private function _applyHiddenTaxWorkaround($salesEntity) - { - $this->_totals[self::TOTAL_TAX] += (float)$salesEntity->getBaseHiddenTaxAmount(); - $this->_totals[self::TOTAL_TAX] += (float)$salesEntity->getBaseShippingHiddenTaxAmount(); - } - /** - * Check whether any item has negative amount - * - * @return bool - */ - public function hasNegativeItemAmount() - { - foreach ($this->_items as $item) { - if ($item->getAmount() < 0) { - return true; - } - } - return false; - } -} diff --git a/app/code/community/Hps/Securesubmit/Model/Masterpass.php b/app/code/community/Hps/Securesubmit/Model/Masterpass.php deleted file mode 100644 index edb75ac..0000000 --- a/app/code/community/Hps/Securesubmit/Model/Masterpass.php +++ /dev/null @@ -1,347 +0,0 @@ -getInfoInstance(); - $additionalData = new Varien_Object($info->getAdditionalData() ? unserialize($info->getAdditionalData()) : null); - - // Only validate when not using token - if ($additionalData->getUseCreditCard()) { - parent::validate(); - } - - return $this; - } - - /** - * Capture payment - * - * @param Varien_Object $payment - * @param float $amount - * @return $this - */ - public function capture(Varien_Object $payment, $amount) - { - $this->_authorize($payment, $amount, true); - } - - /** - * Authorize payment - * - * @param Varien_Object $payment - * @param float $amount - * @return $this - */ - public function authorize(Varien_Object $payment, $amount) - { - $this->_authorize($payment, $amount, false); - } - - /** - * Authorize or Capture payment - * - * @param Varien_Object $payment - * @param float $amount - * @param bool $capture - * @return $this - */ - private function _authorize(Varien_Object $payment, $amount, $capture) - { - $order = $payment->getOrder(); /* @var $order Mage_Sales_Model_Order */ - $billing = $order->getBillingAddress(); - $shipping = $order->getShippingAddress(); - $authenticate = Mage::getSingleton('hps_securesubmit/session')->getMasterPassAuthenticate(); - $currency = $order->getBaseCurrencyCode(); - - // Billing - $buyer = new HpsBuyerData(); - $buyer->name = $billing->getData('firstname') . ' ' . $billing->getData('lastname'); - - $regionModel = Mage::getModel('directory/region')->load($billing->getRegionId()); - - $address = new HpsAddress(); - $address->address = $billing->getStreet(1); - $address->city = $billing->getCity(); - $address->state = $regionModel->getCode(); - $address->zip = preg_replace('/[^0-9]/', '', $billing->getPostcode()); - $address->country = $billing->getCountryId(); - $buyer->address = $address; - - // Shipping - $shippingInfo = new HpsShippingInfo(); - $shippingInfo->name = $billing->getData('firstname') . ' ' . $billing->getData('lastname'); - - $regionModel = Mage::getModel('directory/region')->load($shipping->getRegionId()); - - $address = new HpsAddress(); - $address->address = $shipping->getStreet(1); - $address->city = $shipping->getCity(); - $address->state = $regionModel->getCode(); - $address->zip = preg_replace('/[^0-9]/', '', $shipping->getPostcode()); - $address->country = $shipping->getCountryId(); - $shippingInfo->address = $address; - - //$details = new HpsTransactionDetails(); - //$details->invoiceNumber = $order->getIncrementId(); - - try - { - if (!$authenticate && !$payment->getCcTransId()) { - throw new Exception( - __('Error:', 'wc_securesubmit') - . ' Invalid MasterPass session' - ); - } - - // Create an authorization - $response = null; - $orderId = null; - if ($capture) { - if ($payment->getCcTransId()) { - $orderId = $this->getMasterPassOrderId($payment); - $orderData = new HpsOrderData(); - $orderData->currencyCode = $currency; - - $response = $this->getService()->capture( - $orderId, - $amount, - $orderData - ); - } else { - $response = $this->getService()->sale( - $authenticate->orderId, - $amount, - $currency, - $buyer, - new HpsPaymentData(), - $shippingInfo - ); - $orderId = $authenticate->orderId; - } - } else { - $response = $this->getService()->authorize( - $authenticate->orderId, - $amount, - $currency, - $buyer, - new HpsPaymentData(), - $shippingInfo - ); - $orderId = $authenticate->orderId; - } - - $transactionId = null; - if (property_exists($response, 'capture')) { - $transactionId = $response->capture->transactionId; - } else { - $transactionId = $response->transactionId; - } - - // No exception thrown so action was a success - $this->_debugChargeService($this->getService()); - $payment->setStatus(self::STATUS_APPROVED); - $payment->setAmount($amount); - $payment->setLastTransId($orderId); - $payment->setCcTransId($orderId); - $payment->setTransactionId($transactionId); - $payment->setIsTransactionClosed(0); - } catch (HpsException $e) { - $this->_debugChargeService($this->getService(), $e); - $payment->setStatus(self::STATUS_DECLINED); - $this->throwUserError($e->getMessage(), null, true); - } catch (Exception $e) { - $this->_debugChargeService($this->getService(), $e); - Mage::logException($e); - $payment->setStatus(self::STATUS_ERROR); - $this->throwUserError($e->getMessage()); - } - - return $this; - } - - public function refund(Varien_Object $payment, $amount) - { - $order = $payment->getOrder(); - $orderId = $this->getMasterPassOrderId($payment); - $currency = $order->getBaseCurrencyCode(); - $transactionId = $payment->getTransactionId(); - - $orderData = new HpsOrderData(); - $orderData->currencyCode = $currency; - - try { - $refundResponse = $this->getService()->refund( - $orderId, - $order->getGrandTotal() === $amount, - $amount, - $orderData - ); - - $this->_debugChargeService($this->getService()); - $payment - ->setTransactionId($refundResponse->transactionId) - ->setParentTransactionId($transactionId) - ->setIsTransactionClosed(1) - ->setShouldCloseParentTransaction(1); - - } - catch (HpsException $e) - { - $this->_debugChargeService($this->getService(), $e); - $this->throwUserError($e->getMessage()); - } - catch (Exception $e) { - $this->_debugChargeService($this->getService(), $e); - Mage::logException($e); - $this->throwUserError($e->getMessage()); - } - - return $this; - } - - /** - * Void payment abstract method - * - * @param Varien_Object $payment - * - * @return Hps_Securesubmit_Model_Payment - */ - public function void(Varien_Object $payment) - { - $orderId = $this->getMasterPassOrderId($payment); - $transactionId = $payment->getTransactionId(); - - try { - $voidResponse = $this->getService()->void($orderId); - - $this->_debugChargeService($this->getService()); - $payment - ->setTransactionId($voidResponse->transactionId) - ->setParentTransactionId($transactionId) - ->setIsTransactionClosed(1) - ->setShouldCloseParentTransaction(1); - } catch (HpsException $e) { - $this->_debugChargeService($this->getService(), $e); - Mage::throwException($e->getMessage()); - } catch (Exception $e) { - $this->_debugChargeService($this->getService(), $e); - Mage::logException($e); - Mage::throwException(Mage::helper('hps_securesubmit')->__('An unexpected error occurred. Please try again or contact a system administrator.')); - } - - return $this; - } - - protected function getMasterPassOrderId($payment) - { - $orderId = $payment->getCcTransId(); - Mage::log($orderId); - if ($orderId == null) { - $orderId = $payment->getLastTransId(); - } - Mage::log($orderId); - return $orderId; - } - - public function isAvailable($quote = null) - { - if ($quote && $quote->getBaseGrandTotal() < $this->_minOrderTotal) { - return false; - } - - $storeId = $quote ? $quote->getStoreId() : null; - return $this->getConfigData('processor_id', $storeId) - && $this->getConfigData('merchant_id', $storeId) - && $this->getConfigData('transaction_pwd', $storeId) - && $this->getConfigData('merchant_checkout_id', $storeId) - && parent::isAvailable($quote); - } - - public function canUseForCurrency($currencyCode) - { - if (!in_array($currencyCode, $this->_supportedCurrencyCodes)) { - return false; - } - - return true; - } - - /** - * @param string $error - * @param string $detailedError - * @param bool $goToPaymentSection - * @throws Mage_Core_Exception - */ - public function throwUserError($error, $detailedError = NULL, $goToPaymentSection = FALSE) - { - // Register detailed error for error reporting elsewhere - $detailedError = $detailedError ? $error.' ['.$detailedError.']' : $error; - Mage::unregister('payment_detailed_error'); - Mage::register('payment_detailed_error', $detailedError); - - // Replace gateway error with custom error message for customers - $error = Mage::helper('hps_securesubmit')->__($error); - if ($customMessage = $this->getConfigData('custom_message')) { - $error = sprintf($customMessage, $error); - } - - // Send checkout session back to payment section to avoid double-attempt to charge single-use token - if ($goToPaymentSection && Mage::app()->getRequest()->getOriginalPathInfo() == '/checkout/onepage/saveOrder') { - Mage::getSingleton('checkout/session')->setGotoSection('payment'); - } - throw new Mage_Core_Exception($error); - } - - /** - * @param HpsMasterPassService $service - * @param Exception|null $exception - */ - public function _debugChargeService(HpsMasterPassService $service, $exception = NULL) - { - if ($this->getDebugFlag()) { - $this->_debug(array( - 'store' => Mage::app()->getStore($this->getStore())->getFrontendName(), - 'exception_message' => $exception ? get_class($exception).': '.$exception->getMessage() : '', - // 'last_request' => $service->lastRequest, - // 'last_response' => $service->lastResponse, - )); - } - } - - protected function getService() - { - $config = new HpsCentinelConfig(); - if (!Mage::getStoreConfig('payment/hps_masterpass/use_sandbox')) { - $config->serviceUri = "https://api-uat.heartlandportico.com/paymentserver.v1/PosGatewayService.asmx"; - } - $config->processorId = Mage::getStoreConfig('payment/hps_masterpass/processor_id'); - $config->merchantId = Mage::getStoreConfig('payment/hps_masterpass/merchant_id'); - $config->transactionPwd = Mage::getStoreConfig('payment/hps_masterpass/transaction_pwd'); - return new HpsMasterPassService($config); - } -} diff --git a/app/code/community/Hps/Securesubmit/Model/Resource/Report.php b/app/code/community/Hps/Securesubmit/Model/Resource/Report.php deleted file mode 100644 index 4c29ab8..0000000 --- a/app/code/community/Hps/Securesubmit/Model/Resource/Report.php +++ /dev/null @@ -1,9 +0,0 @@ -_init('hps_securesubmit/report', 'row_id'); - } -} diff --git a/app/code/community/Hps/Securesubmit/Model/Resource/Report/Collection.php b/app/code/community/Hps/Securesubmit/Model/Resource/Report/Collection.php deleted file mode 100755 index 006e930..0000000 --- a/app/code/community/Hps/Securesubmit/Model/Resource/Report/Collection.php +++ /dev/null @@ -1,15 +0,0 @@ -_init('hps_securesubmit/report'); - } -} diff --git a/app/code/community/Hps/Securesubmit/Model/Resource/Setup.php b/app/code/community/Hps/Securesubmit/Model/Resource/Setup.php deleted file mode 100644 index 044bb50..0000000 --- a/app/code/community/Hps/Securesubmit/Model/Resource/Setup.php +++ /dev/null @@ -1,11 +0,0 @@ -_init('hps_securesubmit/storedcard'); - } -} diff --git a/app/code/community/Hps/Securesubmit/Model/Source/Cctype.php b/app/code/community/Hps/Securesubmit/Model/Source/Cctype.php deleted file mode 100644 index a831ecc..0000000 --- a/app/code/community/Hps/Securesubmit/Model/Source/Cctype.php +++ /dev/null @@ -1,13 +0,0 @@ -_init('hps_securesubmit/storedcard'); - } - - public function removeDuplicates() - { - $this->getResource()->removeDuplicates($this); - return $this; - } - -} diff --git a/app/code/community/Hps/Securesubmit/controllers/GiftcardController.php b/app/code/community/Hps/Securesubmit/controllers/GiftcardController.php deleted file mode 100644 index c442dce..0000000 --- a/app/code/community/Hps/Securesubmit/controllers/GiftcardController.php +++ /dev/null @@ -1,51 +0,0 @@ -getRequest()->getParam('giftcard_number'); - $giftCardPin = $this->getRequest()->getParam('giftcard_pin'); - - if (!$giftCardNumber) { - throw new Mage_Core_Exception($this->__('No number received.')); - } - - $config = new HpsServicesConfig(); - - $config->secretApiKey = Mage::getModel('hps_securesubmit/payment')->getConfigData('secretapikey'); - $config->versionNumber = '1573'; - $config->developerId = '002914'; - - $giftService = new HpsGiftCardService($config); - - try { - $card = new HpsGiftCard(); - $card->number = $giftCardNumber; - $card->pin = $giftCardPin; - - $response = $giftService->balance($card); - - $cart = Mage::getModel('checkout/session')->getQuote(); - $total = $cart->getGrandTotal(); - - $result = array( - 'error' => FALSE, - 'balance' => $response->balanceAmount, - 'less_than_total' => $response->balanceAmount < $total, - ); - } catch (HpsException $e) { - $result = array('error' => TRUE, 'message' => $e->getMessage()); - } - } catch (Mage_Core_Exception $e) { - $result = array('error' => TRUE, 'message' => $e->getMessage()); - } catch (Exception $e) { - Mage::logException($e); - $result = array('error' => TRUE, 'message' => $this->__('An unexpected error occurred retrieving your stored card. We apologize for the inconvenience, please contact us for further support.')); - } - - $this->getResponse()->setHeader('Content-Type', 'application/json', TRUE); - $this->getResponse()->setBody(json_encode($result)); - } -} diff --git a/app/code/community/Hps/Securesubmit/controllers/MasterpassController.php b/app/code/community/Hps/Securesubmit/controllers/MasterpassController.php deleted file mode 100644 index 1985f19..0000000 --- a/app/code/community/Hps/Securesubmit/controllers/MasterpassController.php +++ /dev/null @@ -1,341 +0,0 @@ -getQuote()->getIsMultiShipping()) { - $this->getQuote()->setIsMultiShipping(false); - $this->getQuote()->removeAllAddresses(); - } - - $customer = Mage::getSingleton('customer/session')->getCustomer(); - $quoteCheckoutMethod = $this->getQuote()->getCheckoutMethod(); - if ($customer && $customer->getId()) { - $this->getQuote()->assignCustomerWithAddressChange( - $customer, - $this->getQuote()->getBillingAddress(), - $this->getQuote()->getShippingAddress() - ); - } elseif ((!$quoteCheckoutMethod - || $quoteCheckoutMethod != Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER) - && !Mage::helper('checkout')->isAllowedGuestCheckout( - $this->getQuote(), - $this->getQuote()->getStoreId() - ) - ) { - Mage::getSingleton('core/session')->addNotice( - Mage::helper('hps_securesubmit')->__('To proceed to Checkout, please log in using your email address.') - ); - Mage::getSingleton('customer/session') - ->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_current' => true))); - $result = array( - 'result' => 'error', - 'redirect' => Mage::getUrl('customer/account/login'), - ); - $this->getResponse()->setBody(json_encode($result)); - return; - } - - $pair = $this->getRequest()->getParam('pair'); - $returnUrl = Mage::getUrl('*/*/return'); - if ($pair) { - $returnUrl = Mage::getUrl('*/*/connect'); - } - $cancelUrl = Mage::getUrl('*/*/cancel'); - $response = $helper->start( - $this->getQuote(), - $returnUrl, - $cancelUrl, - $pair - ); - - $this->getSession()->setMasterPassPayload($response->payload); - $this->getSession()->setMasterPassOrderId($response->orderId); - - $result = array( - 'result' => 'success', - 'data' => array( - 'processorTransactionId' => $response->processorTransactionId, - 'returnUrl' => $returnUrl, - 'merchantCheckoutId' => Mage::getStoreConfig('payment/hps_masterpass/merchant_checkout_id'), - ), - ); - - if (null !== $response->processorTransactionIdPairing) { - $result['data']['processorTransactionIdPairing'] = $response->processorTransactionIdPairing; - } - - $walletName = $this->getSession()->getMasterPassWalletName(); - $walletId = $this->getSession()->getMasterPassWalletId(); - $preCheckoutTransactionId = $this->getSession()->getMasterPassPreCheckoutTransactionId(); - if (false !== $preCheckoutTransactionId) { - $result['data']['preCheckoutTransactionId'] = $preCheckoutTransactionId; - } - if (false !== $walletName) { - $result['data']['walletName'] = $walletName; - } - if (false !== $walletId) { - $result['data']['walletId'] = $walletId; - } - } catch (Mage_Core_Exception $e) { - $this->getCheckoutSession()->addError($e->getMessage()); - Mage::log(Mage::helper('hps_securesubmit')->__("Error creating MasterPass session: %s", $e->getMessage()), Zend_Log::WARN); - $result = array( - 'result' => 'error', - 'message' => $e->getMessage(), - 'redirect' => Mage::getUrl('checkout/cart'), - ); - } catch (Exception $e) { - $this->getCheckoutSession()->addError($this->__('Unable to start MasterPass lightbox.')); - Mage::logException($e); - Mage::log(Mage::helper('hps_securesubmit')->__("Error creating MasterPass session: %s", $e->getMessage()), Zend_Log::WARN); - $result = array( - 'result' => 'error', - 'message' => $e->getMessage(), - 'redirect' => Mage::getUrl('checkout/cart'), - ); - } - $this->getResponse() - ->setHeader('Content-Type', 'application/json; charset=utf-8') - ->setBody(json_encode($result)); - return; - } - - public function returnAction() - { - $status = $this->getRequest()->getParam('mpstatus'); - if ($status != 'success') { - $this->_redirect('checkout/cart'); - return; - } - try { - $checkoutResourceUrl = $this->getRequest()->getParam('checkout_resource_url'); - $oauthToken = $this->getRequest()->getParam('oauth_token'); - $oauthVerifier = $this->getRequest()->getParam('oauth_verifier'); - $pairingToken = $this->getRequest()->getParam('pairing_token'); - $pairingVerifier = $this->getRequest()->getParam('pairing_verifier'); - - $helper = Mage::helper('hps_securesubmit/masterpass'); - - $payload = $this->getSession()->getMasterPassPayload(); - $orderId = $this->getSession()->getMasterPassOrderId(); - - $data = $helper->returnFromMasterPass( - $status, - $orderId, - $oauthToken, - $oauthVerifier, - $payload, - $checkoutResourceUrl, - $pairingToken, - $pairingVerifier - ); - - $this->getSession()->setMasterPassAuthenticate($data); - $this->_redirect('*/*/review'); - return; - } catch (Mage_Core_Exception $e) { - $this->getCheckoutSession()->addError($e->getMessage()); - } catch (Exception $e) { - $this->getCheckoutSession()->addError($this->__('Unable to process PayPal Checkout approval.')); - Mage::logException($e); - } - $this->_redirect('checkout/cart'); - } - - public function reviewAction() - { - try { - $helper = Mage::helper('hps_securesubmit/masterpass'); - $helper->prepareOrderReview($this->getQuote()); - $this->loadLayout(); - $reviewBlock = $this->getLayout()->getBlock('hps.securesubmit.masterpass.review'); - $reviewBlock->setQuote($this->getQuote()); - $reviewBlock->getChild('details')->setQuote($this->getQuote()); - if ($reviewBlock->getChild('shipping_method')) { - $reviewBlock->getChild('shipping_method')->setQuote($this->getQuote()); - } - $this->renderLayout(); - return; - } catch (Mage_Core_Exception $e) { - $this->getCheckoutSession()->addError($e->getMessage()); - } catch (Exception $e) { - $this->getCheckoutSession()->addError( - $this->__('Unable to initialize MasterPass order review.') - ); - Mage::logException($e); - } - $this->_redirect('checkout/cart'); - } - - public function saveShippingMethodAction() - { - try { - $isAjax = $this->getRequest()->getParam('isAjax'); - - if (!$this->getQuote()->getIsVirtual() && $shippingAddress = $this->getQuote()->getShippingAddress()) { - if ($this->getRequest()->getParam('shipping_method') != $shippingAddress->getShippingMethod()) { - Mage::helper('hps_securesubmit/masterpass')->ignoreAddressValidation($this->getQuote()); - $shippingAddress->setShippingMethod($this->getRequest()->getParam('shipping_method'))->setCollectShippingRates(true); - $this->getQuote()->collectTotals()->save(); - } - } - - if ($isAjax) { - $this->loadLayout('hps_securesubmit_masterpass_review_details'); - $this->getResponse()->setBody($this->getLayout()->getBlock('root') - ->setQuote($this->getQuote()) - ->toHtml()); - return; - } - } catch (Mage_Core_Exception $e) { - $this->getCheckoutSession()->addError($e->getMessage()); - } catch (Exception $e) { - $this->getCheckoutSession()->addError($this->__('Unable to update shipping method.')); - Mage::logException($e); - } - if ($isAjax) { - $this->getResponse()->setBody(''); - } else { - $this->_redirect('*/*/review'); - } - } - - public function placeOrderAction() - { - try { - $helper = Mage::helper('hps_securesubmit/masterpass'); - $order = $helper->place( - $this->getQuote(), - $this->getSession()->getMasterPassAuthenticate() - ); - - // prepare session to success or cancellation page - $session = $this->getCheckoutSession(); - $session->clearHelperData(); - - // "last successful quote" - $quoteId = $this->getQuote()->getId(); - $session->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId); - - // an order may be created - if ($order) { - $session->setLastOrderId($order->getId()) - ->setLastRealOrderId($order->getIncrementId()); - } - - $this->_redirect('checkout/onepage/success'); - return; - } catch (Mage_Core_Exception $e) { - Mage::log($e->getMessage()); - Mage::helper('checkout')->sendPaymentFailedEmail($this->getQuote(), $e->getMessage()); - $this->getCheckoutSession()->addError($e->getMessage()); - $this->_redirect('*/*/review'); - } catch (Exception $e) { - Mage::log($e->getMessage()); - Mage::helper('checkout')->sendPaymentFailedEmail( - $this->getQuote(), - $this->__('Unable to place the order.') - ); - $this->getCheckoutSession()->addError($this->__('Unable to place the order.')); - Mage::logException($e); - $this->_redirect('*/*/review'); - } - } - - public function connectAction() - { - $forget = $this->getRequest()->getParam('forget_masterpass'); - if ($forget && $forget == 'true') { - $customer = Mage::getModel('customer/customer') - ->load(Mage::getSingleton('customer/session')->getCustomerId()); - $customer->unsMasterpassLongAccessToken(); - $customer->setMasterpassLongAccessToken(''); - $customer->save(); - $this->_redirect('*/*/*'); - return; - } - - $status = $this->getRequest()->getParam('mpstatus'); - if ($status && $status == 'success') { - $pairingToken = $this->getRequest()->getParam('pairing_token'); - $pairingVerifier = $this->getRequest()->getParam('pairing_verifier'); - - $payload = $this->getSession()->getMasterPassPayload(); - $orderId = $this->getSession()->getMasterPassOrderId(); - - try { - $orderData = new HpsOrderData(); - $orderData->transactionStatus = $status; - $orderData->checkoutType = HpsCentinelCheckoutType::PAIRING; - $orderData->pairingToken = $pairingToken; - $orderData->pairingVerifier = $pairingVerifier; - - // Authenticate the request with the information we've gathered - $response = Mage::helper('hps_securesubmit/masterpass')->authenticate( - $orderId, - null, - null, - $payload, - null, - $orderData - ); - - $customer = Mage::getModel('customer/customer') - ->load(Mage::getSingleton('customer/session')->getCustomerId()); - $customer->unsMasterpassLongAccessToken(); - $customer->setMasterpassLongAccessToken($response->longAccessToken); - $customer->save(); - } catch (Exception $e) { Mage::logException($e->getMessage()); } - - $this->_redirect('*/*/*'); - return; - } - - $this->loadLayout(); - $this->getLayout() - ->getBlock('head') - ->setTitle(Mage::helper('hps_securesubmit')->__('MasterPass')); - $this->renderLayout(); - return; - } - - protected function getCheckoutSession() - { - return Mage::getSingleton('checkout/session'); - } - - protected function getSession() - { - return Mage::getSingleton('hps_securesubmit/session'); - } - - protected function getQuote() - { - if (!$this->_quote) { - $this->_quote = $this->getCheckoutSession()->getQuote(); - } - return $this->_quote; - } -} diff --git a/app/code/community/Hps/Securesubmit/etc/adminhtml.xml b/app/code/community/Hps/Securesubmit/etc/adminhtml.xml deleted file mode 100644 index 7912771..0000000 --- a/app/code/community/Hps/Securesubmit/etc/adminhtml.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - Use Saved Card - 110 - - - - - - - - - - - - - HPS PayPal Settlement Reports - - - View - - - Fetch - - - - - - - - - - - - - - - - - - Hps PayPal Settlement Reports - adminhtml/hps_paypal_reports - 100 - - - - - - - diff --git a/app/code/community/Hps/Securesubmit/etc/config.xml b/app/code/community/Hps/Securesubmit/etc/config.xml deleted file mode 100644 index d8dff0c..0000000 --- a/app/code/community/Hps/Securesubmit/etc/config.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - 1.5.0 - - - - - - - Hps_Securesubmit - Hps_Securesubmit_Model_Resource_Setup - - - - - core_write - - - - - core_read - - - - - - Hps_Securesubmit_Model - hps_securesubmit_resource - - - Hps_Securesubmit_Model_Resource - - - storedcard
-
- - report_settlement
-
-
-
-
- - - Hps_Securesubmit_Helper - - - - - Hps_Securesubmit_Block - - - - - - * - - - -
- - - - hps_securesubmit/payment - authorize_capture - Credit Card (SecureSubmit) - AE,VI,MC,DI,JCB - 1 - - - - 3 - 10 - 0 - 0 - - - hps_securesubmit/masterpass - authorize_capture - MasterPass - - - - - 0 - 0 - - - - - - /securesubmit/ - - - - - securesubmit.xml - - - - - - standard - - Hps_Securesubmit - securesubmit - - - - - - - /securesubmit/ - - - - - securesubmit.xml - - - - - - standard - - Hps_Securesubmit - securesubmit - - - - - - - - - - Hps_Securesubmit_Adminhtml - - - - - -
diff --git a/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/mysql4-upgrade-1.0.0-1.0.1.php b/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/mysql4-upgrade-1.0.0-1.0.1.php deleted file mode 100755 index 6ace885..0000000 --- a/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/mysql4-upgrade-1.0.0-1.0.1.php +++ /dev/null @@ -1,13 +0,0 @@ -startSetup(); - -/* - * Add 'use_stored_card' column to 'sales_flat_quote_payment' and 'sales_flat_order_payment' tables. - */ - -$installer->getConnection()->addColumn($installer->getTable('sales/quote_payment'), 'securesubmit_use_stored_card', 'TINYINT UNSIGNED DEFAULT NULL'); -$installer->getConnection()->addColumn($installer->getTable('sales/order_payment'), 'securesubmit_use_stored_card', 'TINYINT UNSIGNED DEFAULT NULL'); - -$installer->endSetup(); diff --git a/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/mysql4-upgrade-1.0.1-1.1.0.php b/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/mysql4-upgrade-1.0.1-1.1.0.php deleted file mode 100644 index 0587c58..0000000 --- a/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/mysql4-upgrade-1.0.1-1.1.0.php +++ /dev/null @@ -1,24 +0,0 @@ -startSetup(); - -$installer->run(" - --- DROP TABLE IF EXISTS {$this->getTable('hps_securesubmit/report')}; -CREATE TABLE {$this->getTable('hps_securesubmit/report')} ( - `row_id` int(11) unsigned NOT NULL auto_increment, - `payer_email` varchar(255) NOT NULL default '', - `order_id` varchar(255) NOT NULL default '', - `invoice_id` varchar(255) NOT NULL default '', - `transaction_id` varchar(255) NOT NULL default '', - `last_known_status` varchar(255) NOT NULL default '', - `created_time` datetime NULL, - `update_time` datetime NULL, - PRIMARY KEY (`row_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - "); - -$installer->endSetup(); \ No newline at end of file diff --git a/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/mysql4-upgrade-1.1.0-1.2.0.php b/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/mysql4-upgrade-1.1.0-1.2.0.php deleted file mode 100644 index 2f18629..0000000 --- a/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/mysql4-upgrade-1.1.0-1.2.0.php +++ /dev/null @@ -1,37 +0,0 @@ -startSetup(); - -$setup = new Mage_Eav_Model_Entity_Setup('core_setup'); - -$entityTypeId = $setup->getEntityTypeId('customer'); -$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId); -$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); - -$installer->addAttribute('customer', 'masterpass_long_access_token', array( - 'type' => 'varchar', - 'backend' => '', - 'label' => 'MasterPass Long Access Token', - 'input' => 'text', - 'source' => '', - 'visible' => false, - 'required' => false, - 'default' => '', - 'frontend' => '', - 'unique' => true, - 'note' => 'MasterPass Long Access Token' -)); - -$attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'masterpass_long_access_token'); - - -$setup->addAttributeToGroup( - $entityTypeId, - $attributeSetId, - $attributeGroupId, - 'masterpass_long_access_token', - '999' //sort_order -); - -$installer->endSetup(); diff --git a/app/code/community/Hps/Securesubmit/Block/Adminhtml/Form.php b/app/code/community/Hps/Transit/Block/Adminhtml/Form.php similarity index 76% rename from app/code/community/Hps/Securesubmit/Block/Adminhtml/Form.php rename to app/code/community/Hps/Transit/Block/Adminhtml/Form.php index 4ac0c7c..f013e4e 100644 --- a/app/code/community/Hps/Securesubmit/Block/Adminhtml/Form.php +++ b/app/code/community/Hps/Transit/Block/Adminhtml/Form.php @@ -1,10 +1,10 @@ getCustomerId()) { return array(); } - return Mage::helper('hps_securesubmit')->getStoredCards($customerId); + return Mage::helper('hps_transit')->getStoredCards($customerId); } /** @@ -33,7 +33,7 @@ public function getJsConfig() return $config; } - foreach ($collection as $card) { /** @var $card Hps_Securesubmit_Model_Storedcard */ + foreach ($collection as $card) { /** @var $card Hps_Transit_Model_Storedcard */ $config[$card->getId()] = array( 'cc_exp_month' => $card->getCcExpMonth(), 'cc_exp_year' => $card->getCcExpYear(), diff --git a/app/code/community/Hps/Securesubmit/Block/Form.php b/app/code/community/Hps/Transit/Block/Form.php similarity index 78% rename from app/code/community/Hps/Securesubmit/Block/Form.php rename to app/code/community/Hps/Transit/Block/Form.php index 2adb3ec..6747b64 100644 --- a/app/code/community/Hps/Securesubmit/Block/Form.php +++ b/app/code/community/Hps/Transit/Block/Form.php @@ -1,19 +1,19 @@ setTemplate('securesubmit/form.phtml'); + $this->setTemplate('transit/form.phtml'); } public function getCca() @@ -26,7 +26,7 @@ public function getCca() return $this->cca; } - $helper = Mage::helper('hps_securesubmit/jwt'); + $helper = Mage::helper('hps_transit/jwt'); $orderNumber = str_shuffle('abcdefghijklmnopqrstuvwxyz'); $data = array( 'jti' => str_shuffle('abcdefghijklmnopqrstuvwxyz'), @@ -59,6 +59,6 @@ public function getCca() protected function getConfig($key) { - return Mage::getStoreConfig(sprintf('payment/hps_securesubmit/%s', $key)); + return Mage::getStoreConfig(sprintf('payment/hps_transit/%s', $key)); } } diff --git a/app/code/community/Hps/Securesubmit/Block/Info.php b/app/code/community/Hps/Transit/Block/Info.php similarity index 91% rename from app/code/community/Hps/Securesubmit/Block/Info.php rename to app/code/community/Hps/Transit/Block/Info.php index 1da1a7f..1569ab8 100644 --- a/app/code/community/Hps/Securesubmit/Block/Info.php +++ b/app/code/community/Hps/Transit/Block/Info.php @@ -1,12 +1,12 @@ addFieldToFilter('customer_id', $customerId); return $cardCollection; } @@ -28,7 +28,7 @@ public function getStoredCards($customerId) * @param HpsCreditCard $cardData * @param string $cardType * @param integer|null $customerId - * @return Hps_Securesubmit_Model_Storedcard + * @return Hps_Transit_Model_Storedcard */ public function saveMultiToken($token,$cardData,$cardType, $customerId = null) { @@ -41,7 +41,7 @@ public function saveMultiToken($token,$cardData,$cardType, $customerId = null) }else{ $_customerId = $customerId; } - $storedCard = Mage::getModel('hps_securesubmit/storedcard'); + $storedCard = Mage::getModel('hps_transit/storedcard'); $storedCard->setDt(Varien_Date::now()) ->setCustomerId($_customerId) ->setTokenValue($token) diff --git a/app/code/community/Hps/Securesubmit/Model/Payment.php b/app/code/community/Hps/Transit/Model/Payment.php similarity index 93% rename from app/code/community/Hps/Securesubmit/Model/Payment.php rename to app/code/community/Hps/Transit/Model/Payment.php index 462cc19..84c84bc 100644 --- a/app/code/community/Hps/Securesubmit/Model/Payment.php +++ b/app/code/community/Hps/Transit/Model/Payment.php @@ -1,19 +1,18 @@ getInfoInstance(); $additionalData = new Varien_Object($info->getAdditionalData() ? unserialize($info->getAdditionalData()) : null); - $secureToken = $additionalData->getSecuresubmitToken() ? $additionalData->getSecuresubmitToken() : null; + $secureToken = $additionalData->getTransitToken() ? $additionalData->getTransitToken() : null; // Gracefully handle javascript errors. $currentUrl = Mage::helper('core/url')->getCurrentUrl(); $link_path = explode('/', rtrim($currentUrl, '/')); @@ -54,7 +53,7 @@ public function validate() if ((!$secureToken) && ($path != 'savePaymentMethod')) { Mage::log('Payment information submitted without token.', Zend_Log::ERR); - $this->throwUserError(Mage::helper('hps_securesubmit')->__('An unexpected error occurred. Please try resubmitting your payment information.'), null, true); + $this->throwUserError(Mage::helper('hps_transit')->__('An unexpected error occurred. Please try resubmitting your payment information.'), null, true); } return $this; } @@ -99,7 +98,7 @@ private function _authorize(Varien_Object $payment, $amount, $capture) $multiToken = false; $cardData = null; $additionalData = new Varien_Object($payment->getAdditionalData() ? unserialize($payment->getAdditionalData()) : null); - $secureToken = $additionalData->getSecuresubmitToken() ? $additionalData->getSecuresubmitToken() : null; + $secureToken = $additionalData->getTransitToken() ? $additionalData->getTransitToken() : null; $saveCreditCard = !! (bool)$additionalData->getCcSaveFuture(); $customerId = $additionalData->getCustomerId(); $giftService = $this->_getGiftService(); @@ -135,7 +134,7 @@ private function _authorize(Varien_Object $payment, $amount, $capture) // just adds a trackable type for the DB $giftresp->cardType = 'Gift'; - // \Hps_Securesubmit_Model_Payment::closeTransaction + // \Hps_Transit_Model_Payment::closeTransaction $this->closeTransaction($payment,$amount,$giftresp); return $this; } catch (Exception $e) { @@ -223,7 +222,7 @@ private function _authorize(Varien_Object $payment, $amount, $capture) $response = $builder->execute(); $this->_debugChargeService($chargeService); - // \Hps_Securesubmit_Model_Payment::closeTransaction + // \Hps_Transit_Model_Payment::closeTransaction $this->closeTransaction($payment, $amount, $response); if ($giftCardNumber) { @@ -331,9 +330,9 @@ protected function saveMultiUseToken($response, $cardData, $customerId, $cardTyp } if ($customerId > 0) { - Mage::helper('hps_securesubmit')->saveMultiToken($tokenData->tokenValue, $cardData, $cardType, $customerId); + Mage::helper('hps_transit')->saveMultiToken($tokenData->tokenValue, $cardData, $cardType, $customerId); } else { - Mage::helper('hps_securesubmit')->saveMultiToken($tokenData->tokenValue, $cardData, $cardType); + Mage::helper('hps_transit')->saveMultiToken($tokenData->tokenValue, $cardData, $cardType); } } else { Mage::log('Requested multi token has not been generated for the transaction # ' . $response->transactionId, Zend_Log::WARN); @@ -389,13 +388,13 @@ protected function _formatAmount($amount) protected function getFraudSettings() { if ($this->_enable_anti_fraud === null) { - $this->_enable_anti_fraud = Mage::getStoreConfig('payment/hps_securesubmit/enable_anti_fraud') == 1; - $this->_allow_fraud = Mage::getStoreConfig('payment/hps_securesubmit/allow_fraud') == 1; - $this->_email_fraud = Mage::getStoreConfig('payment/hps_securesubmit/email_fraud') == 1; - $this->_fraud_address = (string)Mage::getStoreConfig('payment/hps_securesubmit/fraud_address'); - $this->_fraud_text = (string)Mage::getStoreConfig('payment/hps_securesubmit/fraud_text'); - $this->_fraud_velocity_attempts = (int)Mage::getStoreConfig('payment/hps_securesubmit/fraud_velocity_attempts'); - $this->_fraud_velocity_timeout = (int)Mage::getStoreConfig('payment/hps_securesubmit/fraud_velocity_timeout'); + $this->_enable_anti_fraud = Mage::getStoreConfig('payment/hps_transit/enable_anti_fraud') == 1; + $this->_allow_fraud = Mage::getStoreConfig('payment/hps_transit/allow_fraud') == 1; + $this->_email_fraud = Mage::getStoreConfig('payment/hps_transit/email_fraud') == 1; + $this->_fraud_address = (string)Mage::getStoreConfig('payment/hps_transit/fraud_address'); + $this->_fraud_text = (string)Mage::getStoreConfig('payment/hps_transit/fraud_text'); + $this->_fraud_velocity_attempts = (int)Mage::getStoreConfig('payment/hps_transit/fraud_velocity_attempts'); + $this->_fraud_velocity_timeout = (int)Mage::getStoreConfig('payment/hps_transit/fraud_velocity_timeout'); if ($this->_fraud_text === null) { $this->_fraud_text = self::FRAUD_TEXT_DEFAULT; @@ -516,7 +515,7 @@ protected function getRemoteIP() /** * @param Varien_Object|Mage_Sales_Model_Order_Payment $payment * @param float $amount - * @return Hps_Securesubmit_Model_Payment + * @return Hps_Transit_Model_Payment */ public function refund(Varien_Object $payment, $amount) { @@ -582,7 +581,7 @@ public function getParentTransactionId(Varien_Object $payment) * * @param Varien_Object $payment * - * @return Hps_Securesubmit_Model_Payment + * @return Hps_Transit_Model_Payment */ public function void(Varien_Object $payment) { @@ -611,7 +610,7 @@ public function void(Varien_Object $payment) } catch (Exception $e) { $this->_debugChargeService($chargeService, $e); Mage::logException($e); - $this->throwUserError(Mage::helper('hps_securesubmit')->__('An unexpected error occurred. Please try again or contact a system administrator.')); + $this->throwUserError(Mage::helper('hps_transit')->__('An unexpected error occurred. Please try again or contact a system administrator.')); } return $this; @@ -620,7 +619,7 @@ public function void(Varien_Object $payment) /** * @param Varien_Object|Mage_Sales_Model_Order_Payment $payment * @param $amount - * @return Hps_Securesubmit_Model_Payment + * @return Hps_Transit_Model_Payment */ public function _refund(Varien_Object $payment, $amount) { @@ -660,7 +659,7 @@ public function _refund(Varien_Object $payment, $amount) * @param Varien_Object|Mage_Sales_Model_Order_Payment $payment * @param HpsReportTransactionDetails $transactionDetails * @param float $newAuthAmount - * @return Hps_Securesubmit_Model_Payment + * @return Hps_Transit_Model_Payment */ public function _reversal(Varien_Object $payment, HpsReportTransactionDetails $transactionDetails, $newAuthAmount) { @@ -743,8 +742,8 @@ public function assignData($data) $details['cc_save_future'] = 1; } - if ($data->getData('securesubmit_token')) { - $details['securesubmit_token'] = $data->getData('securesubmit_token'); + if ($data->getData('transit_token')) { + $details['transit_token'] = $data->getData('transit_token'); } if ($data->getData('giftcard_number')) { @@ -814,7 +813,7 @@ public function throwUserError($error, $detailedError = null, $goToPaymentSectio Mage::register('payment_detailed_error', $detailedError); // Replace gateway error with custom error message for customers - $error = Mage::helper('hps_securesubmit')->__($error); + $error = Mage::helper('hps_transit')->__($error); if ($customMessage = $this->getConfigData('custom_message')) { $error = sprintf($customMessage, $error); } @@ -837,11 +836,11 @@ protected function _getChargeService() $config = new HpsServicesConfig(); // Support HTTP proxy - if (Mage::getStoreConfig('payment/hps_securesubmit/use_http_proxy')) { + if (Mage::getStoreConfig('payment/hps_transit/use_http_proxy')) { $config->useProxy = true; $config->proxyOptions = array( - 'proxy_host' => Mage::getStoreConfig('payment/hps_securesubmit/http_proxy_host'), - 'proxy_port' => Mage::getStoreConfig('payment/hps_securesubmit/http_proxy_port'), + 'proxy_host' => Mage::getStoreConfig('payment/hps_transit/http_proxy_host'), + 'proxy_port' => Mage::getStoreConfig('payment/hps_transit/http_proxy_port'), ); } @@ -857,11 +856,11 @@ protected function _getGiftService() $config = new HpsServicesConfig(); // Support HTTP proxy - if (Mage::getStoreConfig('payment/hps_securesubmit/use_http_proxy')) { + if (Mage::getStoreConfig('payment/hps_transit/use_http_proxy')) { $config->useProxy = true; $config->proxyOptions = array( - 'proxy_host' => Mage::getStoreConfig('payment/hps_securesubmit/http_proxy_host'), - 'proxy_port' => Mage::getStoreConfig('payment/hps_securesubmit/http_proxy_port'), + 'proxy_host' => Mage::getStoreConfig('payment/hps_transit/http_proxy_host'), + 'proxy_port' => Mage::getStoreConfig('payment/hps_transit/http_proxy_port'), ); } diff --git a/app/code/community/Hps/Securesubmit/Model/Report.php b/app/code/community/Hps/Transit/Model/Report.php similarity index 71% rename from app/code/community/Hps/Securesubmit/Model/Report.php rename to app/code/community/Hps/Transit/Model/Report.php index bec3337..8d0e4f4 100644 --- a/app/code/community/Hps/Securesubmit/Model/Report.php +++ b/app/code/community/Hps/Transit/Model/Report.php @@ -1,11 +1,11 @@ _init('hps_securesubmit/report'); + $this->_init('hps_transit/report'); } public function loadByOrderId($orderId) diff --git a/app/code/community/Hps/Transit/Model/Resource/Setup.php b/app/code/community/Hps/Transit/Model/Resource/Setup.php new file mode 100644 index 0000000..22ae545 --- /dev/null +++ b/app/code/community/Hps/Transit/Model/Resource/Setup.php @@ -0,0 +1,11 @@ +_init('hps_securesubmit/storedcard', 'storedcard_id'); + $this->_init('hps_transit/storedcard', 'storedcard_id'); } - public function removeDuplicates(Hps_Securesubmit_Model_Storedcard $storedcard) + public function removeDuplicates(Hps_Transit_Model_Storedcard $storedcard) { $this->_getWriteAdapter()->delete($this->getMainTable(), array( 'customer_id = ?' => $storedcard->getCustomerId(), diff --git a/app/code/community/Hps/Transit/Model/Resource/Storedcard/Collection.php b/app/code/community/Hps/Transit/Model/Resource/Storedcard/Collection.php new file mode 100644 index 0000000..a238073 --- /dev/null +++ b/app/code/community/Hps/Transit/Model/Resource/Storedcard/Collection.php @@ -0,0 +1,14 @@ +_init('hps_transit/storedcard'); + } +} diff --git a/app/code/community/Hps/Securesubmit/Model/Session.php b/app/code/community/Hps/Transit/Model/Session.php similarity index 52% rename from app/code/community/Hps/Securesubmit/Model/Session.php rename to app/code/community/Hps/Transit/Model/Session.php index 095615f..ac9e7a9 100755 --- a/app/code/community/Hps/Securesubmit/Model/Session.php +++ b/app/code/community/Hps/Transit/Model/Session.php @@ -1,9 +1,9 @@ */ -class Hps_Securesubmit_Model_Session extends Mage_Core_Model_Session_Abstract +class Hps_Transit_Model_Session extends Mage_Core_Model_Session_Abstract { public function __construct() { - $this->init('hps_securesubmit'); + $this->init('hps_transit'); } } diff --git a/app/code/community/Hps/Transit/Model/Source/Cctype.php b/app/code/community/Hps/Transit/Model/Source/Cctype.php new file mode 100644 index 0000000..4715d39 --- /dev/null +++ b/app/code/community/Hps/Transit/Model/Source/Cctype.php @@ -0,0 +1,13 @@ +_init('hps_transit/storedcard'); + } + + public function removeDuplicates() + { + $this->getResource()->removeDuplicates($this); + return $this; + } + +} diff --git a/app/code/community/Hps/Securesubmit/Model/System/Config/Backend/Proxy.php b/app/code/community/Hps/Transit/Model/System/Config/Backend/Proxy.php similarity index 51% rename from app/code/community/Hps/Securesubmit/Model/System/Config/Backend/Proxy.php rename to app/code/community/Hps/Transit/Model/System/Config/Backend/Proxy.php index 73bef4f..f33cf76 100644 --- a/app/code/community/Hps/Securesubmit/Model/System/Config/Backend/Proxy.php +++ b/app/code/community/Hps/Transit/Model/System/Config/Backend/Proxy.php @@ -1,23 +1,23 @@ getFieldsetDataValue('use_http_proxy')) { $httpProxyHost = $this->getFieldsetDataValue('http_proxy_host'); if (empty($httpProxyHost)) { - Mage::throwException(Mage::helper('hps_securesubmit')->__('HTTP Proxy Host is required for using proxy.')); + Mage::throwException(Mage::helper('hps_transit')->__('HTTP Proxy Host is required for using proxy.')); } $httpProxyPort = $this->getFieldsetDataValue('http_proxy_port'); if (empty($httpProxyPort)) { - Mage::throwException(Mage::helper('hps_securesubmit')->__('HTTP Proxy Port is required for using proxy.')); + Mage::throwException(Mage::helper('hps_transit')->__('HTTP Proxy Port is required for using proxy.')); } } } diff --git a/app/code/community/Hps/Securesubmit/controllers/Adminhtml/StoredcardController.php b/app/code/community/Hps/Transit/controllers/Adminhtml/StoredcardController.php similarity index 89% rename from app/code/community/Hps/Securesubmit/controllers/Adminhtml/StoredcardController.php rename to app/code/community/Hps/Transit/controllers/Adminhtml/StoredcardController.php index 7b71f6c..20df274 100644 --- a/app/code/community/Hps/Securesubmit/controllers/Adminhtml/StoredcardController.php +++ b/app/code/community/Hps/Transit/controllers/Adminhtml/StoredcardController.php @@ -1,6 +1,6 @@ load($this->getRequest()->getParam('storedcard_id')); $customerId = $this->getRequest()->getParam('customer_id'); if ( ! $storedCard->getId() || $storedCard->getCustomerId() != $customerId) { diff --git a/app/code/community/Hps/Securesubmit/controllers/StoredcardController.php b/app/code/community/Hps/Transit/controllers/StoredcardController.php similarity index 88% rename from app/code/community/Hps/Securesubmit/controllers/StoredcardController.php rename to app/code/community/Hps/Transit/controllers/StoredcardController.php index ea21fcc..bd144e1 100644 --- a/app/code/community/Hps/Securesubmit/controllers/StoredcardController.php +++ b/app/code/community/Hps/Transit/controllers/StoredcardController.php @@ -1,13 +1,12 @@ load($this->getRequest()->getParam('storedcard_id')); if ( ! $storedCard->getId()) { throw new Mage_Core_Exception($this->__('Stored card no longer exists.')); @@ -60,7 +59,7 @@ public function deleteAction() public function getTokenDataAction() { try { - $storedCard = Mage::getModel('hps_securesubmit/storedcard'); + $storedCard = Mage::getModel('hps_transit/storedcard'); $storedCard->load($this->getRequest()->getParam('storedcard_id')); if (!$storedCard->getId() || $storedCard->getCustomerId() != Mage::getSingleton('customer/session')->getCustomerId()) { throw new Mage_Core_Exception($this->__('Stored card no longer exists.')); @@ -98,7 +97,7 @@ public function getBalanceAction() $config = new HpsServicesConfig(); - $config->secretApiKey = Mage::getModel('hps_securesubmit/payment')->getConfigData('secretapikey'); + $config->secretApiKey = Mage::getModel('hps_transit/payment')->getConfigData('secretapikey'); $config->versionNumber = '1573'; $config->developerId = '002914'; diff --git a/app/code/community/Hps/Transit/etc/adminhtml.xml b/app/code/community/Hps/Transit/etc/adminhtml.xml new file mode 100644 index 0000000..eccd535 --- /dev/null +++ b/app/code/community/Hps/Transit/etc/adminhtml.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + Use Saved Card + 110 + + + + + + + + + + + + diff --git a/app/code/community/Hps/Transit/etc/config.xml b/app/code/community/Hps/Transit/etc/config.xml new file mode 100644 index 0000000..ee96200 --- /dev/null +++ b/app/code/community/Hps/Transit/etc/config.xml @@ -0,0 +1,133 @@ + + + + + 1.0.0 + + + + + + + Hps_Transit + Hps_Transit_Model_Resource_Setup + + + + + core_write + + + + + core_read + + + + + + Hps_Transit_Model + hps_transit_resource + + + Hps_Transit_Model_Resource + + + storedcard
+
+ + report_settlement
+
+
+
+
+ + + Hps_Transit_Helper + + + + + Hps_Transit_Block + + + + + + * + + + +
+ + + + hps_transit/payment + authorize_capture + Credit Card + AE,VI,MC,DI,JCB + 1 + + + + 3 + 10 + 0 + 0 + + + + + + /transit/ + + + + + transit.xml + + + + + + standard + + Hps_Transit + transit + + + + + + + /transit/ + + + + + transit.xml + + + + + + standard + + Hps_Transit + transit + + + + + + + + + + Hps_Transit_Adminhtml + + + + + +
diff --git a/app/code/community/Hps/Securesubmit/etc/system.xml b/app/code/community/Hps/Transit/etc/system.xml similarity index 56% rename from app/code/community/Hps/Securesubmit/etc/system.xml rename to app/code/community/Hps/Transit/etc/system.xml index ad77409..42b3c9c 100644 --- a/app/code/community/Hps/Securesubmit/etc/system.xml +++ b/app/code/community/Hps/Transit/etc/system.xml @@ -3,14 +3,14 @@ - - + + text 20 1 1 1 - Click here to sign up for SecureSubmit account]]> + Click here to sign up for TransIT account]]> @@ -61,7 +61,7 @@ multiselect - hps_securesubmit/source_cctype + hps_transit/source_cctype 20 1 1 @@ -70,7 +70,7 @@ select - hps_securesubmit/source_paymentAction + hps_transit/source_paymentAction 21 1 1 @@ -99,57 +99,6 @@ 1 - - - - select - adminhtml/system_config_source_yesno - 35 - 1 - 1 - 1 - - - - - text - 36 - 1 - 1 - 1 - 1 - - - - text - 37 - 1 - 1 - 1 - 1 - - - - text - 38 - 1 - 1 - 1 - 1 - - - - - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - 1 - - - @@ -247,7 +196,7 @@ select adminhtml/system_config_source_yesno - hps_securesubmit/system_config_backend_proxy + hps_transit/system_config_backend_proxy 100 1 1 @@ -284,124 +233,7 @@ 0 - - - - text - 20 - 1 - 1 - 1 - Click here to sign up for SecureSubmit account]]> - - - - select - adminhtml/system_config_source_yesno - 10 - 1 - 1 - 0 - - - - select - adminhtml/system_config_source_order_status_processing - 4 - 1 - 1 - 0 - - - <label>Title</label> - <frontend_type>text</frontend_type> - <sort_order>20</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - adminhtml/system_config_backend_encrypted - 30 - 1 - 1 - 1 - - - - adminhtml/system_config_backend_encrypted - 31 - 1 - 1 - 1 - - - - obscure - adminhtml/system_config_backend_encrypted - 32 - 1 - 1 - 1 - - - - adminhtml/system_config_backend_encrypted - 33 - 1 - 1 - 1 - - - - select - adminhtml/system_config_source_yesno - 25 - 1 - 1 - 1 - - - - select - hps_securesubmit/source_paymentAction - 60 - 1 - 1 - 0 - - - - textarea - 65 - 1 - 1 - 1 - will be displayed as: My message. Original Secure Submit message.]]> - - - - - text - 70 - 1 - 1 - 0 - - - - select - adminhtml/system_config_source_yesno - 110 - 1 - 1 - 0 - - - + diff --git a/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/install-1.0.0.php b/app/code/community/Hps/Transit/sql/hps_transit_setup/install-1.0.0.php similarity index 73% rename from app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/install-1.0.0.php rename to app/code/community/Hps/Transit/sql/hps_transit_setup/install-1.0.0.php index bb54f5f..11cd88b 100644 --- a/app/code/community/Hps/Securesubmit/sql/hps_securesubmit_setup/install-1.0.0.php +++ b/app/code/community/Hps/Transit/sql/hps_transit_setup/install-1.0.0.php @@ -1,16 +1,16 @@ startSetup(); $table = $installer->getConnection() - ->newTable($installer->getTable('hps_securesubmit/storedcard')) + ->newTable($installer->getTable('hps_transit/storedcard')) ->addColumn( 'storedcard_id', Varien_Db_Ddl_Table::TYPE_INTEGER, @@ -60,7 +60,7 @@ ) ->addForeignKey( $installer->getFkName( - 'hps_securesubmit/storedcard', + 'hps_transit/storedcard', 'customer_id', 'customer/entity', 'entity_id'), @@ -73,4 +73,12 @@ ); $installer->getConnection()->createTable($table); + +/* + * Add 'use_stored_card' column to 'sales_flat_quote_payment' and 'sales_flat_order_payment' tables. + */ + +$installer->getConnection()->addColumn($installer->getTable('sales/quote_payment'), 'transit_use_stored_card', 'TINYINT UNSIGNED DEFAULT NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order_payment'), 'transit_use_stored_card', 'TINYINT UNSIGNED DEFAULT NULL'); + $installer->endSetup(); diff --git a/app/design/adminhtml/default/default/layout/securesubmit.xml b/app/design/adminhtml/default/default/layout/transit.xml similarity index 71% rename from app/design/adminhtml/default/default/layout/securesubmit.xml rename to app/design/adminhtml/default/default/layout/transit.xml index 5b16c6d..dd1b9a3 100644 --- a/app/design/adminhtml/default/default/layout/securesubmit.xml +++ b/app/design/adminhtml/default/default/layout/transit.xml @@ -3,10 +3,10 @@ - securesubmit/secure.submit-1.0.1.js + transit/secure.submit-1.0.1.js - securesubmit/admin-checkout.js + transit/admin-checkout.js diff --git a/app/design/adminhtml/default/default/template/securesubmit/form.phtml b/app/design/adminhtml/default/default/template/transit/form.phtml similarity index 91% rename from app/design/adminhtml/default/default/template/securesubmit/form.phtml rename to app/design/adminhtml/default/default/template/transit/form.phtml index 08992f1..284a25c 100644 --- a/app/design/adminhtml/default/default/template/securesubmit/form.phtml +++ b/app/design/adminhtml/default/default/template/transit/form.phtml @@ -1,13 +1,13 @@ -getMethodCode(); $store = Mage::getSingleton('adminhtml/session_quote')->getStore(); $storeId = ($store) ? $store->getId() : NULL; $customerStoredCards = $this->getCustomerStoredCards(); -$useStoredCard = !! $this->getInfoData('securesubmit_use_stored_card'); -$public_key = Mage::getModel('hps_securesubmit/payment')->getConfigData('publicapikey', $storeId); +$useStoredCard = !! $this->getInfoData('transit_use_stored_card'); +$public_key = Mage::getModel('hps_transit/payment')->getConfigData('publicapikey', $storeId); $customerId = Mage::getSingleton('adminhtml/session_quote')->getCustomerId(); -// $customerStoredCards = Mage::helper('hps_securesubmit')->getStoredCards( $customerId ); -$allow_card_saving = Mage::getModel('hps_securesubmit/payment')->getConfigData('allow_card_saving', $storeId); +// $customerStoredCards = Mage::helper('hps_transit')->getStoredCards( $customerId ); +$allow_card_saving = Mage::getModel('hps_transit/payment')->getConfigData('allow_card_saving', $storeId); ?> @@ -16,7 +16,7 @@ $allow_card_saving = Mage::getModel('hps_securesubmit/payment')->getConfigData('
  • - checked="checked" value="1" /> + checked="checked" value="1" />
  • @@ -91,7 +91,7 @@ $allow_card_saving = Mage::getModel('hps_securesubmit/payment')->getConfigData(' //'; - order.secureSubmitGetTokenDataUrl = ' TRUE)) ?>'; + order.secureSubmitGetTokenDataUrl = ' TRUE)) ?>'; order.customerStoredCards = getJsConfig()) ?>; diff --git a/app/design/frontend/base/default/layout/securesubmit.xml b/app/design/frontend/base/default/layout/securesubmit.xml deleted file mode 100644 index db917a3..0000000 --- a/app/design/frontend/base/default/layout/securesubmit.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - skin_css - securesubmit/css/hps-styles.css - - - - - - - - - - - ]]> - - - - securesubmit/checkout-form.js - securesubmit/masterpass/lightbox.js - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - save_token - securesubmit/storedcard/index - - - - masterpass_connect - securesubmit/masterpass/connect - - - - - - - - - - - - - - - - - - - - securesubmit/masterpass/lightbox.js - - - - - - - - - - - - - - - - - - - defaultcheckout/cart_item_renderer - groupedcheckout/cart_item_renderer_grouped - configurablecheckout/cart_item_renderer_configurable - - - - - - - skin_jsjs/checkout/review.js - - - - - - - defaultcheckout/cart_item_renderer - groupedcheckout/cart_item_renderer_grouped - configurablecheckout/cart_item_renderer_configurable - - - - diff --git a/app/design/frontend/base/default/layout/transit.xml b/app/design/frontend/base/default/layout/transit.xml new file mode 100644 index 0000000..139e489 --- /dev/null +++ b/app/design/frontend/base/default/layout/transit.xml @@ -0,0 +1,134 @@ + + + + + + + skin_css + transit/css/hps-styles.css + + + + + + + + + + + ]]> + + + + transit/checkout-form.js + transit/masterpass/lightbox.js + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + save_token + transit/storedcard/index + + + + masterpass_connect + transit/masterpass/connect + + + + + + + + + + + + + + + + + + + + transit/masterpass/lightbox.js + + + + + + + + + + + + + + + + + + + defaultcheckout/cart_item_renderer + groupedcheckout/cart_item_renderer_grouped + configurablecheckout/cart_item_renderer_configurable + + + + + + + skin_jsjs/checkout/review.js + + + + + + + defaultcheckout/cart_item_renderer + groupedcheckout/cart_item_renderer_grouped + configurablecheckout/cart_item_renderer_configurable + + + + diff --git a/app/design/frontend/base/default/template/securesubmit/masterpass/connect.phtml b/app/design/frontend/base/default/template/securesubmit/masterpass/connect.phtml deleted file mode 100644 index 4780983..0000000 --- a/app/design/frontend/base/default/template/securesubmit/masterpass/connect.phtml +++ /dev/null @@ -1,23 +0,0 @@ -

    __('MasterPass') ?>

    -
    -
    -

    __('Connect with MasterPass') ?>

    -
    -
    - getLongAccessToken(); ?> - -
    - - -
    - - - -
    -
    diff --git a/app/design/frontend/base/default/template/securesubmit/masterpass/form.phtml b/app/design/frontend/base/default/template/securesubmit/masterpass/form.phtml deleted file mode 100644 index 55d5e8f..0000000 --- a/app/design/frontend/base/default/template/securesubmit/masterpass/form.phtml +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/app/design/frontend/base/default/template/securesubmit/masterpass/js.phtml b/app/design/frontend/base/default/template/securesubmit/masterpass/js.phtml deleted file mode 100644 index d8bea67..0000000 --- a/app/design/frontend/base/default/template/securesubmit/masterpass/js.phtml +++ /dev/null @@ -1,5 +0,0 @@ -isSandbox()): ?> - - - - diff --git a/app/design/frontend/base/default/template/securesubmit/masterpass/mark.phtml b/app/design/frontend/base/default/template/securesubmit/masterpass/mark.phtml deleted file mode 100644 index 6870e28..0000000 --- a/app/design/frontend/base/default/template/securesubmit/masterpass/mark.phtml +++ /dev/null @@ -1,4 +0,0 @@ -<?php echo Mage::helper('core')->quoteEscape(Mage::helper('hps_securesubmit')->__('Acceptance Mark')) ?>  - - __('Learn more'); ?> - diff --git a/app/design/frontend/base/default/template/securesubmit/masterpass/review.phtml b/app/design/frontend/base/default/template/securesubmit/masterpass/review.phtml deleted file mode 100644 index 8ed2840..0000000 --- a/app/design/frontend/base/default/template/securesubmit/masterpass/review.phtml +++ /dev/null @@ -1,177 +0,0 @@ - -
    -

    __('Review Order') ?>

    -
    -getMessagesBlock()->toHtml() ?> -getShippingAddress()): ?> -
    -

    __('Shipping Information') ?>

    -
    -
    -
    -

    __('Shipping Address') ?>getCanEditShippingAddress()):?> | __('Edit') ?>

    -
    -
    -
    renderAddress($this->getShippingAddress())?>
    -
    -
    -
    -
    -
    -
    -

    __('Shipping Method') ?>

    -
    -
    -
    - getCanEditShippingMethod() || !$this->getCurrentShippingRate()):?> - getShippingRateGroups()):?> - getCurrentShippingRate(); ?> -
    - -
    -

    - -

    - -

    __('Sorry, no quotes are available for this order at this time.') ?>

    - - -

    renderShippingRateOption($this->getCurrentShippingRate())?>

    - -
    -
    -
    -
    -
    - - -
    -

    __('Billing Information') ?>

    -
    -
    -
    -

    __('Payment Method') ?> | - getEditUrl()):?>__('Edit Payment Information') ?> -

    -
    -
    - escapeHtml($this->getPaymentMethodTitle()) ?> -
    -
    -
    -
    - -
    -

    __('Items in Your Shopping Cart') ?> | __('Edit Shopping Cart') ?>

    -
    - getChildHtml('details') ?> -
    -
    -
    - getChildHtml('agreements'); ?> -
    - - - -
    -
    - diff --git a/app/design/frontend/base/default/template/securesubmit/masterpass/review/details.phtml b/app/design/frontend/base/default/template/securesubmit/masterpass/review/details.phtml deleted file mode 100644 index 75ad8ce..0000000 --- a/app/design/frontend/base/default/template/securesubmit/masterpass/review/details.phtml +++ /dev/null @@ -1,64 +0,0 @@ - - - helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?> - - - - - helper('tax')->displayCartBothPrices()): ?> - - - - - - - - - - - helper('tax')->displayCartBothPrices()): ?> - - - - - - - - -getChildHtml('totals'); ?> - - getItems() as $_item): ?> - getItemHtml($_item) ?> - - -
    __('Product Name') ?>__('Price') ?>__('Qty') ?>__('Subtotal') ?>
    helper('tax')->getIncExcTaxLabel(false) ?>helper('tax')->getIncExcTaxLabel(true) ?>helper('tax')->getIncExcTaxLabel(false) ?>helper('tax')->getIncExcTaxLabel(true) ?>
    - diff --git a/app/design/frontend/base/default/template/securesubmit/masterpass/review/shipping/method.phtml b/app/design/frontend/base/default/template/securesubmit/masterpass/review/shipping/method.phtml deleted file mode 100644 index c41c5ad..0000000 --- a/app/design/frontend/base/default/template/securesubmit/masterpass/review/shipping/method.phtml +++ /dev/null @@ -1,53 +0,0 @@ - -
    -getCanEditShippingMethod() || !$this->getCurrentShippingRate()):?> - getShippingRateGroups()):?> - getCurrentShippingRate(); ?> - - -

    __('Sorry, no quotes are available for this order at this time.') ?>

    - - -

    renderShippingRateOption($this->getCurrentShippingRate())?>

    - -
    - diff --git a/app/design/frontend/base/default/template/securesubmit/form.phtml b/app/design/frontend/base/default/template/transit/form.phtml similarity index 57% rename from app/design/frontend/base/default/template/securesubmit/form.phtml rename to app/design/frontend/base/default/template/transit/form.phtml index eb42248..59ef502 100755 --- a/app/design/frontend/base/default/template/securesubmit/form.phtml +++ b/app/design/frontend/base/default/template/transit/form.phtml @@ -1,15 +1,15 @@ -getMethodCode(); $_loggedIn = Mage::getSingleton('customer/session')->isLoggedIn(); -$public_key = Mage::getModel('hps_securesubmit/payment')->getConfigData('publicapikey'); -$token_data_url = Mage::getUrl('securesubmit/storedcard/getTokenData', array('_secure' => TRUE)); -$allow_card_saving = Mage::getModel('hps_securesubmit/payment')->getConfigData('allow_card_saving'); -$allow_heartland_gift = Mage::getModel('hps_securesubmit/payment')->getConfigData('allow_heartland_gift'); -$use_iframes = !!Mage::getModel('hps_securesubmit/payment')->getConfigData('use_iframes'); +$public_key = Mage::getModel('hps_transit/payment')->getConfigData('publicapikey'); +$token_data_url = Mage::getUrl('transit/storedcard/getTokenData', array('_secure' => TRUE)); +$allow_card_saving = Mage::getModel('hps_transit/payment')->getConfigData('allow_card_saving'); +$allow_heartland_gift = Mage::getModel('hps_transit/payment')->getConfigData('allow_heartland_gift'); +$use_iframes = !!Mage::getModel('hps_transit/payment')->getConfigData('use_iframes'); $cca = $this->getCca(); if ($_loggedIn && $allow_card_saving) { - $customerStoredCards = Mage::helper('hps_securesubmit')->getStoredCards( Mage::getSingleton('customer/session')->getCustomerId()); + $customerStoredCards = Mage::helper('hps_transit')->getStoredCards( Mage::getSingleton('customer/session')->getCustomerId()); } ?> @@ -55,12 +55,8 @@ if ($_loggedIn && $allow_card_saving) {
    style="display: none;">
    - -
    - - - - +
    +
    @@ -68,22 +64,14 @@ if ($_loggedIn && $allow_card_saving) {
    - -
    - - - +
    - -
    - - - +
    @@ -94,63 +82,24 @@ if ($_loggedIn && $allow_card_saving) {
    - - - -
  • -
    - - - - - - __('Apply Gift Card') ?> -
  • - - - - - - -