Source of file DPSHostedPaymentForm.php
Size: 1,058 Bytes - Last Modified: 2021-12-23T10:33:30+00:00
/var/www/docs.ssmods.com/process/src/code/DPSHostedPaymentForm.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | <?php /** * @package payment_dpshosted */ class DPSHostedPaymentForm extends Form{ /** * @var string $payment_class Subclass of DPSHostedPayment for custom processing */ static $payment_class = 'DPSHostedPayment'; function __construct($controller, $name){ $fields = new FieldList( $donationAmount = new CurrencyField("Amount", "Amount"), new TextField("FirstName", "First Name"), new TextField("Surname", "Surname"), $email = new EmailField("Email", "Email") ); $actions = new FieldList( new FormAction("doPay", "Pay") ); $validator = new RequiredFields(array( "Amount", "FirstName", "Surname", "Email", )); parent::__construct($controller, $name, $fields, $actions, $validator); } function doPay($data, $form){ $paymentClass = self::$payment_class; $payment = new $paymentClass(); // ensures that we just write data that was submitted through the form $form->saveInto($payment); $payment->setClientIP(); $payment->write(); $payment->processPayment($data, $form); } } |