16 import(
'lib.pkp.classes.plugins.PaymethodPlugin');
24 return 'ManualPayment';
31 return __(
'plugins.paymethod.manual.displayName');
38 return __(
'plugins.paymethod.manual.description');
44 function register($category, $path, $mainContextId =
null) {
45 if (parent::register($category, $path, $mainContextId)) {
60 if ($form->id !== FORM_PAYMENT_SETTINGS) {
70 'id' =>
'manualPayment',
71 'label' => __(
'plugins.paymethod.manual.displayName'),
72 'showWhen' =>
'paymentsEnabled',
74 ->addField(
new \
PKP\components\forms\FieldTextArea(
'manualInstructions', [
75 'label' => __(
'plugins.paymethod.manual.settings'),
76 'value' => $this->
getSetting($context->getId(),
'manualInstructions'),
77 'groupId' =>
'manualPayment',
87 $allParams = $slimRequest->getParsedBody();
88 $manualInstructions = isset($allParams[
'manualInstructions']) ? (string) $allParams[
'manualInstructions'] :
'';
97 if (!$context)
return false;
98 if ($this->
getSetting($context->getId(),
'manualInstructions') ==
'')
return false;
110 import(
'lib.pkp.classes.form.Form');
113 $paymentForm->setData(array(
114 'itemName' => $paymentManager->getPaymentName($queuedPayment),
115 'itemAmount' => $queuedPayment->getAmount()>0?$queuedPayment->getAmount():
null,
116 'itemCurrencyCode' => $queuedPayment->getAmount()>0?$queuedPayment->getCurrencyCode():
null,
117 'manualInstructions' => $this->getSetting($context->getId(),
'manualInstructions'),
118 'queuedPaymentId' => $queuedPayment->getId(),
132 $op = isset($args[0])?$args[0]:
null;
133 $queuedPaymentId = isset($args[1])?((int) $args[1]):0;
136 $queuedPayment = $queuedPaymentDao->getById($queuedPaymentId);
139 if (!$queuedPayment)
$request->redirect(
null,
'index');
143 import(
'lib.pkp.classes.mail.MailTemplate');
145 $contactName = $context->getData(
'contactName');
146 $contactEmail = $context->getData(
'contactEmail');
147 $mail =
new MailTemplate(
'MANUAL_PAYMENT_NOTIFICATION');
148 $mail->setReplyTo(
null);
149 $mail->addRecipient($contactEmail, $contactName);
150 $mail->assignParams(array(
151 'contextName' => $context->getLocalizedName(),
152 'userFullName' => $user?$user->getFullName():(
'(' . __(
'common.none') .
')'),
153 'userName' => $user?$user->getUsername():(
'(' . __(
'common.none') .
')'),
154 'itemName' => $paymentManager->getPaymentName($queuedPayment),
155 'itemCost' => $queuedPayment->getAmount(),
156 'itemCurrencyCode' => $queuedPayment->getCurrencyCode()
160 $templateMgr->assign(array(
161 'currentUrl' =>
$request->url(
null,
null,
'payment',
'plugin', array(
'notify', $queuedPaymentId)),
162 'pageTitle' =>
'plugins.paymethod.manual.paymentNotification',
163 'message' =>
'plugins.paymethod.manual.notificationSent',
164 'backLink' => $queuedPayment->getRequestUrl(),
165 'backLinkLabel' =>
'common.continue'
167 $templateMgr->display(
'frontend/pages/message.tpl');
177 return ($this->
getPluginPath() . DIRECTORY_SEPARATOR .
'emailTemplates.xml');