-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from vippsas/publication-1.2.2
Publication 1.2.2 - fixed issue with broken checkout page - added new email template for customer account confirmation
- Loading branch information
Showing
8 changed files
with
242 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<?php | ||
/** | ||
* Copyright 2019 Vipps | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | ||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Vipps\Login\Observer; | ||
|
||
use Magento\Customer\Model\EmailNotification; | ||
use Magento\Framework\App\Config\Storage\WriterInterface; | ||
use Magento\Framework\Event\Observer; | ||
use Magento\Framework\Event\ObserverInterface; | ||
use Magento\Config\App\Config\Type\System as SystemConfig; | ||
use Vipps\Login\Model\ConfigInterface; | ||
|
||
/** | ||
* Class ConfigObserver | ||
* @package Vipps\Login\Observer | ||
*/ | ||
class ConfigObserver implements ObserverInterface | ||
{ | ||
const VIPPS_TEMPLATE_ID = 'vipps_login_create_account_email_no_password_template'; | ||
|
||
/** | ||
* @var ConfigInterface | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @var WriterInterface | ||
*/ | ||
private $configWriter; | ||
|
||
/** | ||
* @var SystemConfig | ||
*/ | ||
private $systemConfig; | ||
|
||
/** | ||
* ConfigObserver constructor. | ||
* | ||
* @param SystemConfig $systemConfig | ||
* @param ConfigInterface $config | ||
* @param WriterInterface $configWriter | ||
*/ | ||
public function __construct( | ||
SystemConfig $systemConfig, | ||
ConfigInterface $config, | ||
WriterInterface $configWriter | ||
) { | ||
$this->config = $config; | ||
$this->configWriter = $configWriter; | ||
$this->systemConfig = $systemConfig; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* | ||
* @param Observer $observer | ||
*/ | ||
public function execute(Observer $observer) | ||
{ | ||
$storeId = $observer->getStore(); | ||
$websiteId = $observer->getWebsite(); | ||
|
||
if ($storeId) { | ||
$scope = 'stores'; | ||
$scopeId = (int) $storeId; | ||
} elseif ($websiteId) { | ||
$scope = 'websites'; | ||
$scopeId = (int) $websiteId; | ||
$storeId = 0; | ||
} else { | ||
$scope = 'default'; | ||
$scopeId = 0; | ||
$storeId = 0; | ||
} | ||
|
||
if ($this->config->isEnabled($storeId)) { | ||
$this->configWriter->save( | ||
EmailNotification::XML_PATH_REGISTER_NO_PASSWORD_EMAIL_TEMPLATE, | ||
self::VIPPS_TEMPLATE_ID, | ||
$scope, | ||
$scopeId | ||
); | ||
} else { | ||
$this->configWriter->delete( | ||
EmailNotification::XML_PATH_REGISTER_NO_PASSWORD_EMAIL_TEMPLATE, | ||
$scope, | ||
$scopeId | ||
); | ||
} | ||
|
||
$this->systemConfig->clean(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
~ Copyright 2018 Vipps | ||
~ | ||
~ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
~ documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
~ the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
~ and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
~ | ||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
~ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | ||
~ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
~ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
~ IN THE SOFTWARE | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> | ||
<event name="admin_system_config_changed_section_vipps"> | ||
<observer name="vipps_login_admin_system_config_changed_section_general" instance="Vipps\Login\Observer\ConfigObserver"/> | ||
</event> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!-- | ||
/** | ||
* Copyright 2019 Vipps | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | ||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
*/ | ||
--> | ||
<!--@subject {{trans "Welcome to %store_name" store_name=$store.getFrontendName()}} @--> | ||
<!--@vars { | ||
"var this.getUrl($store, 'customer/account/')":"Customer Account URL", | ||
"var this.getUrl($store, 'vipps/login/index/')":"Vipps Login URL", | ||
"var customer.email":"Customer Email", | ||
"var customer.name":"Customer Name" | ||
} @--> | ||
{{template config_path="design/email/header_template"}} | ||
|
||
<p class="greeting">{{trans "%name," name=$customer.name}}</p> | ||
<p>{{trans "Welcome to %store_name." store_name=$store.getFrontendName()}}</p> | ||
|
||
<div class="login-vipps"> | ||
{{trans 'You can sign in using'|raw}} | ||
<br> | ||
<form action="{{var this.getUrl($store, 'vipps/login/index/',[_nosid:1])}}" method="post" target="_blank" style="margin-top: 5px;"> | ||
<button type="submit" class="action create primary vipps-btn"> | ||
{{trans 'Sign in with'|raw}} | ||
<span class="icon-vipps" | ||
style="background: url({{view url='Vipps_Login/images/vipps-white-logo.png'}}) left center no-repeat;"> | ||
</span> | ||
</button> | ||
</form> | ||
</div> | ||
<br> | ||
<p> | ||
{{trans "or log in to our site and set a password using this <a href='%create_password_url'>link</a>." | ||
create_password_url="$this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token],_nosid:1])" | ||
|raw}} | ||
</p> | ||
|
||
<ul> | ||
<li><strong>{{trans "Email:"}}</strong> {{var customer.email}}</li> | ||
</ul> | ||
<p>{{trans "When you sign in to your account, you will be able to:"}}</p> | ||
<ul> | ||
<li>{{trans "Proceed through checkout faster"}}</li> | ||
<li>{{trans "Check the status of orders"}}</li> | ||
<li>{{trans "View past orders"}}</li> | ||
<li>{{trans "Store alternative addresses (for shipping to multiple family members and friends)"}}</li> | ||
</ul> | ||
|
||
{{template config_path="design/email/footer_template"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2018 Vipps | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | ||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE | ||
*/ | ||
@import "module/_variables.less"; | ||
|
||
|
||
.login-vipps { | ||
margin-top: 10px; | ||
|
||
.vipps-btn { | ||
display: flex; | ||
background: @vipps__color; | ||
color: @color__white; | ||
text-transform: none; | ||
font-family: 'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif; | ||
font-weight: 600; | ||
padding: 15px 25px; | ||
border-radius: 25px; | ||
border: 0; | ||
cursor: pointer; | ||
} | ||
} | ||
|
||
.vipps-btn { | ||
.icon-vipps { | ||
display: inline-block; | ||
background-size: 55px 14px; | ||
padding-left: 62px; | ||
height: 15px; | ||
margin-left: 10px; | ||
|
||
} | ||
} |