Skip to content

Commit

Permalink
redirects the customer back to the shopping cart when the popup is cl…
Browse files Browse the repository at this point in the history
…osed
  • Loading branch information
wd-chofer committed Apr 19, 2016
1 parent 87a0862 commit b598fe9
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 4 deletions.
10 changes: 10 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,14 @@ public function compareQuoteChecksum($quote, $his)

return true;
}

/**
* Creates return url that is called when the transaction is completed
*
* @return string
*/
public function getReturnUrl()
{
return $this->_getUrl('wirecardcheckoutpage/checkout/back', ['_secure' => true, '_nosid' => true]);
}
}
1 change: 1 addition & 0 deletions Model/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public function getConfig()
$config['payment'][$code]['instructions'] = $this->getInstructions($code);
$config['payment'][$code]['displaymode'] = $this->methods[$code]->getDisplayMode();
$config['payment'][$code]['logo_url'] = $this->getLogoUrl($code);
$config['payment'][$code]['back_url'] = $this->_dataHelper->getReturnUrl();
}

/*
Expand Down
7 changes: 7 additions & 0 deletions view/frontend/web/js/action/set-payment-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ define(
iframe.modal({
title: 'Wirecard Checkout Page',
autoOpen: true,
closed: function() {
var redirectUrl = $('#' + methodeCode + '-back-url').val();

// get rid of onbeforeunload events
document.write("");
location.href = redirectUrl;
},
closeText: '',
buttons: []
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ define(

return window.checkoutConfig.payment[this.getCode()].logo_url
},
getBackUrl: function() {
if (!window.checkoutConfig.payment[this.getCode()])
return false;

return window.checkoutConfig.payment[this.getCode()].back_url
},
placeWirecardOrder: function () {

if (this.validate() && additionalValidators.validate())
Expand All @@ -75,4 +81,4 @@ define(
}
});
}
);
);
3 changes: 2 additions & 1 deletion view/frontend/web/template/payment/method-eps.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<!--/ko-->
</div>

<input type="hidden" data-bind="attr: {id: getCode() + '-back-url'}, value: getBackUrl()" />
<iframe width="0" height="0" data-bind="attr: {id: getCode() + '-iframe'}" frameborder="0" name="wirecard_checkoutpage_iframe" style="display:none;width:100%;"></iframe>

<div class="actions-toolbar">
Expand All @@ -97,4 +98,4 @@
</div>
</div>
</div>
</div>
</div>
3 changes: 2 additions & 1 deletion view/frontend/web/template/payment/method-ideal.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<!--/ko-->
</div>

<input type="hidden" data-bind="attr: {id: getCode() + '-back-url'}, value: getBackUrl()" />
<iframe width="0" height="0" data-bind="attr: {id: getCode() + '-iframe'}" frameborder="0" name="wirecard_checkoutpage_iframe" style="display:none;width:100%;"></iframe>

<div class="actions-toolbar">
Expand All @@ -97,4 +98,4 @@
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
</fieldset>
</form>

<input type="hidden" data-bind="attr: {id: getCode() + '-back-url'}, value: getBackUrl()" />
<iframe width="0" height="0" data-bind="attr: {id: getCode() + '-iframe'}" frameborder="0"
name="wirecard_checkoutpage_iframe" style="display:none;width:100%;"></iframe>

Expand Down
3 changes: 2 additions & 1 deletion view/frontend/web/template/payment/method-standard.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<!--/ko-->
</div>

<input type="hidden" data-bind="attr: {id: getCode() + '-back-url'}, value: getBackUrl()" />
<iframe width="0" height="0" data-bind="attr: {id: getCode() + '-iframe'}" frameborder="0" name="wirecard_checkoutpage_iframe" style="display:none;width:100%;"></iframe>

<div class="actions-toolbar">
Expand All @@ -79,4 +80,4 @@
</div>
</div>
</div>
</div>
</div>

0 comments on commit b598fe9

Please sign in to comment.