Version Notes
Initial release
Download this release
Release Info
Developer | Magento Core Team |
Extension | CloudConnectERP |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/B2b2dot0/B2C/Block/Admin.php +25 -0
- app/code/local/B2b2dot0/B2C/Block/Onepage.php +31 -0
- app/code/local/B2b2dot0/B2C/Block/Onepage/Billing.php +9 -0
- app/code/local/B2b2dot0/B2C/Block/Onepage/Shipping.php +9 -0
- app/code/local/B2b2dot0/B2C/Helper/Data.php +161 -0
- app/code/local/B2b2dot0/B2C/Model/Address.php +63 -0
- app/code/local/B2b2dot0/B2C/Model/Api.php +141 -0
- app/code/local/B2b2dot0/B2C/Model/Api/V2.php +6 -0
- app/code/local/B2b2dot0/B2C/Model/Observer.php +15 -0
- app/code/local/B2b2dot0/B2C/Model/Onepage.php +53 -0
- app/code/local/B2b2dot0/B2C/Model/Paymetric.php +17 -0
- app/code/local/B2b2dot0/B2C/Model/Quote.php +540 -0
- app/code/local/B2b2dot0/B2C/Model/Shipping.php +54 -0
- app/code/local/B2b2dot0/B2C/controllers/CartController.php +83 -0
- app/code/local/B2b2dot0/B2C/etc/adminhtml.xml +26 -0
- app/code/local/B2b2dot0/B2C/etc/api.xml +69 -0
- app/code/local/B2b2dot0/B2C/etc/config.xml +107 -0
- app/code/local/B2b2dot0/B2C/etc/system.xml +257 -0
- app/code/local/B2b2dot0/B2C/etc/wsdl.xml +95 -0
- app/etc/modules/B2b2dot0_B2C.xml +10 -0
- package.xml +18 -0
app/code/local/B2b2dot0/B2C/Block/Admin.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Block_Admin extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
3 |
+
{
|
4 |
+
protected function _getHeaderHtml($element)
|
5 |
+
{
|
6 |
+
$default = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
|
7 |
+
|
8 |
+
$html = '<div class="entry-edit-head collapseable" ><a id="'.$element->getHtmlId().'-head" href="#" onclick="Fieldset.toggleCollapse(\''.$element->getHtmlId().'\', \''.$this->getUrl('*/*/state').'\'); return false;">'.$element->getLegend().'</a></div>';
|
9 |
+
$html.= '<input id="'.$element->getHtmlId().'-state" name="config_state['.$element->getId().']" type="hidden" value="'.(int)$this->_getCollapseState($element).'" />';
|
10 |
+
$html.= '<fieldset class="'.$this->_getFieldsetCss().'" id="'.$element->getHtmlId().'">';
|
11 |
+
$html.= '<legend>'.$element->getLegend().'</legend>';
|
12 |
+
|
13 |
+
if ($element->getComment()) {
|
14 |
+
$html .= '<div class="comment">'.$element->getComment().'</div>';
|
15 |
+
}
|
16 |
+
// field label column
|
17 |
+
$html.= '<table cellspacing="0" class="form-list"><colgroup class="label" /><colgroup class="value" />';
|
18 |
+
if (!$default) {
|
19 |
+
$html.= '<colgroup class="use-default" />';
|
20 |
+
}
|
21 |
+
$html.= '<colgroup class="scope-label" /><colgroup class="" /><tbody>';
|
22 |
+
|
23 |
+
return $html;
|
24 |
+
}
|
25 |
+
}
|
app/code/local/B2b2dot0/B2C/Block/Onepage.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Block_Onepage extends Mage_Checkout_Block_Onepage
|
3 |
+
{
|
4 |
+
public function getSteps()
|
5 |
+
{
|
6 |
+
$steps = parent::getSteps();
|
7 |
+
$stepCodes = array('billing', 'shipping', 'shipping_method');
|
8 |
+
$session = Mage::getSingleton('customer/session');
|
9 |
+
|
10 |
+
if($session->getResume())
|
11 |
+
{
|
12 |
+
foreach ($stepCodes as $step) {
|
13 |
+
$this->getCheckout()->setStepData($step, 'allow', true);
|
14 |
+
if($step != 'shipping_method')
|
15 |
+
$this->getCheckout()->setStepData($step, 'complete', true);
|
16 |
+
$steps[$step] = $this->getCheckout()->getStepData($step);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
return $steps;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getActiveStep()
|
24 |
+
{
|
25 |
+
$step = $this->isCustomerLoggedIn() ? 'billing' : 'login';
|
26 |
+
$session = Mage::getSingleton('customer/session');
|
27 |
+
if($session->getResume())
|
28 |
+
$step = 'shipping_method';
|
29 |
+
return $step;
|
30 |
+
}
|
31 |
+
}
|
app/code/local/B2b2dot0/B2C/Block/Onepage/Billing.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing
|
3 |
+
{
|
4 |
+
public function getAddress()
|
5 |
+
{
|
6 |
+
$this->_address = $this->getQuote()->getBillingAddress();
|
7 |
+
return $this->_address;
|
8 |
+
}
|
9 |
+
}
|
app/code/local/B2b2dot0/B2C/Block/Onepage/Shipping.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Block_Onepage_Shipping extends Mage_Checkout_Block_Onepage_Shipping
|
3 |
+
{
|
4 |
+
public function getAddress()
|
5 |
+
{
|
6 |
+
$this->_address = $this->getQuote()->getShippingAddress();
|
7 |
+
return $this->_address;
|
8 |
+
}
|
9 |
+
}
|
app/code/local/B2b2dot0/B2C/Helper/Data.php
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
public function b2bURL()
|
5 |
+
{
|
6 |
+
return Mage::getStoreConfig('b2b2dot0/ws/url');
|
7 |
+
}
|
8 |
+
|
9 |
+
public function allowBackorders()
|
10 |
+
{
|
11 |
+
if($this->b2bURL() == '' || $this->b2bURL() == NULL)
|
12 |
+
return true;
|
13 |
+
|
14 |
+
return Mage::getStoreConfig('b2b2dot0/ws/backorders');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function validateZip()
|
18 |
+
{
|
19 |
+
return Mage::getStoreConfig('b2b2dot0/ws/validatezip');
|
20 |
+
}
|
21 |
+
|
22 |
+
public function sapTax()
|
23 |
+
{
|
24 |
+
return Mage::getStoreConfig('b2b2dot0/ws/saptax');
|
25 |
+
}
|
26 |
+
|
27 |
+
public function soapClient()
|
28 |
+
{
|
29 |
+
$url = $this->b2bURL() . "/b2b_ws/wsdl";
|
30 |
+
$client = new SoapClient($url);
|
31 |
+
return $client;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function isTestMode()
|
35 |
+
{
|
36 |
+
return Mage::getStoreConfig('b2b2dot0/ws/testmode');
|
37 |
+
}
|
38 |
+
|
39 |
+
public function ws_id()
|
40 |
+
{
|
41 |
+
if($this->isTestMode())
|
42 |
+
return "WTEST" . mt_rand(100000000, 999999999);
|
43 |
+
else
|
44 |
+
return "W" . mt_rand(100000000, 999999999);
|
45 |
+
}
|
46 |
+
|
47 |
+
public function catalogID()
|
48 |
+
{
|
49 |
+
return Mage::getStoreConfig('b2b2dot0/ws/catalogid');
|
50 |
+
}
|
51 |
+
|
52 |
+
public function getDefaultLanguage()
|
53 |
+
{
|
54 |
+
return "en_US";
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getDateFormat()
|
58 |
+
{
|
59 |
+
return 'mm/dd/yyyy';
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getNumberFormat()
|
63 |
+
{
|
64 |
+
return '#,###.###';
|
65 |
+
}
|
66 |
+
|
67 |
+
public function setProductOOS($product)
|
68 |
+
{
|
69 |
+
$product->setStockData(array('is_in_stock' => $this->allowBackorders() ? 1 : 0, 'qty' => 0));
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getSAPError($response)
|
73 |
+
{
|
74 |
+
if($response->return_code != 0)
|
75 |
+
{
|
76 |
+
if($response->return_code == 7 || $response->return_code == 9)
|
77 |
+
return 'Sorry, there was a problem processing your request. Please try again. If the problem persists, please contact Customer Support.';
|
78 |
+
elseif($response->return_code == 8)
|
79 |
+
return 'Sorry, our ordering system is currently not available. We expect it to be back up in ' . ($response->return_value / 2.0) . ' hour.';
|
80 |
+
else
|
81 |
+
return $response->message;
|
82 |
+
}
|
83 |
+
|
84 |
+
return '';
|
85 |
+
}
|
86 |
+
|
87 |
+
public function getStateAbbreviation($stateIn)
|
88 |
+
{
|
89 |
+
$stateArray = array (
|
90 |
+
"ALABAMA"=>"AL",
|
91 |
+
"ALASKA"=>"AK",
|
92 |
+
"AMERICAN SAMOA"=>"AS",
|
93 |
+
"ARIZONA"=>"AZ",
|
94 |
+
"ARKANSAS"=>"AR",
|
95 |
+
"ARMED FORCES AFRICA"=>"AE",
|
96 |
+
"ARMED FORCES AMERICAS"=>"AA",
|
97 |
+
"ARMED FORCES CANADA"=>"AE",
|
98 |
+
"ARMED FORCES EUROPE"=>"AE",
|
99 |
+
"ARMED FORCES MIDDLE EAST"=>"AE",
|
100 |
+
"ARMED FORCES PACIFIC"=>"AP",
|
101 |
+
"CALIFORNIA"=>"CA",
|
102 |
+
"COLORADO"=>"CO",
|
103 |
+
"CONNECTICUT"=>"CT",
|
104 |
+
"DELAWARE"=>"DE",
|
105 |
+
"DISTRICT OF COLUMBIA"=>"DC",
|
106 |
+
"FEDERATED STATES OF MICRONESIA"=>"FM",
|
107 |
+
"FLORIDA"=>"FL",
|
108 |
+
"GEORGIA"=>"GA",
|
109 |
+
"GUAM"=>"GU",
|
110 |
+
"HAWAII"=>"HI",
|
111 |
+
"IDAHO"=>"ID",
|
112 |
+
"ILLINOIS"=>"IL",
|
113 |
+
"INDIANA"=>"IN",
|
114 |
+
"IOWA"=>"IA",
|
115 |
+
"KANSAS"=>"KS",
|
116 |
+
"KENTUCKY"=>"KY",
|
117 |
+
"LOUISIANA"=>"LA",
|
118 |
+
"MAINE"=>"ME",
|
119 |
+
"MARSHALL ISLANDS"=>"MH",
|
120 |
+
"MARYLAND"=>"MD",
|
121 |
+
"MASSACHUSETTS"=>"MA",
|
122 |
+
"MICHIGAN"=>"MI",
|
123 |
+
"MINNESOTA"=>"MN",
|
124 |
+
"MISSISSIPPI"=>"MS",
|
125 |
+
"MISSOURI"=>"MO",
|
126 |
+
"MONTANA"=>"MT",
|
127 |
+
"NEBRASKA"=>"NE",
|
128 |
+
"NEVADA"=>"NV",
|
129 |
+
"NEW HAMPSHIRE"=>"NH",
|
130 |
+
"NEW JERSEY"=>"NJ",
|
131 |
+
"NEW MEXICO"=>"NM",
|
132 |
+
"NEW YORK"=>"NY",
|
133 |
+
"NORTH CAROLINA"=>"NC",
|
134 |
+
"NORTH DAKOTA"=>"ND",
|
135 |
+
"NORTHERN MARIANA ISLANDS"=>"MP",
|
136 |
+
"OHIO"=>"OH",
|
137 |
+
"OKLAHOMA"=>"OK",
|
138 |
+
"OREGON"=>"OR",
|
139 |
+
"PALAU"=>"PW",
|
140 |
+
"PENNSYLVANIA"=>"PA",
|
141 |
+
"PUERTO RICO"=>"PR",
|
142 |
+
"RHODE ISLAND"=>"RI",
|
143 |
+
"SOUTH CAROLINA"=>"SC",
|
144 |
+
"SOUTH DAKOTA"=>"SD",
|
145 |
+
"TENNESSEE"=>"TN",
|
146 |
+
"TEXAS"=>"TX",
|
147 |
+
"UTAH"=>"UT",
|
148 |
+
"VERMONT"=>"VT",
|
149 |
+
"VIRGINIA"=>"VA",
|
150 |
+
"VIRGIN ISLANDS"=>"VI",
|
151 |
+
"WASHINGTON"=>"WA",
|
152 |
+
"WEST VIRGINIA"=>"WV",
|
153 |
+
"WISCONSIN"=>"WI",
|
154 |
+
"WYOMING"=>"WY"
|
155 |
+
);
|
156 |
+
|
157 |
+
$key = strtoupper($stateIn);
|
158 |
+
return( $stateArray[$key] );
|
159 |
+
}
|
160 |
+
}
|
161 |
+
?>
|
app/code/local/B2b2dot0/B2C/Model/Address.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Customer
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Address abstract model
|
29 |
+
*
|
30 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
+
*/
|
32 |
+
class B2b2dot0_B2C_Model_Address extends Mage_Sales_Model_Quote_Address
|
33 |
+
{
|
34 |
+
public function validate()
|
35 |
+
{
|
36 |
+
$b2c = Mage::helper('b2c');
|
37 |
+
|
38 |
+
$e = parent::validate();
|
39 |
+
if($e != true || !$b2c->validateZip())
|
40 |
+
return $e;
|
41 |
+
|
42 |
+
$errors = array();
|
43 |
+
$helper = Mage::helper('customer');
|
44 |
+
$client = $b2c->soapClient();
|
45 |
+
$this->implodeStreetAddress();
|
46 |
+
|
47 |
+
$response = $client->GetTaxJurisdictionCodes($b2c->ws_id(), "TBD", $this->getCountryId(), $this->getPostcode(), $b2c->getDefaultLanguage());
|
48 |
+
if($response->return_code == 7)
|
49 |
+
$errors[] = $helper->__('Invalid zip code');
|
50 |
+
elseif($response->return_code != 0)
|
51 |
+
$errors[] = $b2c->getSAPError($response);
|
52 |
+
else
|
53 |
+
{
|
54 |
+
if($b2c->getStateAbbreviation($this->getRegion()) != $response->tax_jurisdiction_codes[0]->state)
|
55 |
+
$errors[] = $helper->__('State does not match zip code');
|
56 |
+
}
|
57 |
+
|
58 |
+
if (empty($errors) || $this->getShouldIgnoreValidation())
|
59 |
+
return true;
|
60 |
+
|
61 |
+
return $errors;
|
62 |
+
}
|
63 |
+
}
|
app/code/local/B2b2dot0/B2C/Model/Api.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Model_Api extends Mage_Api_Model_Resource_Abstract
|
3 |
+
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Create new shipment for order
|
7 |
+
*
|
8 |
+
* @param string $orderIncrementId
|
9 |
+
* @param string $shipmentIncrementId
|
10 |
+
* @param array $itemsQty
|
11 |
+
* @param string $comment
|
12 |
+
* @param booleam $email
|
13 |
+
* @param boolean $includeComment
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function create($orderIncrementId, $shipmentIncrementId, $itemsQty = array(), $comment = null, $email = false, $includeComment = false, $trackInfo = array())
|
17 |
+
{
|
18 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
19 |
+
|
20 |
+
if (!$order->getId()) {
|
21 |
+
$this->_fault('order_not_exists');
|
22 |
+
}
|
23 |
+
|
24 |
+
if (!$order->canShip()) {
|
25 |
+
$this->_fault('data_invalid', Mage::helper('sales')->__('Cannot do shipment for order.'));
|
26 |
+
}
|
27 |
+
|
28 |
+
$itemsQty = $this->_prepareItemQtyData($itemsQty, $order);
|
29 |
+
|
30 |
+
$shipment = $this->prepareShipment($itemsQty, $order);
|
31 |
+
$track = null;
|
32 |
+
if ($shipment) {
|
33 |
+
$shipment->register();
|
34 |
+
$shipment->addComment($comment, $email && $includeComment);
|
35 |
+
if ($email) {
|
36 |
+
$shipment->setEmailSent(true);
|
37 |
+
}
|
38 |
+
$shipment->getOrder()->setIsInProcess(true);
|
39 |
+
$shipment->setIncrementId($shipmentIncrementId);
|
40 |
+
|
41 |
+
if ($order->canShip())
|
42 |
+
{
|
43 |
+
$order->setData('state', Mage_Sales_Model_Order::STATE_COMPLETE);
|
44 |
+
$order->setStatus(Mage_Sales_Model_Order::STATE_COMPLETE);
|
45 |
+
}
|
46 |
+
else
|
47 |
+
{
|
48 |
+
$order->setData('state', Mage_Sales_Model_Order::STATE_CLOSED);
|
49 |
+
$order->setStatus(Mage_Sales_Model_Order::STATE_CLOSED);
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
foreach ($trackInfo as $t)
|
54 |
+
{
|
55 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
56 |
+
->setNumber($t->trackNumber)
|
57 |
+
->setCarrierCode($t->carrier)
|
58 |
+
->setTitle($t->title);
|
59 |
+
$shipment->addTrack($track);
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
try {
|
64 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
65 |
+
->addObject($shipment)
|
66 |
+
->addObject($shipment->getOrder());
|
67 |
+
|
68 |
+
if($track != null)
|
69 |
+
$transactionSave->addObject($track);
|
70 |
+
|
71 |
+
$transactionSave->save();
|
72 |
+
$shipment->sendEmail($email, ($includeComment ? $comment : ''));
|
73 |
+
} catch (Mage_Core_Exception $e) {
|
74 |
+
$this->_fault('data_invalid', $e->getMessage());
|
75 |
+
}
|
76 |
+
|
77 |
+
return $shipment->getIncrementId();
|
78 |
+
}
|
79 |
+
return null;
|
80 |
+
}
|
81 |
+
|
82 |
+
public function process($orderIncrementId)
|
83 |
+
{
|
84 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
85 |
+
|
86 |
+
if (!$order->getId()) {
|
87 |
+
$this->_fault('order_not_exists');
|
88 |
+
}
|
89 |
+
|
90 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, "Status changed to Processing", false)->save();
|
91 |
+
|
92 |
+
return 1;
|
93 |
+
}
|
94 |
+
|
95 |
+
protected function _prepareItemQtyData($data, $order)
|
96 |
+
{
|
97 |
+
$_data = array();
|
98 |
+
$x = 0;
|
99 |
+
foreach ($order->getAllItems() as $orderItem) {
|
100 |
+
$_data[$x] = 0;
|
101 |
+
$x = $x + 1;
|
102 |
+
}
|
103 |
+
|
104 |
+
foreach ($data as $item) {
|
105 |
+
if (isset($item->order_item_id) && isset($item->qty)) {
|
106 |
+
$_data[$item->order_item_id] = $item->qty;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
return $_data;
|
110 |
+
}
|
111 |
+
|
112 |
+
|
113 |
+
protected function prepareShipment($qtys = array(), $order)
|
114 |
+
{
|
115 |
+
$totalQty = 0;
|
116 |
+
$convertor = Mage::getModel('sales/convert_order');
|
117 |
+
$shipment = $convertor->toShipment($order);
|
118 |
+
$x = 0;
|
119 |
+
foreach ($order->getAllItems() as $orderItem) {
|
120 |
+
|
121 |
+
$item = $convertor->itemToShipmentItem($orderItem);
|
122 |
+
if ($orderItem->isDummy(true))
|
123 |
+
$qty = 1;
|
124 |
+
else
|
125 |
+
$qty = $qtys[$x];
|
126 |
+
|
127 |
+
$x = $x + 1;
|
128 |
+
|
129 |
+
if($qty > 0)
|
130 |
+
{
|
131 |
+
$totalQty += $qty;
|
132 |
+
$item->setQty($qty);
|
133 |
+
$shipment->addItem($item);
|
134 |
+
}
|
135 |
+
}
|
136 |
+
$shipment->setTotalQty($totalQty);
|
137 |
+
return $shipment;
|
138 |
+
}
|
139 |
+
|
140 |
+
}
|
141 |
+
?>
|
app/code/local/B2b2dot0/B2C/Model/Api/V2.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Model_Api_V2 extends B2b2dot0_SAP_Model_Api
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
6 |
+
?>
|
app/code/local/B2b2dot0/B2C/Model/Observer.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Model_Observer
|
3 |
+
{
|
4 |
+
public function updateStatus($observer)
|
5 |
+
{
|
6 |
+
$sapOrder = Mage::getSingleton('customer/session')->getSapOrder();
|
7 |
+
|
8 |
+
if($sapOrder == '' || $sapOrder == null)
|
9 |
+
return;
|
10 |
+
|
11 |
+
Mage::getSingleton('checkout/session')->setLastRealOrderId($sapOrder);
|
12 |
+
$observer["order"]->setIncrementId($sapOrder)->save();
|
13 |
+
}
|
14 |
+
}
|
15 |
+
?>
|
app/code/local/B2b2dot0/B2C/Model/Onepage.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Model_Onepage extends Mage_Checkout_Model_Type_Onepage
|
3 |
+
{
|
4 |
+
public function savePayment($data)
|
5 |
+
{
|
6 |
+
$return = parent::savePayment($data);
|
7 |
+
|
8 |
+
$sapError = $this->updateTax();
|
9 |
+
$this->getQuote()->save();
|
10 |
+
|
11 |
+
if(!empty($sapError))
|
12 |
+
$return["error"] = $sapError;
|
13 |
+
|
14 |
+
return $return;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function saveOrder()
|
18 |
+
{
|
19 |
+
$sapError = $this->updateTax();
|
20 |
+
|
21 |
+
if(!empty($sapError))
|
22 |
+
throw new Mage_Payment_Model_Info_Exception($sapError);
|
23 |
+
|
24 |
+
return parent::saveOrder();
|
25 |
+
}
|
26 |
+
|
27 |
+
public function updateTax()
|
28 |
+
{
|
29 |
+
if(!Mage::helper('b2c')->sapTax())
|
30 |
+
return null;
|
31 |
+
|
32 |
+
$quote = $this->getQuote();
|
33 |
+
$sapTax = $quote->getSapTax();
|
34 |
+
|
35 |
+
if($quote->isVirtual())
|
36 |
+
$address = $quote->getBillingAddress();
|
37 |
+
else
|
38 |
+
$address = $quote->getShippingAddress();
|
39 |
+
|
40 |
+
$address->setTaxAmount($sapTax);
|
41 |
+
$address->setBaseTaxAmount($sapTax);
|
42 |
+
$address->setGrandTotal($address->getGrandTotal() + $sapTax);
|
43 |
+
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $sapTax);
|
44 |
+
$quote->setTaxAmount($address->getTaxAmount());
|
45 |
+
$quote->setBaseTaxAmount($address->getBaseTaxAmount());
|
46 |
+
$quote->setGrandTotal($address->getGrandTotal());
|
47 |
+
$quote->setBaseGrandTotal($address->getBaseGrandTotal());
|
48 |
+
|
49 |
+
return $quote->getSapError();
|
50 |
+
}
|
51 |
+
|
52 |
+
}
|
53 |
+
?>
|
app/code/local/B2b2dot0/B2C/Model/Paymetric.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Model_Paymetric extends Mage_Payment_Model_Method_Cc
|
3 |
+
{
|
4 |
+
protected $_code = 'paymetric';
|
5 |
+
protected $_isGateway = true;
|
6 |
+
protected $_canAuthorize = true;
|
7 |
+
protected $_canCapture = false;
|
8 |
+
protected $_canCapturePartial = false;
|
9 |
+
protected $_canRefund = false;
|
10 |
+
protected $_canVoid = false;
|
11 |
+
protected $_canUseInternal = false;
|
12 |
+
protected $_canUseCheckout = true;
|
13 |
+
protected $_canUseForMultishipping = true;
|
14 |
+
protected $_canSaveCc = false;
|
15 |
+
|
16 |
+
}
|
17 |
+
?>
|
app/code/local/B2b2dot0/B2C/Model/Quote.php
ADDED
@@ -0,0 +1,540 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class B2b2dot0_B2C_Model_Quote extends Mage_Sales_Model_Quote
|
3 |
+
{
|
4 |
+
private $_stockCheck = false;
|
5 |
+
private $_sapTax = 0.0;
|
6 |
+
private $_sapError = "";
|
7 |
+
public $shipping = 0;
|
8 |
+
|
9 |
+
public function getSapTax()
|
10 |
+
{
|
11 |
+
return $this->_sapTax;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function getSapError()
|
15 |
+
{
|
16 |
+
return $this->_sapError;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getHasError()
|
20 |
+
{
|
21 |
+
$url = Mage::helper('b2c')->b2bURL();
|
22 |
+
|
23 |
+
if($this->_stockCheck || $url == '' || $url == null)
|
24 |
+
return parent::getHasError();
|
25 |
+
|
26 |
+
$this->_stockCheck = true;
|
27 |
+
|
28 |
+
$uri = $_SERVER["REQUEST_URI"];
|
29 |
+
if(strpos($uri, "onepage/savePayment") > 0)
|
30 |
+
$this->orderCreate('SIMULATION');
|
31 |
+
elseif(strpos($uri, "onepage/saveOrder") > 0)
|
32 |
+
{
|
33 |
+
Mage::getSingleton('customer/session')->setResume(false);
|
34 |
+
$this->orderCreate('CREATION');
|
35 |
+
}
|
36 |
+
elseif((strpos($uri, "checkout/cart") > 0) && !strpos($uri, "add") && !strpos($uri, "update"))
|
37 |
+
$this->checkStock();
|
38 |
+
|
39 |
+
return parent::getHasError();
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
public function checkStock()
|
44 |
+
{
|
45 |
+
$sap = Mage::helper('b2c');
|
46 |
+
|
47 |
+
if($sap->allowBackorders())
|
48 |
+
return;
|
49 |
+
|
50 |
+
$products = $this->getItemsCollection();
|
51 |
+
foreach ( $products as $product )
|
52 |
+
{
|
53 |
+
$items[] = array('material' => $product->getProduct()->getSku(), 'quantity' => $product->getQty());
|
54 |
+
$lines[$product->getProduct()->getSku()] = $product;
|
55 |
+
}
|
56 |
+
|
57 |
+
$client = $sap->soapClient();
|
58 |
+
$session = Mage::getSingleton('checkout/session');
|
59 |
+
$response = $client->GetMaterialsAvailability($sap->ws_id(), session_id(), $items, $sap->catalogID(), $sap->getDefaultLanguage());
|
60 |
+
if($response->return_code == 8)
|
61 |
+
{
|
62 |
+
if(Mage::getStoreConfig('sap/ws/sapdown'))
|
63 |
+
return $session->addError('Sorry, our ordering system is currently not available. We expect it to be back up in ' . ($response->return_value / 2.0) . ' hour. There is no guarantee that the products in your cart are available.');
|
64 |
+
else
|
65 |
+
return $session->addError('Sorry, our ordering system is currently not available. We expect it to be back up in ' . ($response->return_value / 2.0) . ' hour. While it is down, you are not allowed to add products to the cart.');
|
66 |
+
}
|
67 |
+
elseif($response->return_code != 0)
|
68 |
+
return $session->addError($sap->getSAPError($response));
|
69 |
+
|
70 |
+
foreach($response->results as $r)
|
71 |
+
{
|
72 |
+
$p = $lines[$r->material];
|
73 |
+
if($p->getQty() > $r->quantity)
|
74 |
+
{
|
75 |
+
if($r->quantity <= 0)
|
76 |
+
{
|
77 |
+
$p->setHasError(true)
|
78 |
+
->setMessage("Out of stock.");
|
79 |
+
$this->setHasError(true)
|
80 |
+
->addMessage('Item "' . $p->getName() . '" is out of stock.', $r->material);
|
81 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$r->material);
|
82 |
+
$sap->setProductOOS($product);
|
83 |
+
$product->save();
|
84 |
+
}
|
85 |
+
else
|
86 |
+
{
|
87 |
+
$p->setHasError(true)
|
88 |
+
->setMessage("Only " . $r->quantity . " left in stock.");
|
89 |
+
$this->setHasError(true)
|
90 |
+
->addMessage('The requested quantity for "' . $p->getName() . '" is not available.', $r->material);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
private function buildAddress($address)
|
97 |
+
{
|
98 |
+
$street = $address->getStreet();
|
99 |
+
$street1 = $street[0];
|
100 |
+
$street2 = $street[1];
|
101 |
+
|
102 |
+
$addr = array(
|
103 |
+
'name1' => $address->getFirstname() . ' ' . $address->getLastname(),
|
104 |
+
'name2' => $address->getCompany(),
|
105 |
+
'phone' => $address->getTelephone(),
|
106 |
+
'cell_phone' => '',
|
107 |
+
'street1' => $street1,
|
108 |
+
'street2' => $street2,
|
109 |
+
'city' => $address->getCity(),
|
110 |
+
'vat_number' => ''/*$address->getRegion()*/,
|
111 |
+
'country' => $address->getCountryId(),
|
112 |
+
'postal_code' => $address->getPostcode(),
|
113 |
+
'tax_jurisdiction_code' => '',
|
114 |
+
'state_or_region' => Mage::helper('b2c')->getStateAbbreviation($address->getRegion())
|
115 |
+
);
|
116 |
+
if(empty($addr["city"]))
|
117 |
+
{
|
118 |
+
$addr["name1"] = "SHIP";
|
119 |
+
$addr["city"] = "SHIP";
|
120 |
+
$addr["name1"] = "SHIP";
|
121 |
+
}
|
122 |
+
if(empty($addr["country"]))
|
123 |
+
$addr["country"] = "US";
|
124 |
+
|
125 |
+
return $addr;
|
126 |
+
}
|
127 |
+
|
128 |
+
public function orderCreate($pt)
|
129 |
+
{
|
130 |
+
if($pt == "SIMULATION" and $this->shipping != 0)
|
131 |
+
return;
|
132 |
+
|
133 |
+
$quote = $this;
|
134 |
+
$gift = Mage::getModel('giftmessage/message');
|
135 |
+
$token = session_id();
|
136 |
+
$sap = Mage::helper('b2c');
|
137 |
+
$quote_data = $quote->getData();
|
138 |
+
$coupon = $quote->getCouponCode();
|
139 |
+
$header = array(
|
140 |
+
'ship_to' => '',
|
141 |
+
'po_number' => '',
|
142 |
+
'sold_to'=> '',
|
143 |
+
'freight' => Mage::getStoreConfig('carriers/sap/active') ? '0.00' : number_format($quote->getShippingAddress()->getShippingAmount(), 2),
|
144 |
+
'coupon' => ($coupon != NULL ? $coupon : ''),
|
145 |
+
'header_discount' => number_format((($quote->getSubtotal() - $quote->getSubtotalWithDiscount()) / $quote->getSubtotal())*100, 2),
|
146 |
+
'freight_discount' => ($pt != "SIMULATION" && $quote->getShippingAddress()->getShippingAmount() == 0.00) ? '100.0' : '0.00',
|
147 |
+
'catalog_id' => $sap->catalogID(),
|
148 |
+
'shipping_method' => $quote->getShippingAddress()->getShippingMethod(),
|
149 |
+
'process_type' => $pt
|
150 |
+
);
|
151 |
+
|
152 |
+
$items = array();
|
153 |
+
$products = $quote->getItemsCollection();
|
154 |
+
|
155 |
+
foreach ( $products as $product ) {
|
156 |
+
$message = '';
|
157 |
+
$id = $product->getGiftMessageId();
|
158 |
+
if(!empty($id))
|
159 |
+
{
|
160 |
+
$gift->load($id);
|
161 |
+
$message = $gift->getMessage();
|
162 |
+
}
|
163 |
+
$items[] = array(
|
164 |
+
'coupon' => '',
|
165 |
+
'reference' => $message,
|
166 |
+
'characteristics' => '',
|
167 |
+
'material' => $product->getProduct()->getSku(),
|
168 |
+
'ext_item_number' => $product->getProduct()->getId(),
|
169 |
+
'quantity' => number_format($product->getQty(), 2),
|
170 |
+
'list_price' => number_format($product->getProduct()->getPrice(), 2),
|
171 |
+
'item_discount'=>number_format($product->getProduct()->getPrice() - $product->getPrice(), 2)
|
172 |
+
);
|
173 |
+
}
|
174 |
+
|
175 |
+
|
176 |
+
$billingAddress = $quote->getBillingAddress();
|
177 |
+
$user = array(
|
178 |
+
'b2c_id' => $quote->getCustomerEmail(),
|
179 |
+
'b2b_id' => '',
|
180 |
+
'first_name' => $billingAddress->getFirstname(),
|
181 |
+
'last_name' => $billingAddress->getLastname(),
|
182 |
+
'phone' => $billingAddress->getTelephone(),
|
183 |
+
'email' => $quote->getCustomerEmail(),
|
184 |
+
'date_format' => $sap->getDateFormat(),
|
185 |
+
'number_format' => $sap->getNumberFormat(),
|
186 |
+
'language' => $sap->getDefaultLanguage()
|
187 |
+
);
|
188 |
+
|
189 |
+
$billing_address = $this->buildAddress($billingAddress);
|
190 |
+
$shipping_address = $this->buildAddress($quote->getShippingAddress());
|
191 |
+
|
192 |
+
$payment = $quote->getPayment();
|
193 |
+
$cc_types = array('VI'=>'visa','MC'=>'mc','AE'=>'amex','DI'=>'Discover');
|
194 |
+
$credit_card = array(
|
195 |
+
'cc_type'=>$cc_types[$payment->getData('cc_type')],
|
196 |
+
'expiration_year'=>$payment->getData('cc_exp_year'),
|
197 |
+
'expiration_month'=>str_pad($payment->getData('cc_exp_month'), 2, "0", STR_PAD_LEFT),
|
198 |
+
'name_on_card'=>'',//$billingAddress->getFirstname() . " " . $billingAddress->getLastname(),
|
199 |
+
'currency'=>Mage::app()->getStore()->getCurrentCurrencyCode(),
|
200 |
+
'cc_number'=>'x',
|
201 |
+
'auth_ref_number'=>'x',
|
202 |
+
'text'=>'x',
|
203 |
+
'auth_date'=>'x',
|
204 |
+
'auth_amount'=>'x',
|
205 |
+
'auth_time'=>'x',
|
206 |
+
'auth_number'=>'x'
|
207 |
+
);
|
208 |
+
|
209 |
+
if($pt != "SIMULATION" && Mage::getStoreConfig('payment/paymetric/enabled'))
|
210 |
+
{
|
211 |
+
$t = new StdClass();
|
212 |
+
$t->PacketOperation = 1;
|
213 |
+
$t->CardPresent = 0;
|
214 |
+
$t->AuthorizationDate = '1900-01-01T00:00:00';
|
215 |
+
$t->BillingDate = '1900-01-01T00:00:00';
|
216 |
+
$t->CaptureDate = '1900-01-01T00:00:00';
|
217 |
+
$t->CreationDate = '1900-01-01T00:00:00';
|
218 |
+
$t->LastModificationDate = '1900-01-01T00:00:00';
|
219 |
+
$t->OrderDate = '1900-01-01T00:00:00';
|
220 |
+
$t->SettlementDate = '1900-01-01T00:00:00';
|
221 |
+
$t->ShippingCaptureDate = '1900-01-01T00:00:00';
|
222 |
+
$t->ModifiedStatus = 0;
|
223 |
+
$t->StatusCode = 0;
|
224 |
+
$t->CurrencyKey = Mage::app()->getStore()->getCurrentCurrencyCode();
|
225 |
+
$t->CardExpirationDate = str_pad($payment->getData('cc_exp_month'), 2, "0", STR_PAD_LEFT) . '/' . substr($payment->getData('cc_exp_year'), 2);
|
226 |
+
$t->Amount = round($quote->getGrandTotal(),2);
|
227 |
+
$street = $billingAddress->getStreet();
|
228 |
+
$t->AVSAddress = $street[0];
|
229 |
+
$t->AVSZipCode = $billingAddress->getPostcode();
|
230 |
+
$card = $_REQUEST['payment'];
|
231 |
+
$t->CardCVV2 = $card[cc_cid];
|
232 |
+
$t->CardNumber = $card[cc_number];
|
233 |
+
if($payment->getData('cc_type') == 'AE')
|
234 |
+
$t->MerchantID = Mage::getStoreConfig('payment/paymetric/amexmid');
|
235 |
+
else
|
236 |
+
$t->MerchantID = Mage::getStoreConfig('payment/paymetric/vmcmid');
|
237 |
+
|
238 |
+
$p = new StdClass();
|
239 |
+
$p->pPacketsIn = new StdClass();
|
240 |
+
$p->pPacketsIn->xipayvbresult = false;
|
241 |
+
$p->pPacketsIn->count = 1;
|
242 |
+
$p->pPacketsIn->packets = array($t);
|
243 |
+
|
244 |
+
|
245 |
+
try
|
246 |
+
{
|
247 |
+
stream_wrapper_unregister('https');
|
248 |
+
stream_wrapper_register('https', 'XiPayNTLMStream');
|
249 |
+
$client = new XiPayNTLMSoapClient(Mage::getStoreConfig('payment/paymetric/url'));
|
250 |
+
|
251 |
+
$result = $client->SoapOp($p);
|
252 |
+
$result = $result->SoapOpResult->packets->ITransactionHeader;
|
253 |
+
if($result->StatusCode != 100 || empty($result->AuthorizationCode))
|
254 |
+
return $this->_sapError = "We're sorry there seems to be an issue with the credit card information you entered, please try again.";//$r->Message;
|
255 |
+
}
|
256 |
+
catch(Exception $e)
|
257 |
+
{
|
258 |
+
return $this->_sapError = $e->getMessage();
|
259 |
+
}
|
260 |
+
|
261 |
+
$credit_card['auth_ref_number'] = $result->TransactionID;
|
262 |
+
$credit_card['text'] = $result->Message;
|
263 |
+
$credit_card['cc_number'] = $result->CardNumber;
|
264 |
+
$credit_card['auth_date'] = str_replace("-", "", substr($result->AuthorizationDate, 0, 10));
|
265 |
+
$credit_card['auth_amount'] = round($quote->getGrandTotal(),2);
|
266 |
+
$credit_card['auth_time'] = str_replace(":", "", substr($result->AuthorizationTime, 0, 8));
|
267 |
+
$credit_card['auth_number'] = $result->AuthorizationCode;
|
268 |
+
|
269 |
+
stream_wrapper_restore('https');
|
270 |
+
|
271 |
+
}
|
272 |
+
|
273 |
+
$message = '';
|
274 |
+
$id = $quote->getGiftMessageId();
|
275 |
+
$texts = array();
|
276 |
+
if(!empty($id))
|
277 |
+
{
|
278 |
+
$gift->load($id);
|
279 |
+
$message = $gift->getMessage();
|
280 |
+
$texts = array(
|
281 |
+
array(
|
282 |
+
'text_name'=>'gift_message',
|
283 |
+
'text'=>$message
|
284 |
+
)
|
285 |
+
);
|
286 |
+
}
|
287 |
+
|
288 |
+
try
|
289 |
+
{
|
290 |
+
$client = $sap->soapClient();
|
291 |
+
$response = $client->OrderCreate($sap->ws_id(), $token, $header, $items, $user, $billing_address, $shipping_address, $credit_card, $texts );
|
292 |
+
if($response->return_code != 0)
|
293 |
+
{
|
294 |
+
if($response->return_code == 6)
|
295 |
+
{
|
296 |
+
Mage::getSingleton('customer/session')->setResume(true);
|
297 |
+
if($sap->isTestMode())
|
298 |
+
{
|
299 |
+
foreach ( $products as $product )
|
300 |
+
{
|
301 |
+
if($product->getQty() == 14)
|
302 |
+
$product->setQty(11);
|
303 |
+
elseif($product->getQty() == 15)
|
304 |
+
$product->setQty(12);
|
305 |
+
elseif($product->getQty() == 17)
|
306 |
+
$product->setQty(11);
|
307 |
+
elseif($product->getQty() == 18)
|
308 |
+
$product->setQty(12);
|
309 |
+
}
|
310 |
+
$this->save();
|
311 |
+
}
|
312 |
+
return $this->setHasError(true);
|
313 |
+
}
|
314 |
+
else
|
315 |
+
return $this->_sapError = $sap->getSAPError($response);
|
316 |
+
}
|
317 |
+
}
|
318 |
+
catch(Exception $e)
|
319 |
+
{
|
320 |
+
return $this->_sapError = $e->getMessage();
|
321 |
+
}
|
322 |
+
|
323 |
+
Mage::getSingleton('customer/session')->setSapOrder($response->header->doc_number);
|
324 |
+
|
325 |
+
foreach($response->header->price_infos as $price)
|
326 |
+
{
|
327 |
+
if($price->price_type == 'tax')
|
328 |
+
{
|
329 |
+
$this->_sapTax = $price->value;
|
330 |
+
}
|
331 |
+
if($price->price_type == 'freight')
|
332 |
+
{
|
333 |
+
$this->shipping = $price->value;
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
foreach($response->items as $i)
|
338 |
+
{
|
339 |
+
if($i->availability == "red" && $pt == "SIMULATION" && !$sap->allowBackorders())
|
340 |
+
{
|
341 |
+
Mage::getSingleton('customer/session')->setResume(true);
|
342 |
+
return $this->setHasError(true);
|
343 |
+
}
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
class XiPayNTLMStream
|
350 |
+
{
|
351 |
+
private $path;
|
352 |
+
private $mode;
|
353 |
+
private $options;
|
354 |
+
private $opened_path;
|
355 |
+
private $buffer;
|
356 |
+
private $pos;
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Open the stream
|
360 |
+
*
|
361 |
+
* @param unknown_type $path
|
362 |
+
* @param unknown_type $mode
|
363 |
+
* @param unknown_type $options
|
364 |
+
* @param unknown_type $opened_path
|
365 |
+
* @return unknown
|
366 |
+
*/
|
367 |
+
public function stream_open($path, $mode, $options, $opened_path) {
|
368 |
+
#echo "[NTLMStream::stream_open] $path , mode=$mode \n";
|
369 |
+
$this->path = $path;
|
370 |
+
$this->mode = $mode;
|
371 |
+
$this->options = $options;
|
372 |
+
$this->opened_path = $opened_path;
|
373 |
+
|
374 |
+
$this->createBuffer($path);
|
375 |
+
|
376 |
+
return true;
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* Close the stream
|
381 |
+
*
|
382 |
+
*/
|
383 |
+
public function stream_close() {
|
384 |
+
#echo "[NTLMStream::stream_close] \n";
|
385 |
+
curl_close($this->ch);
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* Read the stream
|
390 |
+
*
|
391 |
+
* @param int $count number of bytes to read
|
392 |
+
* @return content from pos to count
|
393 |
+
*/
|
394 |
+
public function stream_read($count) {
|
395 |
+
#echo "[NTLMStream::stream_read] $count \n";
|
396 |
+
if(strlen($this->buffer) == 0) {
|
397 |
+
return false;
|
398 |
+
}
|
399 |
+
|
400 |
+
$read = substr($this->buffer,$this->pos, $count);
|
401 |
+
|
402 |
+
$this->pos += $count;
|
403 |
+
|
404 |
+
return $read;
|
405 |
+
}
|
406 |
+
/**
|
407 |
+
* write the stream
|
408 |
+
*
|
409 |
+
* @param int $count number of bytes to read
|
410 |
+
* @return content from pos to count
|
411 |
+
*/
|
412 |
+
public function stream_write($data) {
|
413 |
+
#echo "[NTLMStream::stream_write] \n";
|
414 |
+
if(strlen($this->buffer) == 0) {
|
415 |
+
return false;
|
416 |
+
}
|
417 |
+
return true;
|
418 |
+
}
|
419 |
+
|
420 |
+
|
421 |
+
/**
|
422 |
+
*
|
423 |
+
* @return true if eof else false
|
424 |
+
*/
|
425 |
+
public function stream_eof() {
|
426 |
+
#echo "[NTLMStream::stream_eof] ";
|
427 |
+
|
428 |
+
if($this->pos > strlen($this->buffer)) {
|
429 |
+
#echo "true \n";
|
430 |
+
return true;
|
431 |
+
}
|
432 |
+
|
433 |
+
#echo "false \n";
|
434 |
+
return false;
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* @return int the position of the current read pointer
|
439 |
+
*/
|
440 |
+
public function stream_tell() {
|
441 |
+
#echo "[NTLMStream::stream_tell] \n";
|
442 |
+
return $this->pos;
|
443 |
+
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Flush stream data
|
447 |
+
*/
|
448 |
+
public function stream_flush() {
|
449 |
+
#echo "[NTLMStream::stream_flush] \n";
|
450 |
+
$this->buffer = null;
|
451 |
+
$this->pos = null;
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Stat the file, return only the size of the buffer
|
456 |
+
*
|
457 |
+
* @return array stat information
|
458 |
+
*/
|
459 |
+
public function stream_stat() {
|
460 |
+
#echo "[NTLMStream::stream_stat] \n";
|
461 |
+
|
462 |
+
$this->createBuffer($this->path);
|
463 |
+
$stat = array(
|
464 |
+
'size' => strlen($this->buffer),
|
465 |
+
);
|
466 |
+
|
467 |
+
return $stat;
|
468 |
+
}
|
469 |
+
/**
|
470 |
+
* Stat the url, return only the size of the buffer
|
471 |
+
*
|
472 |
+
* @return array stat information
|
473 |
+
*/
|
474 |
+
public function url_stat($path, $flags) {
|
475 |
+
#echo "[NTLMStream::url_stat] \n";
|
476 |
+
$this->createBuffer($path);
|
477 |
+
$stat = array(
|
478 |
+
'size' => strlen($this->buffer),
|
479 |
+
);
|
480 |
+
|
481 |
+
return $stat;
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* Create the buffer by requesting the url through cURL
|
486 |
+
*
|
487 |
+
* @param unknown_type $path
|
488 |
+
*/
|
489 |
+
private function createBuffer($path) {
|
490 |
+
if($this->buffer) {
|
491 |
+
return;
|
492 |
+
}
|
493 |
+
|
494 |
+
#echo "[NTLMStream::createBuffer] create buffer from : $path\n";
|
495 |
+
$this->ch = curl_init($path);
|
496 |
+
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
|
497 |
+
curl_setopt($this->ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
498 |
+
curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
|
499 |
+
curl_setopt($this->ch, CURLOPT_USERPWD, Mage::getStoreConfig('payment/paymetric/user').':'.Mage::getStoreConfig('payment/paymetric/password'));
|
500 |
+
echo $this->buffer = curl_exec($this->ch);
|
501 |
+
|
502 |
+
#echo "[NTLMStream::createBuffer] buffer size : ".strlen($this->buffer)."bytes\n";
|
503 |
+
$this->pos = 0;
|
504 |
+
|
505 |
+
}
|
506 |
+
}
|
507 |
+
|
508 |
+
class XiPayNTLMSoapClient extends SoapClient
|
509 |
+
{
|
510 |
+
public function __doRequest($request, $location, $action, $version, $one_way = NULL ) {
|
511 |
+
|
512 |
+
$headers = array(
|
513 |
+
'Method: POST',
|
514 |
+
'Connection: Keep-Alive',
|
515 |
+
'User-Agent: PHP-SOAP-CURL',
|
516 |
+
'Content-Type: text/xml; charset=utf-8',
|
517 |
+
'SOAPAction: "'.$action.'"',
|
518 |
+
);
|
519 |
+
|
520 |
+
#Zend_Debug::dump($request);return "";
|
521 |
+
|
522 |
+
$this->__last_request_headers = $headers;
|
523 |
+
$ch = curl_init(str_replace('http:', 'https:', $location));
|
524 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
525 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
526 |
+
curl_setopt($ch, CURLOPT_POST, true );
|
527 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
|
528 |
+
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
529 |
+
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
|
530 |
+
curl_setopt($ch, CURLOPT_USERPWD, Mage::getStoreConfig('payment/paymetric/user').':'.Mage::getStoreConfig('payment/paymetric/password'));
|
531 |
+
$response = curl_exec($ch);
|
532 |
+
|
533 |
+
return $response;
|
534 |
+
}
|
535 |
+
|
536 |
+
function __getLastRequestHeaders() {
|
537 |
+
return implode("\n", $this->__last_request_headers)."\n";
|
538 |
+
}
|
539 |
+
}
|
540 |
+
|
app/code/local/B2b2dot0/B2C/Model/Shipping.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class B2b2dot0_B2C_Model_Shipping extends Mage_Shipping_Model_Carrier_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* unique identifier for our shipping module
|
8 |
+
* @var string $_code
|
9 |
+
*/
|
10 |
+
protected $_code = 'sap';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Collect rates for this shipping method based on information in $request
|
14 |
+
*
|
15 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
16 |
+
* @return Mage_Shipping_Model_Rate_Result
|
17 |
+
*/
|
18 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
19 |
+
{
|
20 |
+
if (!$this->getConfigData('active'))
|
21 |
+
return false;
|
22 |
+
|
23 |
+
$cart = Mage::getModel('checkout/cart')->getQuote();
|
24 |
+
|
25 |
+
if($cart == null)
|
26 |
+
return false;
|
27 |
+
|
28 |
+
$rate = 0.00;
|
29 |
+
if(!$request->getFreeShipping())
|
30 |
+
{
|
31 |
+
$cart->orderCreate("SIMULATION");
|
32 |
+
$rate = $cart->shipping;
|
33 |
+
}
|
34 |
+
|
35 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
36 |
+
$method->setCarrier($this->_code);
|
37 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
38 |
+
$method->setMethod('std');
|
39 |
+
$method->setMethodTitle('Ground');
|
40 |
+
$method->setCost($rate);
|
41 |
+
$method->setPrice($rate);
|
42 |
+
|
43 |
+
$result = Mage::getModel('shipping/rate_result');
|
44 |
+
$result->append($method);
|
45 |
+
|
46 |
+
return $result;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getAllowedMethods()
|
50 |
+
{
|
51 |
+
return array('std'=>'Ground');
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
app/code/local/B2b2dot0/B2C/controllers/CartController.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once('Mage/Checkout/controllers/CartController.php');
|
3 |
+
class B2b2dot0_B2C_CartController extends Mage_Checkout_CartController
|
4 |
+
{
|
5 |
+
public function addAction()
|
6 |
+
{
|
7 |
+
|
8 |
+
$sap = Mage::helper('b2c');
|
9 |
+
if($sap->catalogID() == "" || $sap->allowBackorders())
|
10 |
+
return parent::addAction();
|
11 |
+
|
12 |
+
$session = Mage::getSingleton('core/session');
|
13 |
+
$params = $this->getRequest()->getParams();
|
14 |
+
|
15 |
+
$returnUrl = $this->getRequest()->getParam(Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED);
|
16 |
+
if($returnUrl)
|
17 |
+
$returnUrl = Mage::helper('core')->urlDecode($returnUrl);
|
18 |
+
else
|
19 |
+
$returnUrl = $this->getRequest()->getServer('HTTP_REFERER');
|
20 |
+
|
21 |
+
try {
|
22 |
+
$qty = "1";
|
23 |
+
|
24 |
+
if (isset($params['qty'])) {
|
25 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
26 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
27 |
+
);
|
28 |
+
$params['qty'] = $filter->filter($params['qty']);
|
29 |
+
$qty = $params['qty'];
|
30 |
+
}
|
31 |
+
|
32 |
+
$product = $this->_initProduct();
|
33 |
+
$related = $this->getRequest()->getParam('related_product');
|
34 |
+
|
35 |
+
if (!$product)
|
36 |
+
return $this->_redirectUrl($returnUrl);
|
37 |
+
|
38 |
+
$client = $sap->soapClient();
|
39 |
+
|
40 |
+
|
41 |
+
$response = $client->GetMaterialsAvailability($sap->ws_id(), session_id(), array(array('material' => $product->getSku(), 'quantity' => $qty)), $sap->catalogID(), $sap->getDefaultLanguage());
|
42 |
+
if($response->return_code == 8)
|
43 |
+
{
|
44 |
+
if(Mage::getStoreConfig('sap/ws/sapdown'))
|
45 |
+
{
|
46 |
+
$session->addError('Sorry, our ordering system is currently not available. We expect it to be back up in ' . ($response->return_value / 2.0) . ' hour. There is no guarantee that the products in your cart are available.');
|
47 |
+
}
|
48 |
+
else
|
49 |
+
{
|
50 |
+
$session->addError('Sorry, our ordering system is currently not available. We expect it to be back up in ' . ($response->return_value / 2.0) . ' hour. While it is down, you are not allowed to add products to the cart.');
|
51 |
+
return $this->_redirectUrl($returnUrl);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
elseif($response->return_code != 0)
|
55 |
+
{
|
56 |
+
$session->addError($sap->getSAPError($response));
|
57 |
+
return $this->_redirectUrl($returnUrl);
|
58 |
+
}
|
59 |
+
elseif($qty > $response->results[0]->quantity)
|
60 |
+
{
|
61 |
+
if($response->results[0]->quantity <= 0)
|
62 |
+
{
|
63 |
+
$session->addError($this->__("Out of stock."));
|
64 |
+
$sap->setProductOOS($product);
|
65 |
+
$product->save();
|
66 |
+
}
|
67 |
+
else
|
68 |
+
$session->addError($this->__("Only " . $response->results[0]->quantity . " left in stock."));
|
69 |
+
|
70 |
+
$this->_redirectUrl($this->getRequest()->getServer('HTTP_REFERER'));
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
return parent::addAction();
|
75 |
+
}
|
76 |
+
catch (Exception $e)
|
77 |
+
{
|
78 |
+
$session->addError($this->__($e));
|
79 |
+
}
|
80 |
+
|
81 |
+
$this->_redirectUrl($returnUrl);
|
82 |
+
}
|
83 |
+
}
|
app/code/local/B2b2dot0/B2C/etc/adminhtml.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
|
4 |
+
<acl>
|
5 |
+
<resources>
|
6 |
+
<all>
|
7 |
+
<title>Allow Everything</title>
|
8 |
+
</all>
|
9 |
+
<admin>
|
10 |
+
<children>
|
11 |
+
<system>
|
12 |
+
<children>
|
13 |
+
<config>
|
14 |
+
<children>
|
15 |
+
<b2b2dot0>
|
16 |
+
<title>B2B2dot0</title>
|
17 |
+
</b2b2dot0>
|
18 |
+
</children>
|
19 |
+
</config>
|
20 |
+
</children>
|
21 |
+
</system>
|
22 |
+
</children>
|
23 |
+
</admin>
|
24 |
+
</resources>
|
25 |
+
</acl>
|
26 |
+
</config>
|
app/code/local/B2b2dot0/B2C/etc/api.xml
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<api>
|
4 |
+
<resources>
|
5 |
+
<sap translate="title" module="sap">
|
6 |
+
<title>SAP Shipment</title>
|
7 |
+
<model>b2c/api</model>
|
8 |
+
<methods>
|
9 |
+
<create translate="title" module="sap">
|
10 |
+
<title>Create Shipment</title>
|
11 |
+
<method>create</method>
|
12 |
+
</create>
|
13 |
+
</methods>
|
14 |
+
<faults module="sap">
|
15 |
+
<not_exists>
|
16 |
+
<code>100</code>
|
17 |
+
<message>Requested order not exists.</message>
|
18 |
+
</not_exists>
|
19 |
+
<filters_invalid>
|
20 |
+
<code>101</code>
|
21 |
+
<message>Invalid filters given. Details in error message.</message>
|
22 |
+
</filters_invalid>
|
23 |
+
<data_invalid>
|
24 |
+
<code>102</code>
|
25 |
+
<message>Invalid data given. Details in error message.</message>
|
26 |
+
</data_invalid>
|
27 |
+
<status_not_changed>
|
28 |
+
<code>103</code>
|
29 |
+
<message>Order status not changed. Details in error message.</message>
|
30 |
+
</status_not_changed>
|
31 |
+
</faults>
|
32 |
+
</sap>
|
33 |
+
<saporder translate="title" module="saporder">
|
34 |
+
<title>SAP Order</title>
|
35 |
+
<model>b2c/api</model>
|
36 |
+
<methods>
|
37 |
+
<process translate="title" module="saporder">
|
38 |
+
<title>Process Order</title>
|
39 |
+
<method>process</method>
|
40 |
+
</process>
|
41 |
+
</methods>
|
42 |
+
<faults module="saporder">
|
43 |
+
<not_exists>
|
44 |
+
<code>100</code>
|
45 |
+
<message>Requested order not exists.</message>
|
46 |
+
</not_exists>
|
47 |
+
<filters_invalid>
|
48 |
+
<code>101</code>
|
49 |
+
<message>Invalid filters given. Details in error message.</message>
|
50 |
+
</filters_invalid>
|
51 |
+
<data_invalid>
|
52 |
+
<code>102</code>
|
53 |
+
<message>Invalid data given. Details in error message.</message>
|
54 |
+
</data_invalid>
|
55 |
+
<status_not_changed>
|
56 |
+
<code>103</code>
|
57 |
+
<message>Order status not changed. Details in error message.</message>
|
58 |
+
</status_not_changed>
|
59 |
+
</faults>
|
60 |
+
</saporder>
|
61 |
+
</resources>
|
62 |
+
<v2>
|
63 |
+
<resources_function_prefix>
|
64 |
+
<saporder>sapOrder</saporder>
|
65 |
+
<sap>sapOrderShipment</sap>
|
66 |
+
</resources_function_prefix>
|
67 |
+
</v2>
|
68 |
+
</api>
|
69 |
+
</config>
|
app/code/local/B2b2dot0/B2C/etc/config.xml
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
|
4 |
+
<modules>
|
5 |
+
<B2b2dot0_B2C>
|
6 |
+
<version>1.0.0</version>
|
7 |
+
</B2b2dot0_B2C>
|
8 |
+
</modules>
|
9 |
+
|
10 |
+
<frontend>
|
11 |
+
<routers>
|
12 |
+
<b2c>
|
13 |
+
<use>standard</use>
|
14 |
+
<args>
|
15 |
+
<module>B2b2dot0_B2C</module>
|
16 |
+
<frontName>b2c</frontName>
|
17 |
+
</args>
|
18 |
+
</b2c>
|
19 |
+
</routers>
|
20 |
+
|
21 |
+
<events>
|
22 |
+
<checkout_type_onepage_save_order_after>
|
23 |
+
<observers>
|
24 |
+
<b2c_checkout_observer>
|
25 |
+
<class>b2c/observer</class>
|
26 |
+
<method>updateStatus</method>
|
27 |
+
</b2c_checkout_observer>
|
28 |
+
</observers>
|
29 |
+
</checkout_type_onepage_save_order_after>
|
30 |
+
</events>
|
31 |
+
</frontend>
|
32 |
+
<global>
|
33 |
+
|
34 |
+
<routers>
|
35 |
+
<checkout>
|
36 |
+
<rewrite>
|
37 |
+
<cart>
|
38 |
+
<actions>
|
39 |
+
<add>
|
40 |
+
<to>b2c/cart/add</to>
|
41 |
+
</add>
|
42 |
+
</actions>
|
43 |
+
</cart>
|
44 |
+
</rewrite>
|
45 |
+
</checkout>
|
46 |
+
</routers>
|
47 |
+
|
48 |
+
<models>
|
49 |
+
<b2c>
|
50 |
+
<class>B2b2dot0_B2C_Model</class>
|
51 |
+
</b2c>
|
52 |
+
<checkout>
|
53 |
+
<rewrite>
|
54 |
+
<type_onepage>B2b2dot0_B2C_Model_Onepage</type_onepage>
|
55 |
+
</rewrite>
|
56 |
+
</checkout>
|
57 |
+
<sales>
|
58 |
+
<rewrite>
|
59 |
+
<quote>B2b2dot0_B2C_Model_Quote</quote>
|
60 |
+
<quote_address>B2b2dot0_B2C_Model_Address</quote_address>
|
61 |
+
</rewrite>
|
62 |
+
</sales>
|
63 |
+
</models>
|
64 |
+
|
65 |
+
<helpers>
|
66 |
+
<b2c>
|
67 |
+
<class>B2b2dot0_B2C_Helper</class>
|
68 |
+
</b2c>
|
69 |
+
</helpers>
|
70 |
+
|
71 |
+
|
72 |
+
<blocks>
|
73 |
+
<b2c>
|
74 |
+
<class>B2b2dot0_B2C_Block</class>
|
75 |
+
</b2c>
|
76 |
+
<checkout>
|
77 |
+
<rewrite>
|
78 |
+
<onepage_billing>B2b2dot0_B2C_Block_Onepage_Billing</onepage_billing>
|
79 |
+
<onepage_shipping>B2b2dot0_B2C_Block_Onepage_Shipping</onepage_shipping>
|
80 |
+
<onepage>B2b2dot0_B2C_Block_Onepage</onepage>
|
81 |
+
</rewrite>
|
82 |
+
</checkout>
|
83 |
+
</blocks>
|
84 |
+
|
85 |
+
</global>
|
86 |
+
|
87 |
+
<default>
|
88 |
+
<payment>
|
89 |
+
<paymetric>
|
90 |
+
<active>0</active>
|
91 |
+
<model>b2c/paymetric</model>
|
92 |
+
<order_status>processing</order_status>
|
93 |
+
<title>Credit Card (Paymetric)</title>
|
94 |
+
<cctypes>AE,VI,MC</cctypes>
|
95 |
+
<payment_action>authorize</payment_action>
|
96 |
+
<allowspecific>0</allowspecific>
|
97 |
+
</paymetric>
|
98 |
+
</payment>
|
99 |
+
<carriers>
|
100 |
+
<sap>
|
101 |
+
<model>b2c/shipping</model>
|
102 |
+
</sap>
|
103 |
+
</carriers>
|
104 |
+
</default>
|
105 |
+
|
106 |
+
</config>
|
107 |
+
|
app/code/local/B2b2dot0/B2C/etc/system.xml
ADDED
@@ -0,0 +1,257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<b2b2dot0 translate="label">
|
5 |
+
<label>B2B2dot0</label>
|
6 |
+
<sort_order>301</sort_order>
|
7 |
+
</b2b2dot0>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<b2b2dot0 translate="label">
|
11 |
+
<label>CloudConnect ERP</label>
|
12 |
+
<tab>b2b2dot0</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>99999</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<ws translate="label">
|
20 |
+
<label>Web Service Settings</label>
|
21 |
+
<comment><![CDATA[<div><a href="http://www.b2b2dot0.com/solutions/cmo/sapconnect-magento-extension" target="_blank"><img style="float:left" src="http://www.b2b2dot0.com/wp-content/themes/presstige/thumb.php?src=http://www.b2b2dot0.com/wp-content/uploads/2011/10/b2b2dot0-logo.png&w=224&h=55&zc=0" /></a><div style="padding:10px;float:left"><strong>Two way, real-time integration between SAP and Magento<br/>Signup for a 30 day <span style="font-size:13px">FREE</span> trial of our service <a href="http://www.b2b2dot0.com/solutions/cmo/magento-integration" target="_blank">here</a></strong></div><div style="clear:both"><br/></div></div>]]></comment>
|
22 |
+
<frontend_model>b2c/admin</frontend_model>
|
23 |
+
<frontend_type>text</frontend_type>
|
24 |
+
<sort_order>10</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
<fields>
|
29 |
+
<testmode translate="label">
|
30 |
+
<label>Test Mode Enabled</label>
|
31 |
+
<comment></comment>
|
32 |
+
<frontend_type>select</frontend_type>
|
33 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
<sort_order>2</sort_order>
|
38 |
+
</testmode>
|
39 |
+
<url translate="label">
|
40 |
+
<label>B2B2dot0 Web Service URL</label>
|
41 |
+
<comment></comment>
|
42 |
+
<frontend_type>text</frontend_type>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
<sort_order>1</sort_order>
|
47 |
+
</url>
|
48 |
+
<catalogid translate="label">
|
49 |
+
<label>Catalog ID</label>
|
50 |
+
<comment></comment>
|
51 |
+
<frontend_type>text</frontend_type>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
<sort_order>3</sort_order>
|
56 |
+
</catalogid>
|
57 |
+
<sapdown translate="label">
|
58 |
+
<label>Allow Add to Cart when SAP down</label>
|
59 |
+
<comment></comment>
|
60 |
+
<frontend_type>select</frontend_type>
|
61 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
<sort_order>4</sort_order>
|
66 |
+
</sapdown>
|
67 |
+
<backorders translate="label">
|
68 |
+
<label>Allow Backorders</label>
|
69 |
+
<comment></comment>
|
70 |
+
<frontend_type>select</frontend_type>
|
71 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
<sort_order>5</sort_order>
|
76 |
+
</backorders>
|
77 |
+
<validatezip translate="label">
|
78 |
+
<label>Validate Zipcode</label>
|
79 |
+
<comment></comment>
|
80 |
+
<frontend_type>select</frontend_type>
|
81 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
<sort_order>6</sort_order>
|
86 |
+
</validatezip>
|
87 |
+
<saptax translate="label">
|
88 |
+
<label>SAP Calculates Sales Tax</label>
|
89 |
+
<comment></comment>
|
90 |
+
<frontend_type>select</frontend_type>
|
91 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>1</show_in_website>
|
94 |
+
<show_in_store>1</show_in_store>
|
95 |
+
<sort_order>7</sort_order>
|
96 |
+
</saptax>
|
97 |
+
</fields>
|
98 |
+
</ws>
|
99 |
+
</groups>
|
100 |
+
</b2b2dot0>
|
101 |
+
<payment>
|
102 |
+
<groups>
|
103 |
+
<paymetric translate="label" module="b2c">
|
104 |
+
<label>Paymetric</label>
|
105 |
+
<comment><![CDATA[<div><a href="http://www.b2b2dot0.com/solutions/cmo/sapconnect-magento-extension" target="_blank"><img style="float:left" src="http://www.b2b2dot0.com/wp-content/themes/presstige/thumb.php?src=http://www.b2b2dot0.com/wp-content/uploads/2011/10/b2b2dot0-logo.png&w=224&h=55&zc=0" /></a><div style="padding:10px;float:left"><strong>Two way, real-time integration between SAP and Magento<br/>Signup for a 30 day <span style="font-size:13px">FREE</span> trial of our service <a href="http://www.b2b2dot0.com/solutions/cmo/magento-integration" target="_blank">here</a></strong></div><div style="clear:both"><br/></div></div>]]></comment>
|
106 |
+
<sort_order>0</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>0</show_in_store>
|
110 |
+
<fields>
|
111 |
+
<active translate="label">
|
112 |
+
<label>Enabled</label>
|
113 |
+
<frontend_type>select</frontend_type>
|
114 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
115 |
+
<sort_order>1</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>1</show_in_website>
|
118 |
+
<show_in_store>0</show_in_store>
|
119 |
+
</active>
|
120 |
+
<order_status translate="label">
|
121 |
+
<label>New order status</label>
|
122 |
+
<frontend_type>select</frontend_type>
|
123 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
124 |
+
<sort_order>4</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>1</show_in_website>
|
127 |
+
<show_in_store>0</show_in_store>
|
128 |
+
</order_status>
|
129 |
+
<title translate="label">
|
130 |
+
<label>Title</label>
|
131 |
+
<frontend_type>text</frontend_type>
|
132 |
+
<sort_order>2</sort_order>
|
133 |
+
<show_in_default>1</show_in_default>
|
134 |
+
<show_in_website>1</show_in_website>
|
135 |
+
<show_in_store>0</show_in_store>
|
136 |
+
</title>
|
137 |
+
<url translate="label">
|
138 |
+
<label>Endpoint URL</label>
|
139 |
+
<frontend_type>text</frontend_type>
|
140 |
+
<sort_order>5</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>0</show_in_store>
|
144 |
+
</url>
|
145 |
+
<user translate="label">
|
146 |
+
<label>Username</label>
|
147 |
+
<frontend_type>text</frontend_type>
|
148 |
+
<sort_order>6</sort_order>
|
149 |
+
<show_in_default>1</show_in_default>
|
150 |
+
<show_in_website>1</show_in_website>
|
151 |
+
<show_in_store>0</show_in_store>
|
152 |
+
</user>
|
153 |
+
<password translate="label">
|
154 |
+
<label>Password</label>
|
155 |
+
<frontend_type>text</frontend_type>
|
156 |
+
<sort_order>7</sort_order>
|
157 |
+
<show_in_default>1</show_in_default>
|
158 |
+
<show_in_website>1</show_in_website>
|
159 |
+
<show_in_store>0</show_in_store>
|
160 |
+
</password>
|
161 |
+
<vmcmid translate="label">
|
162 |
+
<label>Visa/MC MID</label>
|
163 |
+
<frontend_type>text</frontend_type>
|
164 |
+
<sort_order>8</sort_order>
|
165 |
+
<show_in_default>1</show_in_default>
|
166 |
+
<show_in_website>1</show_in_website>
|
167 |
+
<show_in_store>0</show_in_store>
|
168 |
+
</vmcmid>
|
169 |
+
<amexmid translate="label">
|
170 |
+
<label>AmEx MID</label>
|
171 |
+
<frontend_type>text</frontend_type>
|
172 |
+
<sort_order>9</sort_order>
|
173 |
+
<show_in_default>1</show_in_default>
|
174 |
+
<show_in_website>1</show_in_website>
|
175 |
+
<show_in_store>0</show_in_store>
|
176 |
+
</amexmid>
|
177 |
+
</fields>
|
178 |
+
</paymetric>
|
179 |
+
</groups>
|
180 |
+
</payment>
|
181 |
+
<carriers>
|
182 |
+
<groups>
|
183 |
+
<sap translate="label" module="b2c">
|
184 |
+
<comment><![CDATA[<div><a href="http://www.b2b2dot0.com/solutions/cmo/sapconnect-magento-extension" target="_blank"><img style="float:left" src="http://www.b2b2dot0.com/wp-content/themes/presstige/thumb.php?src=http://www.b2b2dot0.com/wp-content/uploads/2011/10/b2b2dot0-logo.png&w=224&h=55&zc=0" /></a><div style="padding:10px;float:left"><strong>Two way, real-time integration between SAP and Magento<br/>Signup for a 30 day <span style="font-size:13px">FREE</span> trial of our service <a href="http://www.b2b2dot0.com/solutions/cmo/magento-integration" target="_blank">here</a></strong></div><div style="clear:both"><br/></div></div>]]></comment>
|
185 |
+
<label>SAP</label>
|
186 |
+
<frontend_type>text</frontend_type>
|
187 |
+
<sort_order>13</sort_order>
|
188 |
+
<show_in_default>1</show_in_default>
|
189 |
+
<show_in_website>1</show_in_website>
|
190 |
+
<show_in_store>1</show_in_store>
|
191 |
+
|
192 |
+
<fields>
|
193 |
+
<active translate="label">
|
194 |
+
<label>Enabled</label>
|
195 |
+
<frontend_type>select</frontend_type>
|
196 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
197 |
+
<sort_order>1</sort_order>
|
198 |
+
<show_in_default>1</show_in_default>
|
199 |
+
<show_in_website>1</show_in_website>
|
200 |
+
<show_in_store>1</show_in_store>
|
201 |
+
</active>
|
202 |
+
|
203 |
+
<sort_order translate="label">
|
204 |
+
<label>Sort order</label>
|
205 |
+
<frontend_type>text</frontend_type>
|
206 |
+
<sort_order>100</sort_order>
|
207 |
+
<show_in_default>1</show_in_default>
|
208 |
+
<show_in_website>1</show_in_website>
|
209 |
+
<show_in_store>1</show_in_store>
|
210 |
+
</sort_order>
|
211 |
+
|
212 |
+
<title translate="label">
|
213 |
+
<label>Title</label>
|
214 |
+
<frontend_type>text</frontend_type>
|
215 |
+
<sort_order>2</sort_order>
|
216 |
+
<show_in_default>1</show_in_default>
|
217 |
+
<show_in_website>1</show_in_website>
|
218 |
+
<show_in_store>1</show_in_store>
|
219 |
+
</title>
|
220 |
+
|
221 |
+
<sallowspecific translate="label">
|
222 |
+
<label>Ship to applicable countries</label>
|
223 |
+
<frontend_type>select</frontend_type>
|
224 |
+
<sort_order>90</sort_order>
|
225 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
226 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
227 |
+
<show_in_default>1</show_in_default>
|
228 |
+
<show_in_website>1</show_in_website>
|
229 |
+
<show_in_store>1</show_in_store>
|
230 |
+
</sallowspecific>
|
231 |
+
|
232 |
+
<specificcountry translate="label">
|
233 |
+
<label>Ship to Specific countries</label>
|
234 |
+
<frontend_type>multiselect</frontend_type>
|
235 |
+
<sort_order>91</sort_order>
|
236 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
237 |
+
<show_in_default>1</show_in_default>
|
238 |
+
<show_in_website>1</show_in_website>
|
239 |
+
<show_in_store>1</show_in_store>
|
240 |
+
</specificcountry>
|
241 |
+
|
242 |
+
<showmethod translate="label">
|
243 |
+
<label>Show method if not applicable</label>
|
244 |
+
<frontend_type>select</frontend_type>
|
245 |
+
<sort_order>92</sort_order>
|
246 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
247 |
+
<show_in_default>1</show_in_default>
|
248 |
+
<show_in_website>1</show_in_website>
|
249 |
+
<show_in_store>1</show_in_store>
|
250 |
+
</showmethod>
|
251 |
+
|
252 |
+
</fields>
|
253 |
+
</sap>
|
254 |
+
</groups>
|
255 |
+
</carriers>
|
256 |
+
</sections>
|
257 |
+
</config>
|
app/code/local/B2b2dot0/B2C/etc/wsdl.xml
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
3 |
+
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
|
4 |
+
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
|
5 |
+
<types>
|
6 |
+
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
|
7 |
+
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
|
8 |
+
<complexType name="sapItemIdQty">
|
9 |
+
<all>
|
10 |
+
<element name="order_item_id" type="xsd:int" />
|
11 |
+
<element name="qty" type="xsd:double" />
|
12 |
+
</all>
|
13 |
+
</complexType>
|
14 |
+
<complexType name="sapItemIdQtyArray">
|
15 |
+
<complexContent>
|
16 |
+
<restriction base="soapenc:Array">
|
17 |
+
<attribute ref="soapenc:arrayType" wsdl:arrayType="typens:sapItemIdQty[]" />
|
18 |
+
</restriction>
|
19 |
+
</complexContent>
|
20 |
+
</complexType>
|
21 |
+
<complexType name="sapTrackInfo">
|
22 |
+
<all>
|
23 |
+
<element name="carrier" type="xsd:string" />
|
24 |
+
<element name="title" type="xsd:string" />
|
25 |
+
<element name="trackNumber" type="xsd:string" />
|
26 |
+
</all>
|
27 |
+
</complexType>
|
28 |
+
<complexType name="sapTrackInfoArray">
|
29 |
+
<complexContent>
|
30 |
+
<restriction base="soapenc:Array">
|
31 |
+
<attribute ref="soapenc:arrayType" wsdl:arrayType="typens:sapTrackInfo[]" />
|
32 |
+
</restriction>
|
33 |
+
</complexContent>
|
34 |
+
</complexType>
|
35 |
+
</schema>
|
36 |
+
</types>
|
37 |
+
<message name="sapOrderShipmentCreateRequest">
|
38 |
+
<part name="sessionId" type="xsd:string" />
|
39 |
+
<part name="orderIncrementId" type="xsd:string" />
|
40 |
+
<part name="shipmentIncrementId" type="xsd:string" />
|
41 |
+
<part name="itemsQty" type="typens:sapItemIdQtyArray" />
|
42 |
+
<part name="comment" type="xsd:string" />
|
43 |
+
<part name="email" type="xsd:int" />
|
44 |
+
<part name="includeComment" type="xsd:int" />
|
45 |
+
<part name="trackInfo" type="typens:sapTrackInfoArray" />
|
46 |
+
</message>
|
47 |
+
<message name="sapOrderShipmentCreateResponse">
|
48 |
+
<part name="shipmentIncrementId" type="xsd:string" />
|
49 |
+
</message>
|
50 |
+
<message name="sapOrderProcessRequest">
|
51 |
+
<part name="sessionId" type="xsd:string" />
|
52 |
+
<part name="orderIncrementId" type="xsd:string" />
|
53 |
+
</message>
|
54 |
+
<message name="sapOrderProcessResponse">
|
55 |
+
<part name="result" type="xsd:int" />
|
56 |
+
</message>
|
57 |
+
<portType name="{{var wsdl.handler}}PortType">
|
58 |
+
<operation name="sapOrderShipmentCreate">
|
59 |
+
<documentation>Create Shipment</documentation>
|
60 |
+
<input message="typens:sapOrderShipmentCreateRequest" />
|
61 |
+
<output message="typens:sapOrderShipmentCreateResponse" />
|
62 |
+
</operation>
|
63 |
+
<operation name="sapOrderProcess">
|
64 |
+
<documentation>Process Order</documentation>
|
65 |
+
<input message="typens:sapOrderProcessRequest" />
|
66 |
+
<output message="typens:sapOrderProcessResponse" />
|
67 |
+
</operation>
|
68 |
+
</portType>
|
69 |
+
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
|
70 |
+
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
|
71 |
+
<operation name="sapOrderShipmentCreate">
|
72 |
+
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
73 |
+
<input>
|
74 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
75 |
+
</input>
|
76 |
+
<output>
|
77 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
78 |
+
</output>
|
79 |
+
</operation>
|
80 |
+
<operation name="sapOrderProcess">
|
81 |
+
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
|
82 |
+
<input>
|
83 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
84 |
+
</input>
|
85 |
+
<output>
|
86 |
+
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
87 |
+
</output>
|
88 |
+
</operation>
|
89 |
+
</binding>
|
90 |
+
<service name="{{var wsdl.name}}Service">
|
91 |
+
<port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
|
92 |
+
<soap:address location="{{var wsdl.url}}" />
|
93 |
+
</port>
|
94 |
+
</service>
|
95 |
+
</definitions>
|
app/etc/modules/B2b2dot0_B2C.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<B2b2dot0_B2C>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</B2b2dot0_B2C>
|
8 |
+
</modules>
|
9 |
+
</config>
|
10 |
+
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>CloudConnectERP</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.b2b2dot0.com/solutions/cmo/sapconnect-magento-extension">SaaS</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Two way, real-time integration between SAP and Magento.</summary>
|
10 |
+
<description>CloudConnect ERP is a Magento Integration Extension that enables order placement from your Magento storefront directly into SAP. Features include: SAP-based freight calculations, SAP-based tax calculations, real-time inventory check and Paymetric PCI-compliant gateway.</description>
|
11 |
+
<notes>Initial release</notes>
|
12 |
+
<authors><author><name>b2b2dot0</name><user>auto-converted</user><email>sam.bayer@b2b2dot0.com</email></author></authors>
|
13 |
+
<date>2011-11-17</date>
|
14 |
+
<time>05:49:08</time>
|
15 |
+
<contents><target name="magelocal"><dir name="B2b2dot0"><dir name="B2C"><dir name="Block"><dir name="Onepage"><file name="Billing.php" hash="0f98dcce4914987c3b65e8ba77369f93"/><file name="Shipping.php" hash="7f20565d9de12b2c200bb64fb42e47c3"/></dir><file name="Admin.php" hash="67d21fadc4ea0af3800f01a4581c8d60"/><file name="Onepage.php" hash="b22e935c9b68c39781beac4cf68e9c68"/></dir><dir name="Helper"><file name="Data.php" hash="9d32cd4571ff7ca6c539e85478295d1f"/></dir><dir name="Model"><dir name="Api"><file name="V2.php" hash="6296aed824429df2849f3fa31c37c09d"/></dir><file name="Address.php" hash="a1c79cee8e08f097b91a81a5f7fdf455"/><file name="Api.php" hash="991982a8d2d3b582b74419bb83ee7314"/><file name="Observer.php" hash="b6d654f1312e58af0ae7fc09002483dd"/><file name="Onepage.php" hash="453c23625ce817bf7a31e2156b8956c4"/><file name="Paymetric.php" hash="9ee163b549faf835926519a2cd7c4c9b"/><file name="Quote.php" hash="00d34de39e89f10e25346bfb6825cc3d"/><file name="Shipping.php" hash="4d51111c34bf13de630e4ac1abc1f38b"/></dir><dir name="controllers"><file name="CartController.php" hash="f91550d92d5bc5e72b3bf6870d5f88b5"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7d7151e391d6ecd7acee4635dcc03599"/><file name="api.xml" hash="56c46423b113728bcc9b5c3a20038363"/><file name="config.xml" hash="c34276fd1d615c017c3edc1248abbe50"/><file name="system.xml" hash="0864868eb4319a30c40fcdfb03e14ffd"/><file name="wsdl.xml" hash="1df66244fe5b6e1a0a4a84a52f9d9053"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="B2b2dot0_B2C.xml" hash="7c9085e9e82103cf2018531c90e6f516"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|