-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable stopping prepaid recurrent payments for users and admins
remp/crm#1504
- Loading branch information
Showing
9 changed files
with
142 additions
and
0 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
33 changes: 33 additions & 0 deletions
33
src/components/StopRecurrentPaymentInfoWidget/StopRecurrentPaymentInfoWidget.php
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,33 @@ | ||
<?php | ||
|
||
namespace Crm\AppleAppstoreModule\Components; | ||
|
||
use Crm\AppleAppstoreModule\Gateways\AppleAppstoreGateway; | ||
use Crm\ApplicationModule\Widget\BaseWidget; | ||
use Crm\ApplicationModule\Widget\WidgetManager; | ||
|
||
class StopRecurrentPaymentInfoWidget extends BaseWidget | ||
{ | ||
private $templateName = 'stop_recurrent_payment_info_widget.latte'; | ||
|
||
|
||
public function __construct( | ||
WidgetManager $widgetManager | ||
) { | ||
parent::__construct($widgetManager); | ||
} | ||
|
||
public function identifier() | ||
{ | ||
return 'stopapplerecurrentpaymentbuttonwidget'; | ||
} | ||
|
||
public function render($recurrentPayment) | ||
{ | ||
if ($recurrentPayment->payment_gateway->code !== AppleAppstoreGateway::GATEWAY_CODE) { | ||
return; | ||
} | ||
$this->template->setFile(__DIR__ . DIRECTORY_SEPARATOR . $this->templateName); | ||
$this->template->render(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/components/StopRecurrentPaymentInfoWidget/stop_recurrent_payment_info_widget.latte
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,30 @@ | ||
<a class="small" data-toggle="modal" data-target="#infoModal" style="display: block; padding-top: 4%; color: #b00c28; cursor: pointer"> | ||
<i class="fa fa-info-circle fa-wh"></i> {_"apple_appstore.frontend.stop_recurrent_payment_info_widget.info_button"} | ||
</a> | ||
|
||
<style> | ||
.modal-title { | ||
font-weight: bold; | ||
font-size: 125%; | ||
} | ||
</style> | ||
|
||
<!-- Modal --> | ||
<div class="modal fade" id="infoModal" tabindex="-1" role="dialog" aria-labelledby="infoModalLabel" | ||
aria-hidden="true" style="top: 48px"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="infoModalLabel" | ||
id="exampleModalLabel">{_"apple_appstore.frontend.stop_recurrent_payment_info_widget.modal_title"}</h5> | ||
</div> | ||
<div class="modal-body"> | ||
<p>{control snippet 'apple-stop-recurrent-info-widget-text'}</p> | ||
<p>{_"apple_appstore.frontend.stop_recurrent_payment_info_widget.modal_text_manual"|noescape}</p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal">{_"apple_appstore.frontend.stop_recurrent_payment_info_widget.close"}</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
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
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,39 @@ | ||
<?php | ||
|
||
namespace Crm\AppleAppstoreModule\Seeders; | ||
|
||
use Crm\ApplicationModule\Seeders\ISeeder; | ||
use Crm\ApplicationModule\Snippet\Repository\SnippetsRepository; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class SnippetsSeeder implements ISeeder | ||
{ | ||
private $snippetsRepository; | ||
|
||
public function __construct(SnippetsRepository $snippetsRepository) | ||
{ | ||
$this->snippetsRepository = $snippetsRepository; | ||
} | ||
|
||
public function seed(OutputInterface $output) | ||
{ | ||
$sorting = 1100; | ||
foreach (glob(__DIR__ . '/snippets/*.html') as $filename) { | ||
$info = pathinfo($filename); | ||
$key = $info['filename']; | ||
|
||
$snippet = $this->snippetsRepository->findBy('identifier', $key); | ||
$value = file_get_contents($filename); | ||
|
||
if (!$snippet) { | ||
$this->snippetsRepository->add($key, $key, $value, $sorting++, true, true); | ||
$output->writeln(' <comment>* snippet <info>' . $key . '</info> created</comment>'); | ||
} elseif ($snippet->has_default_value && $snippet->html !== $value) { | ||
$this->snippetsRepository->update($snippet, ['html' => $value, 'has_default_value' => true]); | ||
$output->writeln(' <comment>* snippet <info>' . $key . '</info> updated</comment>'); | ||
} else { | ||
$output->writeln(' * snippet <info>' . $key . '</info> exists'); | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/seeders/snippets/apple-stop-recurrent-info-widget-text.html
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 @@ | ||
Unfortunately we are unable to cancel your auto-renewing subscription at this site because you purchased it on your mobile device, not on our site. |