function createAPayment($currency, $amount) { $payment = new DPSPayment(); $payment->Amount->Currency = $currency; $payment->Amount->Amount = $amount; $payment->write(); return $payment; }
function processDPSPayment($data, $form) { $form->saveInto($this->owner); $this->owner->write(); if (!($member = DataObject::get_one('Member', "\"Email\" = '" . $data['Email'] . "'"))) { $member = new Member(); $form->saveInto($member); $member->write(); } else { $member->update($data); $member->write(); } $payment = new DPSPayment(); $payment->Amount->Amount = $this->owner->Amount->Amount; $payment->Amount->Currency = $this->owner->Amount->Currency; $payment->PaidByID = $member->ID; $payment->PaidForClass = $this->owner->ClassName; $payment->PaidForID = $this->owner->ID; $payment->MerchantReference = $this->owner->getMerchantReference(); $payment->write(); $payment->DPSHostedRedirectURL = $this->ConfirmLink($payment); $payment->write(); $payment->dpshostedPurchase(array()); }