Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add state to PayPal Standard #9487

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 22 additions & 4 deletions upload/catalog/controller/extension/payment/pp_standard.php
Expand Up @@ -36,7 +36,7 @@ public function index() {
$value = $option['value'];
} else {
$upload_info = $this->model_tool_upload->getUploadByCode($option['value']);

if ($upload_info) {
$value = $upload_info['name'];
} else {
Expand Down Expand Up @@ -76,7 +76,15 @@ public function index() {
} else {
$data['discount_amount_cart'] -= $total;
}


$ship_to_state_codes = array(
'BR', // Brazil
'CA', // Canada
'IT', // Italy
'MX', // Mexico
'US' // USA
);

if ($this->cart->hasShipping()) {
$data['no_shipping'] = 2;
$data['address_override'] = 1;
Expand All @@ -85,6 +93,11 @@ public function index() {
$data['address1'] = $order_info['shipping_address_1'];
$data['address2'] = $order_info['shipping_address_2'];
$data['city'] = $order_info['shipping_city'];
if (in_array($order_info['shipping_iso_code_2'], $ship_to_state_codes)) {
$data['state'] = $order_info['shipping_zone_code'];
} else {
$data['state'] = $order_info['shipping_zone'];
}
$data['zip'] = $order_info['shipping_postcode'];
$data['country'] = $order_info['shipping_iso_code_2'];
} else {
Expand All @@ -95,6 +108,11 @@ public function index() {
$data['address1'] = $order_info['payment_address_1'];
$data['address2'] = $order_info['payment_address_2'];
$data['city'] = $order_info['payment_city'];
if (in_array($order_info['payment_iso_code_2'], $ship_to_state_codes)) {
$data['state'] = $order_info['payment_zone_code'];
} else {
$data['state'] = $order_info['payment_zone'];
}
$data['zip'] = $order_info['payment_postcode'];
$data['country'] = $order_info['payment_iso_code_2'];
}
Expand Down Expand Up @@ -176,11 +194,11 @@ public function callback() {
if ($receiver_match && $total_paid_match) {
$order_status_id = $this->config->get('payment_pp_standard_completed_status_id');
}

if (!$receiver_match) {
$this->log->write('PP_STANDARD :: RECEIVER EMAIL MISMATCH! ' . strtolower($this->request->post['receiver_email']));
}

if (!$total_paid_match) {
$this->log->write('PP_STANDARD :: TOTAL PAID MISMATCH! ' . $this->request->post['mc_gross']);
}
Expand Down
Expand Up @@ -29,6 +29,7 @@
<input type="hidden" name="address1" value="{{ address1 }}" />
<input type="hidden" name="address2" value="{{ address2 }}" />
<input type="hidden" name="city" value="{{ city }}" />
<input type="hidden" name="state" value="{{ state }}" />
<input type="hidden" name="zip" value="{{ zip }}" />
<input type="hidden" name="country" value="{{ country }}" />
<input type="hidden" name="address_override" value="{{ address_override }}" />
Expand Down