Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • AdditionalMenuWidget_Item
  • AdvancedSliderHomepageWidget_Item
  • AssetManagerFolder
  • BannerWidget_Item
  • BaseObjectDecorator
  • BookingOrder
  • BookingPaymentMethod
  • BookingService
  • Boolean
  • ButtonsBlockHomepageWidget_Item
  • CarouselHomepageWidget_Item
  • CatalogRubricsHomepageWidget_CatalogDecorator
  • ClientEmailOrderNotification
  • ClientVKOrderNotification
  • ComponentSet
  • Currency
  • DatabaseAdmin
  • DataObject
  • DataObjectDecorator
  • DataObjectLog
  • DataObjectSet
  • DataObjectSet_Iterator
  • Date
  • DB
  • DBField
  • Decimal
  • DocumentItem
  • DocumentPage_File
  • Double
  • Enum
  • ErrorPageSubsite
  • FileDataObjectTrackingDecorator
  • FileImportDecorator
  • Float
  • ForeignKey
  • Hierarchy
  • HTMLText
  • HTMLVarchar
  • ImportLog_Item
  • Int
  • ManagerEmailOrderNotification
  • Material3D_File
  • MediawebPage_File
  • MediawebPage_Photo
  • MobileContentDecorator
  • Money
  • MultiEnum
  • MySQLDatabase
  • MySQLQuery
  • OrderDataObject
  • OrderHandlersDecorator
  • OrderItemVariationDecorator
  • OrderService
  • OrderServiceOrder
  • OrdersExportDecorator
  • PageIcon
  • PageWidgets
  • Payment
  • PaymentMethodShippingDecorator
  • PaymentOrderExtension
  • Percentage
  • PhotoAlbumItem
  • PhotoAlbumProductLinkDecorator
  • PhotoAlbumWidgetLinkDecorator
  • PhotoGalleryHomepageWidget_Item
  • PrimaryKey
  • Product3DDecorator
  • ProductCatalogCatalogLinkedDecorator
  • RatePeriod
  • RealtyImportLog
  • RealtyImportLog_Item
  • RedirectEntry
  • RoomOrder
  • RoomOrderPerson
  • RoomRate
  • RoomService
  • RoomServiceOrder
  • SberbankPaymentDecorator
  • SeoOpenGraphPageDecorator
  • ServiceOrder
  • ShippingMethodPaymentDecorator
  • ShopCountry
  • SimpleOrderCatalogDecorator
  • SimpleOrderProductDecorator
  • SiteConfigWidgets
  • SiteTreeDecorator
  • SiteTreeImportDecorator
  • SliderHomepageWidget_Item
  • SMSCOrderNotification
  • SMSOrderNotification
  • SortableDataObject
  • SQLMap
  • SQLMap_Iterator
  • SQLQuery
  • SS_Database
  • SS_Datetime
  • SS_Query
  • StringField
  • SubsiteDomain
  • Text
  • TextAnonsWidget_Item
  • Texture3D_File
  • Time
  • Varchar
  • Versioned
  • Versioned_Version
  • VideoCategory
  • VideoEntry
  • VKNotificationQueue
  • WebylonWidget_Item
  • YaMoneyPaymentDecorator
  • Year

Interfaces

  • CompositeDBField
  • CurrentPageIdentifier
  • DataObjectInterface
  1 <?php
  2 
  3 class Payment extends DataObject {
  4     static $db = array(
  5         'Status' => "Enum('Incomplete,Success,Failure,Pending','Incomplete')",
  6         'Amount' => 'Decimal(10,2)', 
  7         'Message' => 'HTMLText',
  8         'IP' => 'Varchar',      
  9         'PaidForID' => "Int",
 10         'PaidForClass' => 'Varchar', //Order by default
 11         'HashLink' => 'Varchar',
 12         'PaymentResponse' => 'Text', 
 13         'ExceptionError' => 'Text', //сообщение об ошибке из внешней системы
 14         'TransactionID' => 'Varchar(255)', //ID транзакции эквайера
 15     );
 16     
 17     static $has_one = array(
 18         'PaymentType' => 'PaymentMethod',
 19         'Member' => 'Member',       
 20     );  
 21     
 22     static $summary_fields = array('ID', 'StatusTitle', 'Amount', 'PaymentType.Title');
 23     
 24     function fieldLabels($includerelations = true) {
 25         $labels = parent::fieldLabels($includerelations);
 26         $labels['StatusTitle'] = _t('Payment.db_Status', 'Title');      
 27         $labels['PaymentType.Title'] = _t('Payment.has_one_PaymentType', 'Payment Type');       
 28         return $labels;
 29     }
 30     
 31     
 32     static function StatusTitles() {
 33         $options = singleton('Payment')->dbObject('Status')->enumValues(false);
 34         foreach ($options as $key => $val) {
 35             $options[$key] = _t('Payment.Status_'.$key, $val);
 36         }
 37         return $options;
 38     }
 39     
 40     function canView($member = null) {
 41         return ($this->PaidObject()) ? $this->PaidObject()->canView() : true;
 42     }
 43 
 44     function canEdit($member = null) {
 45         return ($this->PaidObject()) ? $this->PaidObject()->canEdit() : true;
 46     }
 47 
 48     function canDelete($member = null) {
 49         return ($this->PaidObject()) ? $this->PaidObject()->canDelete() : true;
 50     }
 51     
 52     function canCreate($member = null) {
 53         return ($this->PaidObject()) ? $this->PaidObject()->canCreate() : true;
 54     }
 55     
 56     
 57     function StatusTitle() {
 58         $titles = self::StatusTitles();
 59         return $titles[$this->Status];
 60     }
 61     
 62     /*
 63      * Возвращает оплачиваемый объект
 64      *
 65      */
 66     function PaidObject(){
 67         if ($this->PaidForClass && $this->PaidForID) {
 68             return DataObject::get_by_id($this->PaidForClass, $this->PaidForID);
 69         }
 70     }
 71     
 72     function onBeforeWrite() {
 73         if (!$this->HashLink) {
 74             $this->HashLink = md5(time() . serialize($this->data()) . rand());
 75         }
 76         parent::onBeforeWrite();
 77     }
 78     
 79     function onAfterWrite() {
 80         if($this->Status == 'Success' && $order = $this->PaidObject()) {
 81             if ($order->hasMethod('OnPaymentSuccess')) 
 82                 $order->OnPaymentSuccess();
 83         }
 84     }
 85     
 86     function getCMSFields() {
 87         $fields = parent::getCMSFields();
 88         $fields->replaceField('PaymentResponse', $fields->dataFieldByName('PaymentResponse')->performReadonlyTransformation());
 89         $fields->replaceField('ExceptionError', $fields->dataFieldByName('ExceptionError')->performReadonlyTransformation());
 90         $fields->replaceField('IP', $fields->dataFieldByName('IP')->performReadonlyTransformation());
 91         $fields->replaceField('MemberID', $fields->dataFieldByName('MemberID')->performReadonlyTransformation());           
 92         $fields->replaceField('PaymentTypeID', $fields->dataFieldByName('PaymentTypeID')->performReadonlyTransformation());
 93         $fields->removeByName('PaidForID'); 
 94         $fields->removeByName('PaidForClass');  
 95         
 96         $fields->replaceField('Status', new DropdownField('Status', _t('Payment.db_Status', 'Status'), self::StatusTitles()));      
 97         return $fields;     
 98     }
 99     
100     function isNew() {
101         return ($this->Status == 'Incomplete');
102     }
103 }
104 
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0