idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
44,800
protected function _setOrderTransactionErrorStatus ( oxOrder $ oOrder , stdClass $ oData , $ sStatus = null ) { if ( isset ( $ oData -> Error -> Code ) && ( bool ) $ oData -> Error -> Code !== false ) { if ( $ sStatus === null ) { $ sStatus = 'AMZ-Error-' . $ oData -> Error -> Code ; } $ oOrder -> assign ( array ( 'oxt...
Sets the order status
44,801
public function closeOrderReference ( $ oOrder = null , $ aRequestParameters = array ( ) , $ blUpdateOrderStatus = true ) { $ oData = $ this -> _callOrderRequest ( 'closeOrderReference' , $ oOrder , $ aRequestParameters , array ( 'amazon_order_reference_id' ) , $ blProcessable , 'AMZ-Order-Closed' ) ; if ( $ blUpdateOr...
Amazon CloseOrderReference method
44,802
public function authorize ( $ oOrder = null , $ aRequestParameters = array ( ) , $ blForceSync = false ) { $ sMode = $ this -> getConfig ( ) -> getConfigParam ( 'sAmazonMode' ) ; $ aRequestParameters [ 'transaction_timeout' ] = ( $ sMode === bestitAmazonPay4OxidClient :: BASIC_FLOW || $ blForceSync ) ? 0 : 1440 ; $ oDa...
Amazon Authorize method
44,803
public function processAuthorization ( oxOrder $ oOrder , stdClass $ oAuthorizationDetails ) { $ oAuthorizationStatus = $ oAuthorizationDetails -> AuthorizationStatus ; $ oOrder -> assign ( array ( 'oxtransstatus' => 'AMZ-Authorize-' . $ oAuthorizationStatus -> State ) ) ; $ oOrder -> save ( ) ; if ( $ oAuthorizationSt...
Processes the authorization
44,804
public function getAuthorizationDetails ( $ oOrder = null , array $ aRequestParameters = array ( ) ) { $ oData = $ this -> _callOrderRequest ( 'getAuthorizationDetails' , $ oOrder , $ aRequestParameters , array ( 'amazon_authorization_id' ) , $ blProcessable ) ; if ( $ blProcessable === true && isset ( $ oData -> GetAu...
Amazon GetAuthorizationDetails method
44,805
public function capture ( $ oOrder = null , $ aRequestParameters = array ( ) ) { $ oData = $ this -> _callOrderRequest ( 'capture' , $ oOrder , $ aRequestParameters , array ( 'amazon_authorization_id' , 'capture_amount' , 'currency_code' , 'capture_reference_id' , 'seller_capture_note' ) , $ blProcessable ) ; if ( $ bl...
Amazon Capture method
44,806
public function getCaptureDetails ( $ oOrder = null , $ aRequestParameters = array ( ) ) { $ oData = $ this -> _callOrderRequest ( 'getCaptureDetails' , $ oOrder , $ aRequestParameters , array ( 'amazon_capture_id' ) , $ blProcessable ) ; if ( $ blProcessable === true && isset ( $ oData -> GetCaptureDetailsResult -> Ca...
Amazon GetCaptureDetails method
44,807
public function saveCapture ( $ oOrder = null ) { if ( ( string ) $ oOrder -> getFieldData ( 'bestitAmazonCaptureId' ) !== '' ) { return $ this -> getCaptureDetails ( $ oOrder ) ; } elseif ( ( string ) $ oOrder -> getFieldData ( 'bestitAmazonAuthorizationId' ) !== '' ) { return $ this -> capture ( $ oOrder ) ; } return...
Save capture call .
44,808
public function refund ( $ oOrder = null , $ fPrice , $ aRequestParameters = array ( ) ) { if ( $ oOrder !== null ) { $ aRequestParameters [ 'refund_amount' ] = $ fPrice ; $ this -> _mapOrderToRequestParameters ( $ oOrder , $ aRequestParameters , array ( 'amazon_capture_id' , 'currency_code' , 'refund_reference_id' , '...
Amazon Refund method
44,809
public function getRefundDetails ( $ sAmazonRefundId ) { $ aRequestParameters [ 'amazon_refund_id' ] = $ sAmazonRefundId ; $ oData = $ this -> _convertResponse ( $ this -> _getAmazonClient ( ) -> getRefundDetails ( $ aRequestParameters ) ) ; if ( ( array ) $ oData !== array ( ) ) { $ sError = '' ; if ( isset ( $ oData ...
Amazon GetRefundDetails method
44,810
public function setOrderAttributes ( oxOrder $ oOrder , array $ aRequestParameters = array ( ) ) { $ this -> _mapOrderToRequestParameters ( $ oOrder , $ aRequestParameters , array ( 'amazon_order_reference_id' , 'seller_order_id' ) ) ; return $ this -> _getAmazonClient ( ) -> setOrderAttributes ( $ aRequestParameters )...
Sets the order attributes .
44,811
public function render ( ) { $ sOrderReferenceId = $ this -> _getContainer ( ) -> getConfig ( ) -> getRequestParameter ( 'amazonOrderReferenceId' ) ; if ( $ sOrderReferenceId ) { $ this -> _getContainer ( ) -> getSession ( ) -> setVariable ( 'amazonOrderReferenceId' , $ sOrderReferenceId ) ; } return parent :: render (...
Set Amazon reference ID to session
44,812
protected function _parseSingleAddress ( $ sString , $ sIsoCountryCode = null ) { $ aStreetNoStreetCountries = $ this -> getConfig ( ) -> getConfigParam ( 'aAmazonStreetNoStreetCountries' ) ; if ( in_array ( $ sIsoCountryCode , $ aStreetNoStreetCountries ) ) { preg_match ( '/\s*(?P<Number>\d[^\s]*)*\s*(?P<Name>[^\d]*[^...
Returns parsed Street name and Street number in array
44,813
protected function _parseAddressFields ( $ oAmazonData , array & $ aResult ) { $ aAmazonAddresses = array ( 1 => is_string ( $ oAmazonData -> AddressLine1 ) ? trim ( $ oAmazonData -> AddressLine1 ) : '' , 2 => is_string ( $ oAmazonData -> AddressLine2 ) ? trim ( $ oAmazonData -> AddressLine2 ) : '' , 3 => is_string ( $...
Parses the amazon address fields .
44,814
public function parseAmazonAddress ( $ oAmazonData ) { $ aResult = ( array ) $ oAmazonData ; $ aFullName = explode ( ' ' , trim ( $ oAmazonData -> Name ) ) ; $ aResult [ 'LastName' ] = array_pop ( $ aFullName ) ; $ aResult [ 'FirstName' ] = implode ( ' ' , $ aFullName ) ; $ sTable = getViewName ( 'oxcountry' ) ; $ oAma...
Returns Parsed address from Amazon by specific rules
44,815
public function encodeString ( $ sString ) { if ( $ this -> getConfig ( ) -> isUtf ( ) === true ) { return $ sString ; } $ sShopEncoding = $ this -> getLanguage ( ) -> translateString ( 'charset' ) ; return iconv ( 'UTF-8' , $ sShopEncoding , $ sString ) ; }
If shop is using non - Utf8 chars encode string according used encoding
44,816
public function getActiveUser ( ) { if ( $ this -> _oActiveUserObject === null ) { $ this -> _oActiveUserObject = false ; $ oUser = $ this -> getObjectFactory ( ) -> createOxidObject ( 'oxUser' ) ; if ( $ oUser -> loadActiveUser ( ) === true ) { $ this -> _oActiveUserObject = $ oUser ; } } return $ this -> _oActiveUser...
Returns the active user object .
44,817
public function getConfig ( ) { if ( $ this -> _oConfigObject === null ) { $ this -> _oConfigObject = oxRegistry :: getConfig ( ) ; } return $ this -> _oConfigObject ; }
Returns the config object .
44,818
public function getDatabase ( ) { if ( $ this -> _oDatabaseObject === null ) { $ this -> _oDatabaseObject = oxDb :: getDb ( oxDb :: FETCH_MODE_ASSOC ) ; } return $ this -> _oDatabaseObject ; }
Returns the database object .
44,819
public function getIpnHandler ( ) { if ( $ this -> _oIpnHandlerObject === null ) { $ this -> _oIpnHandlerObject = oxRegistry :: get ( 'bestitAmazonPay4OxidIpnHandler' ) ; } return $ this -> _oIpnHandlerObject ; }
Returns the ipn handler object .
44,820
public function getLanguage ( ) { if ( $ this -> _oLanguageObject === null ) { $ this -> _oLanguageObject = oxRegistry :: getLang ( ) ; } return $ this -> _oLanguageObject ; }
Returns the language object .
44,821
public function getSession ( ) { if ( $ this -> _oSessionObject === null ) { $ this -> _oSessionObject = oxRegistry :: getSession ( ) ; } return $ this -> _oSessionObject ; }
Returns the session object .
44,822
public function setPrimaryAmazonUserData ( ) { $ oUtils = $ this -> _getContainer ( ) -> getUtils ( ) ; $ sShopSecureHomeUrl = $ this -> _getContainer ( ) -> getConfig ( ) -> getShopSecureHomeUrl ( ) ; $ oData = $ this -> _getContainer ( ) -> getClient ( ) -> getOrderReferenceDetails ( ) ; $ oOrderReferenceDetail = iss...
Get s primary user details and logins user if one is not logged in Add s new address if user is logged in .
44,823
public function validatePayment ( ) { $ oSession = $ this -> _getContainer ( ) -> getSession ( ) ; $ oConfig = $ this -> _getContainer ( ) -> getConfig ( ) ; if ( ( string ) $ oSession -> getVariable ( 'amazonOrderReferenceId' ) === '' || ( string ) $ oConfig -> getRequestParameter ( 'paymentid' ) !== 'bestitamazon' ) ...
Set s order remark to session
44,824
protected function _addToMessages ( $ sText ) { $ aViewData = $ this -> getViewData ( ) ; $ aViewData [ 'sMessage' ] = isset ( $ aViewData [ 'sMessage' ] ) ? $ aViewData [ 'sMessage' ] . $ sText : $ sText ; $ this -> setViewData ( $ aViewData ) ; }
Adds the text to the message .
44,825
protected function _processOrderStates ( $ sQuery , $ sClientFunction ) { $ aResponses = array ( ) ; $ aResult = $ this -> _getContainer ( ) -> getDatabase ( ) -> getAll ( $ sQuery ) ; foreach ( $ aResult as $ aRow ) { $ oOrder = $ this -> _getContainer ( ) -> getObjectFactory ( ) -> createOxidObject ( 'oxOrder' ) ; if...
Processes the order states .
44,826
protected function _updateAuthorizedOrders ( ) { $ aProcessed = $ this -> _processOrderStates ( "SELECT OXID, OXORDERNR FROM oxorder WHERE BESTITAMAZONORDERREFERENCEID != '' AND BESTITAMAZONAUTHORIZATIONID != '' AND OXTRANSSTATUS = 'AMZ-Authorize-Pending'" , 'getAuthorizationDetails...
Authorize unauthorized orders or orders with pending status
44,827
protected function _captureOrders ( ) { $ sSQLAddShippedCase = '' ; if ( ( string ) $ this -> _getContainer ( ) -> getConfig ( ) -> getConfigParam ( 'sAmazonCapture' ) === 'SHIPPED' ) { $ sSQLAddShippedCase = ' AND OXSENDDATE > 0' ; } $ aProcessed = $ this -> _processOrderStates ( "SELECT OXID, OXORDERNR FRO...
Capture orders with Authorize status = open
44,828
protected function _updateRefundDetails ( ) { $ sQuery = "SELECT BESTITAMAZONREFUNDID FROM bestitamazonrefunds WHERE STATE = 'Pending' AND BESTITAMAZONREFUNDID != ''" ; $ aResult = $ this -> _getContainer ( ) -> getDatabase ( ) -> getAll ( $ sQuery ) ; foreach ( $ aResult as $ aRow ) ...
Check and update refund details for made refunds
44,829
public function render ( ) { set_time_limit ( 3600 ) ; if ( ( bool ) $ this -> _getContainer ( ) -> getConfig ( ) -> getConfigParam ( 'blAmazonERP' ) === true ) { $ this -> setViewData ( array ( 'sError' => 'ERP mode is ON (Module settings)' ) ) ; } elseif ( ( string ) $ this -> _getContainer ( ) -> getConfig ( ) -> ge...
The render function
44,830
protected function _getOperationName ( ) { $ operation = lcfirst ( $ this -> _getContainer ( ) -> getConfig ( ) -> getRequestParameter ( 'operation' ) ) ; if ( method_exists ( $ this -> _getContainer ( ) -> getClient ( ) , $ operation ) ) { return $ operation ; } $ this -> setViewData ( array ( 'sError' => "Operation '...
Method returns Operation name
44,831
protected function _getOrder ( ) { $ sOrderId = $ this -> _getContainer ( ) -> getConfig ( ) -> getRequestParameter ( 'oxid' ) ; if ( $ sOrderId !== null ) { $ oOrder = $ this -> _getContainer ( ) -> getObjectFactory ( ) -> createOxidObject ( 'oxOrder' ) ; if ( $ oOrder -> load ( $ sOrderId ) === true ) { return $ oOrd...
Method returns Order object
44,832
protected function _getParams ( ) { $ aResult = array ( ) ; $ aParams = ( array ) $ this -> _getContainer ( ) -> getConfig ( ) -> getRequestParameter ( 'aParams' ) ; foreach ( $ aParams as $ sKey => $ sValue ) { $ aResult [ html_entity_decode ( $ sKey ) ] = html_entity_decode ( $ sValue ) ; } return $ aResult ; }
Method returns Parameters from GET aParam array
44,833
public function amazonCall ( ) { $ sOperation = $ this -> _getOperationName ( ) ; if ( $ sOperation !== false ) { $ oResult = $ this -> _getContainer ( ) -> getClient ( ) -> { $ sOperation } ( $ this -> _getOrder ( ) , $ this -> _getParams ( ) ) ; $ this -> _addToMessages ( '<pre>' . print_r ( $ oResult , true ) . '</p...
Makes request to Amazon methods
44,834
public function render ( ) { if ( $ this -> _getContainer ( ) -> getConfig ( ) -> getConfigParam ( 'blAmazonERP' ) === true ) { return $ this -> _processError ( 'IPN response handling disabled - ERP mode is ON (Module settings)' ) ; } if ( $ this -> _getContainer ( ) -> getConfig ( ) -> getConfigParam ( 'sAmazonAuthori...
The controller entry point .
44,835
public function getIsSelectedCurrencyAvailable ( ) { $ oConfig = $ this -> getConfig ( ) ; $ blEnableMultiCurrency = ( bool ) $ oConfig -> getConfigParam ( 'blBestitAmazonPay4OxidEnableMultiCurrency' ) ; if ( $ blEnableMultiCurrency === true ) { return true ; } if ( $ this -> _isSelectedCurrencyAvailable === null ) { $...
Returns true if currency meets locale
44,836
public function isActive ( ) { if ( $ this -> _blActive !== null ) { return $ this -> _blActive ; } $ sTable = getViewName ( 'oxpayments' ) ; $ sSql = "SELECT OXACTIVE FROM {$sTable} WHERE OXID = 'bestitamazon'" ; $ blPaymentActive = ( bool ) $ this -> getDatabase ( ) -> getOne ( $ sSql ) ; if ( $...
Method checks if Amazon Pay is active and can be used
44,837
public function cleanUpUnusedAccounts ( ) { $ sTable = getViewName ( 'oxuser' ) ; $ sSql = "SELECT oxid, oxusername FROM {$sTable} WHERE oxusername LIKE '%-%-%@amazon.com' AND oxcreate < (NOW() - INTERVAL 1440 MINUTE)" ; $ aData = $ this -> getDatabase ( ) -> getAll ( $ sSql ) ; forea...
Deletes previously created user accounts which was not used
44,838
protected function _manageFullUserData ( $ oUser , $ oAmazonData ) { $ oContainer = $ this -> _getContainer ( ) ; $ oSession = $ oContainer -> getSession ( ) ; $ oConfig = $ oContainer -> getConfig ( ) ; $ aParsedData = $ oContainer -> getAddressUtil ( ) -> parseAmazonAddress ( $ oAmazonData -> Destination -> PhysicalD...
Manages received user data from Amazon
44,839
protected function _callSyncAmazonAuthorize ( $ oBasket , $ sAmazonOrderReferenceId , $ blOptimizedFlow ) { $ oContainer = $ this -> _getContainer ( ) ; $ oSession = $ oContainer -> getSession ( ) ; $ oUtils = $ oContainer -> getUtils ( ) ; $ oConfig = $ oContainer -> getConfig ( ) ; $ aParams = array ( 'amazon_order_r...
Calls Authorize method in Amazon depending on settings
44,840
protected function _performAmazonActions ( $ blAuthorizeAsync ) { $ oContainer = $ this -> _getContainer ( ) ; $ oSession = $ oContainer -> getSession ( ) ; $ oConfig = $ oContainer -> getConfig ( ) ; $ this -> _setFieldData ( 'bestitamazonorderreferenceid' , $ oSession -> getVariable ( 'amazonOrderReferenceId' ) ) ; $...
Async Authorize call and data update
44,841
public function finalizeOrder ( Basket $ oBasket , $ oUser , $ blRecalculatingOrder = false ) { if ( $ this -> _preFinalizeOrder ( $ oBasket , $ oUser , $ blIsAmazonOrder , $ blAuthorizeAsync ) === false ) { return oxOrder :: ORDER_STATE_PAYMENTERROR ; } $ iRet = $ this -> _parentFinalizeOrder ( $ oBasket , $ oUser , $...
Confirm Order details to Amazon if payment id is bestitamazon and amazonreferenceid exists Update user details with the full details received from amazon
44,842
public function validateDeliveryAddress ( $ oUser ) { $ oBasket = $ this -> _getContainer ( ) -> getSession ( ) -> getBasket ( ) ; if ( $ oBasket && ( string ) $ oBasket -> getPaymentId ( ) === 'bestitamazon' ) { return 0 ; } else { return parent :: validateDeliveryAddress ( $ oUser ) ; } }
Skips delivery address validation when payment == bestitamazon
44,843
public function getAmazonChangePaymentLink ( ) { $ oClient = $ this -> _getContainer ( ) -> getClient ( ) ; $ sLink = $ oClient -> getAmazonProperty ( 'sAmazonPayChangeLink' , true ) ; $ oData = $ oClient -> getOrderReferenceDetails ( $ this , array ( ) , true ) ; if ( ! empty ( $ oData -> GetOrderReferenceDetailsResul...
Method returns payment method change link for Invalid payment method order
44,844
public function refundAmazonOrder ( ) { $ oConfig = $ this -> _getContainer ( ) -> getConfig ( ) ; $ sId = $ this -> getEditObjectId ( ) ; if ( ( int ) $ sId !== - 1 && $ sId !== null && ( int ) $ oConfig -> getRequestParameter ( 'blAmazonConfirmRefund' ) === 1 ) { $ oOrder = $ this -> _getContainer ( ) -> getObjectFac...
Sends refund request to Amazon
44,845
public function getRefundsStatus ( ) { $ sId = $ this -> getEditObjectId ( ) ; if ( ( int ) $ sId !== - 1 && $ sId !== null ) { $ oDb = $ this -> _getContainer ( ) -> getDatabase ( ) ; $ sSql = "SELECT BESTITAMAZONREFUNDID FROM bestitamazonrefunds WHERE STATE = 'Pending' A...
Gets refunds status for the order
44,846
public function setQuickCheckoutBasket ( ) { $ oObjectFactory = $ this -> getObjectFactory ( ) ; $ oSession = $ this -> getSession ( ) ; $ oCurrentBasket = $ oSession -> getBasket ( ) ; $ oSession -> setVariable ( self :: BESTITAMAZONPAY_TEMP_BASKET , serialize ( $ oCurrentBasket ) ) ; $ oSession -> setBasket ( $ oObje...
Stores the basket which is present before the quick checkout .
44,847
protected function _validateBasket ( $ oBasket ) { $ aCurrentContent = $ oBasket -> getContents ( ) ; $ iCurrLang = $ this -> getLanguage ( ) -> getBaseLanguage ( ) ; foreach ( $ aCurrentContent as $ oContent ) { if ( $ oContent -> getLanguageId ( ) !== $ iCurrLang ) { $ oContent -> setLanguageId ( $ iCurrLang ) ; } } ...
Validates the basket .
44,848
public function restoreQuickCheckoutBasket ( ) { $ oSession = $ this -> getSession ( ) ; $ sBasket = $ oSession -> getVariable ( self :: BESTITAMAZONPAY_TEMP_BASKET ) ; if ( $ sBasket !== null ) { $ this -> getObjectFactory ( ) -> createOxidObject ( 'oxBasketItem' ) ; $ oBasket = unserialize ( $ sBasket ) ; $ this -> _...
Restores the basket which was present before the quick checkout .
44,849
public function getBasketHash ( $ sAmazonOrderReferenceId , $ oBasket ) { $ aBasket = array ( 'amazonOrderReferenceId' => $ sAmazonOrderReferenceId , 'totalSum' => $ oBasket -> getBruttoSum ( ) , 'contents' => array ( ) ) ; foreach ( $ oBasket -> getContents ( ) as $ oBasketItem ) { $ sId = $ oBasketItem -> getArticle ...
Generates the basket hash .
44,850
public function saveConfVars ( ) { $ sModuleId = $ this -> getEditObjectId ( ) ; if ( $ sModuleId === 'bestitamazonpay4oxid' ) { $ sQuickConfig = $ this -> _getContainer ( ) -> getConfig ( ) -> getRequestParameter ( 'bestitAmazonPay4OxidQuickConfig' ) ; try { $ aQuickConfig = json_decode ( $ sQuickConfig , true ) ; $ a...
Extends the save config variable function to store the amazon config vars from the provided config json object .
44,851
protected function _getShippingAvailableForPayment ( $ sShipSet ) { $ oDatabase = $ this -> _getContainer ( ) -> getDatabase ( ) ; $ sSql = "SELECT OXOBJECTID FROM oxobject2payment WHERE OXOBJECTID = {$oDatabase->quote($sShipSet)} AND OXPAYMENTID = {$oDatabase->quote('bestitamazon')...
Returns if Amazon pay is assigned available shipping ways
44,852
protected function _processResult ( $ aResult , $ oUser , $ oBasket ) { $ oConfig = $ this -> _getContainer ( ) -> getConfig ( ) ; $ sClass = $ oConfig -> getRequestParameter ( 'cl' ) ; $ sAmazonOrderReferenceId = $ this -> _getContainer ( ) -> getSession ( ) -> getVariable ( 'amazonOrderReferenceId' ) ; if ( $ sClass ...
If Amazon pay was selected remove other payment options and leave only Amazon pay If Amazon pay was selected remove shipping options where amazon pay is not assigned
44,853
public function getDeliverySetData ( $ sShipSet , $ oUser , $ oBasket ) { $ aResult = parent :: getDeliverySetData ( $ sShipSet , $ oUser , $ oBasket ) ; return $ this -> _processResult ( $ aResult , $ oUser , $ oBasket ) ; }
Returns the delivery set data .
44,854
public function wordPressSalts ( ) : array { $ generator = new Generator ( new Factory ) ; $ salts [ 'AUTH_KEY' ] = $ generator -> salt ( ) ; $ salts [ 'SECURE_AUTH_KEY' ] = $ generator -> salt ( ) ; $ salts [ 'LOGGED_IN_KEY' ] = $ generator -> salt ( ) ; $ salts [ 'NONCE_KEY' ] = $ generator -> salt ( ) ; $ salts [ 'A...
Generate and return all the WordPress salts as an array .
44,855
public function traditional ( ) : string { $ salts = $ this -> wordPressSalts ( ) ; return array_reduce ( array_keys ( $ salts ) , function ( $ saltsString , $ key ) use ( $ salts ) { $ saltsString .= "define('$key', '$salts[$key]');" . PHP_EOL ; return $ saltsString ; } , '' ) ; }
Gets an array of WordPress salts and then reduces them to a string for output to the CLI . Returns them in the traditional WordPress define format used in wp - config . php files .
44,856
public function sendorder ( ) { parent :: sendorder ( ) ; $ oOrder = $ this -> _getContainer ( ) -> getObjectFactory ( ) -> createOxidObject ( 'oxOrder' ) ; if ( $ oOrder -> load ( $ this -> getEditObjectId ( ) ) === true && $ oOrder -> getFieldData ( 'oxPaymentType' ) === 'bestitamazon' ) { $ this -> _getContainer ( )...
Capture order after changing it to shipped
44,857
public function cleanAmazonPay ( $ cancelOrderReference = false ) { $ oConfig = $ this -> _getContainer ( ) -> getConfig ( ) ; if ( $ cancelOrderReference === true || ( bool ) $ oConfig -> getRequestParameter ( 'cancelOrderReference' ) ) { $ this -> _getContainer ( ) -> getClient ( ) -> cancelOrderReference ( null , ar...
Cleans Amazon pay as the selected one including all related variables and values
44,858
public function render ( ) { $ sClass = $ this -> _getContainer ( ) -> getConfig ( ) -> getRequestParameter ( 'cl' ) ; if ( $ sClass !== 'order' && $ sClass !== 'thankyou' && ( bool ) $ this -> _getContainer ( ) -> getSession ( ) -> getVariable ( 'blAmazonSyncChangePayment' ) === true ) { $ this -> cleanAmazonPay ( tru...
Clears amazon pay variables .
44,859
protected function _parentToBasket ( $ sProductId = null , $ dAmount = null , $ aSelectList = null , $ aPersistentParameters = null , $ blOverride = false ) { return parent :: tobasket ( $ sProductId , $ dAmount , $ aSelectList , $ aPersistentParameters , $ blOverride ) ; }
Parent function wrapper .
44,860
public function tobasket ( $ sProductId = null , $ dAmount = null , $ aSelectList = null , $ aPersistentParameters = null , $ blOverride = false ) { $ oContainer = $ this -> _getContainer ( ) ; $ oConfig = $ oContainer -> getConfig ( ) ; $ isAmazonPay = ( bool ) $ oConfig -> getRequestParameter ( 'bestitAmazonPayIsAmaz...
Check if we are using amazon quick checkout .
44,861
public function getSelfLink ( ) { try { if ( ( bool ) $ this -> _getContainer ( ) -> getConfig ( ) -> getConfigParam ( 'sSSLShopURL' ) === true && ! $ this -> isAdmin ( ) && $ this -> getAmazonLoginIsActive ( ) ) { return $ this -> getSslSelfLink ( ) ; } } catch ( Exception $ oException ) { } return parent :: getSelfLi...
Forces to return shop self link if Amazon Login is active and we already have ORO Method is dedicated to stay always in checkout process under SSL
44,862
public function getBasketLink ( ) { if ( $ this -> getAmazonLoginIsActive ( ) === true ) { $ sValue = $ this -> getViewConfigParam ( 'basketlink' ) ; if ( ( string ) $ sValue === '' ) { $ sValue = $ this -> _getContainer ( ) -> getConfig ( ) -> getShopSecureHomeUrl ( ) . 'cl=basket' ; $ this -> setViewConfigParam ( 'ba...
Forces to return basket link if Amazon Login is active and we already have ORO in SSL
44,863
protected function _getInjectedCode ( ) { $ oUtils = $ this -> _getContainer ( ) -> getUtils ( ) ; $ aCodeInjected = $ oUtils -> fromStaticCache ( self :: CODE_INJECTED_STATIC_CACHE_KEY ) ; return $ aCodeInjected === null ? array ( ) : $ aCodeInjected ; }
Loads the injected code map from the static cache .
44,864
public function setJSCodeInjected ( $ sType ) { $ aCodeInjected = $ this -> _getInjectedCode ( ) ; $ aCodeInjected [ $ sType ] = true ; $ this -> _getContainer ( ) -> getUtils ( ) -> toStaticCache ( self :: CODE_INJECTED_STATIC_CACHE_KEY , $ aCodeInjected ) ; }
Marks the type as already injected .
44,865
public function wasJSCodeInjected ( $ sType ) { $ aCodeInjected = $ this -> _getInjectedCode ( ) ; return isset ( $ aCodeInjected [ $ sType ] ) && $ aCodeInjected [ $ sType ] ; }
Checks if the code with given type was already injected .
44,866
public function getBasketCurrency ( ) { $ oCurrency = $ this -> _getContainer ( ) -> getSession ( ) -> getBasket ( ) -> getBasketCurrency ( ) ; return $ oCurrency !== null ? $ oCurrency -> name : '' ; }
Returns the basket currency .
44,867
public function getAmazonBillingAddress ( ) { $ oOrderReferenceDetails = $ this -> _getContainer ( ) -> getClient ( ) -> getOrderReferenceDetails ( ) ; $ oDetails = $ oOrderReferenceDetails -> GetOrderReferenceDetailsResult -> OrderReferenceDetails ; if ( isset ( $ oDetails -> BillingAddress ) === true ) { $ aParsedDat...
Returns the amazon billing address .
44,868
public function getCountryName ( $ sCountryId ) { $ oCountry = $ this -> _getContainer ( ) -> getObjectFactory ( ) -> createOxidObject ( 'oxCountry' ) ; return ( $ oCountry -> load ( $ sCountryId ) === true ) ? ( string ) $ oCountry -> getFieldData ( 'oxTitle' ) : '' ; }
Returns the county name for the current billing address country .
44,869
public function updateUserWithAmazonData ( ) { $ billingAddress = $ this -> getAmazonBillingAddress ( ) ; if ( $ billingAddress !== null ) { $ oUser = $ this -> getUser ( ) ; $ oUser -> assign ( $ billingAddress ) ; $ oUser -> save ( ) ; } }
Updates the user data with the amazon data .
44,870
protected function setBasketHash ( ) { $ oContainer = $ this -> _getContainer ( ) ; $ sBasketHash = $ oContainer -> getConfig ( ) -> getRequestParameter ( 'amazonBasketHash' ) ; if ( $ sBasketHash ) { $ oContainer -> getSession ( ) -> setVariable ( 'sAmazonBasketHash' , $ sBasketHash ) ; } }
Sets the basket hash .
44,871
public function render ( ) { $ sTemplate = parent :: render ( ) ; $ oPayment = $ this -> getPayment ( ) ; $ oConfig = $ this -> _getContainer ( ) -> getConfig ( ) ; if ( $ oPayment !== false ) { $ sPaymentId = ( string ) $ this -> getPayment ( ) -> getId ( ) ; $ sAmazonOrderReferenceId = ( string ) $ this -> _getContai...
The main render function with additional payment checks .
44,872
public function logIPNResponse ( $ sLevel , $ sMessage , $ oIpnMessage = null ) { if ( ( bool ) $ this -> getConfig ( ) -> getConfigParam ( 'blAmazonLogging' ) !== true ) { return ; } $ aContext = ( $ oIpnMessage !== null ) ? array ( 'ipnMessage' => $ oIpnMessage ) : array ( ) ; $ this -> _getLogger ( ) -> log ( $ sLev...
Method logs IPN response to text file
44,873
protected function _getMessage ( $ sBody ) { try { $ aHeaders = array ( ) ; foreach ( $ _SERVER as $ sKey => $ sValue ) { if ( substr ( $ sKey , 0 , 5 ) !== 'HTTP_' ) { continue ; } $ sHeader = str_replace ( ' ' , '-' , str_replace ( '_' , ' ' , strtolower ( substr ( $ sKey , 5 ) ) ) ) ; $ aHeaders [ $ sHeader ] = $ sV...
Parses SNS message and saves as simplified IPN message into array
44,874
protected function _orderReferenceUpdate ( $ oData ) { $ sId = $ oData -> OrderReference -> AmazonOrderReferenceId ; $ oOrder = $ this -> _loadOrderById ( 'BESTITAMAZONORDERREFERENCEID' , $ sId ) ; if ( $ oOrder !== false && isset ( $ oData -> OrderReference -> OrderReferenceStatus -> State ) ) { $ this -> getClient ( ...
Handles response for NotificationType = OrderReferenceNotification
44,875
protected function _paymentAuthorize ( $ oData ) { $ sId = $ oData -> AuthorizationDetails -> AmazonAuthorizationId ; $ oOrder = $ this -> _loadOrderById ( 'BESTITAMAZONAUTHORIZATIONID' , $ sId ) ; if ( $ oOrder !== false && isset ( $ oData -> AuthorizationDetails -> AuthorizationStatus -> State ) ) { $ this -> getClie...
Handles response for NotificationType = PaymentAuthorize
44,876
protected function _paymentCapture ( $ oData ) { $ sId = $ oData -> CaptureDetails -> AmazonCaptureId ; $ oOrder = $ this -> _loadOrderById ( 'BESTITAMAZONCAPTUREID' , $ sId ) ; if ( $ oOrder !== false && isset ( $ oData -> CaptureDetails -> CaptureStatus -> State ) ) { $ this -> getClient ( ) -> setCaptureState ( $ oO...
Handles response for NotificationType = PaymentCapture
44,877
protected function _paymentRefund ( $ oData ) { $ sAmazonRefundId = $ oData -> RefundDetails -> AmazonRefundId ; $ sSql = "SELECT COUNT(*) FROM bestitamazonrefunds WHERE BESTITAMAZONREFUNDID = {$this->getDatabase()->quote($sAmazonRefundId)} LIMIT 1" ; $ iMatches = ( int ) $ this -> get...
Handles response for NotificationType = PaymentRefund
44,878
public function processIPNAction ( $ sBody ) { $ oMessage = $ this -> _getMessage ( $ sBody ) ; if ( isset ( $ oMessage -> NotificationData ) ) { $ oData = $ oMessage -> NotificationData ; switch ( $ oMessage -> NotificationType ) { case 'OrderReferenceNotification' : return $ this -> _orderReferenceUpdate ( $ oData ) ...
Process actions by NotificationType
44,879
public function initializeNode ( $ weightClasses ) { if ( ! $ this -> isInitialized ( ) ) { $ contentScore = 0 ; switch ( $ this -> nodeName ) { case 'div' : $ contentScore += 5 ; break ; case 'pre' : case 'td' : case 'blockquote' : $ contentScore += 3 ; break ; case 'address' : case 'ol' : case 'ul' : case 'dl' : case...
Initializer . Calculates the current score of the node and returns a full Readability object .
44,880
public function getNodeAncestors ( $ maxLevel = 3 ) { $ ancestors = [ ] ; $ level = 0 ; $ node = $ this -> parentNode ; while ( $ node && ! ( $ node instanceof DOMDocument ) ) { $ ancestors [ ] = $ node ; $ level ++ ; if ( $ level === $ maxLevel ) { break ; } $ node = $ node -> parentNode ; } return $ ancestors ; }
Get the ancestors of the current node .
44,881
public function getLinkDensity ( ) { $ linkLength = 0 ; $ textLength = mb_strlen ( $ this -> getTextContent ( true ) ) ; if ( ! $ textLength ) { return 0 ; } $ links = $ this -> getAllLinks ( ) ; if ( $ links ) { foreach ( $ links as $ link ) { $ linkLength += mb_strlen ( $ link -> getTextContent ( true ) ) ; } } retur...
Get the density of links as a percentage of the content This is the amount of text that is inside a link divided by the total text in the node .
44,882
public function getTextContent ( $ normalize = false ) { $ nodeValue = $ this -> nodeValue ; if ( $ normalize ) { $ nodeValue = trim ( preg_replace ( '/\s{2,}/' , ' ' , $ nodeValue ) ) ; } return $ nodeValue ; }
Returns the full text of the node .
44,883
public function getChildren ( $ filterEmptyDOMText = false ) { $ ret = iterator_to_array ( $ this -> childNodes ) ; if ( $ filterEmptyDOMText ) { $ ret = array_values ( array_filter ( $ ret , function ( $ node ) { return $ node -> nodeName !== '#text' || mb_strlen ( trim ( $ node -> nodeValue ) ) ; } ) ) ; } return $ r...
Returns the children of the current node .
44,884
public function getRowAndColumnCount ( ) { $ rows = $ columns = 0 ; $ trs = $ this -> getElementsByTagName ( 'tr' ) ; foreach ( $ trs as $ tr ) { $ rowspan = $ tr -> getAttribute ( 'rowspan' ) ; $ rows += ( $ rowspan || 1 ) ; $ columnsInThisRow = 0 ; $ cells = $ tr -> getElementsByTagName ( 'td' ) ; foreach ( $ cells a...
Return an array indicating how many rows and columns this table has .
44,885
public function createNode ( $ originalNode , $ tagName ) { $ text = $ originalNode -> getTextContent ( ) ; $ newNode = $ originalNode -> ownerDocument -> createElement ( $ tagName , $ text ) ; return $ newNode ; }
Creates a new node based on the text content of the original node .
44,886
public function hasAncestorTag ( $ tagName , $ maxDepth = 3 , callable $ filterFn = null ) { $ depth = 0 ; $ node = $ this ; while ( $ node -> parentNode ) { if ( $ maxDepth > 0 && $ depth > $ maxDepth ) { return false ; } if ( $ node -> parentNode -> nodeName === $ tagName && ( ! $ filterFn || $ filterFn ( $ node -> p...
Check if a given node has one of its ancestor tag name matching the provided one .
44,887
public function hasSingleTagInsideElement ( $ tag ) { if ( count ( $ children = $ this -> getChildren ( true ) ) !== 1 || $ children [ 0 ] -> nodeName !== $ tag ) { return false ; } return array_reduce ( $ children , function ( $ carry , $ child ) { if ( ! $ carry === false ) { return false ; } return ! ( $ child -> no...
Check if this node has only whitespace and a single element with given tag or if it contains no element with given tag or more than 1 element .
44,888
public function hasSingleChildBlockElement ( ) { $ result = false ; if ( $ this -> hasChildNodes ( ) ) { foreach ( $ this -> getChildren ( ) as $ child ) { if ( in_array ( $ child -> nodeName , $ this -> divToPElements ) ) { $ result = true ; } else { $ result = ( $ result || $ child -> hasSingleChildBlockElement ( ) )...
Check if the current element has a single child block element . Block elements are the ones defined in the divToPElements array .
44,889
public function shiftingAwareGetElementsByTagName ( $ tag ) { $ nodes = $ this -> getElementsByTagName ( $ tag ) ; $ count = $ nodes -> length ; for ( $ i = 0 ; $ i < $ count ; $ i = max ( ++ $ i , 0 ) ) { yield $ nodes -> item ( $ i ) ; $ nodes = $ this -> getElementsByTagName ( $ tag ) ; $ i -= $ count - $ nodes -> l...
This is a hack that overcomes the issue of node shifting when scanning and removing nodes .
44,890
private function getMetadata ( ) { $ this -> logger -> debug ( '[Metadata] Retrieving metadata...' ) ; $ values = [ ] ; $ propertyPattern = '/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|image)\s*/i' ; $ namePattern = '/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creat...
Tries to guess relevant info from metadata of the html . Sets the results in the Readability properties .
44,891
public function getImages ( ) { $ result = [ ] ; if ( $ this -> getImage ( ) ) { $ result [ ] = $ this -> getImage ( ) ; } if ( null == $ this -> getDOMDocument ( ) ) { return $ result ; } foreach ( $ this -> getDOMDocument ( ) -> getElementsByTagName ( 'img' ) as $ img ) { if ( $ src = $ img -> getAttribute ( 'src' ) ...
Returns all the images of the parsed article .
44,892
public function getMainImage ( ) { $ imgUrl = false ; if ( $ this -> getImage ( ) !== null ) { $ imgUrl = $ this -> getImage ( ) ; } if ( ! $ imgUrl ) { foreach ( $ this -> dom -> getElementsByTagName ( 'link' ) as $ link ) { if ( $ link -> hasAttribute ( 'rel' ) && ( $ link -> getAttribute ( 'rel' ) === 'img_src' || $...
Tries to get the main article image . Will only update the metadata if the getMetadata function couldn t find a correct image .
44,893
private function toAbsoluteURI ( $ uri ) { list ( $ pathBase , $ scheme , $ prePath ) = $ this -> getPathInfo ( $ this -> configuration -> getOriginalURL ( ) ) ; if ( preg_match ( '/^[a-zA-Z][a-zA-Z0-9\+\-\.]*:/' , $ uri ) ) { return $ uri ; } if ( substr ( $ uri , 0 , 2 ) === '//' ) { return $ scheme . '://' . substr ...
Convert URI to an absolute URI .
44,894
public function getPathInfo ( $ url ) { if ( $ this -> dom -> baseURI !== null ) { if ( substr ( $ this -> dom -> baseURI , 0 , 1 ) === '/' ) { $ pathBase = parse_url ( $ url , PHP_URL_SCHEME ) . '://' . parse_url ( $ url , PHP_URL_HOST ) . $ this -> dom -> baseURI ; } else { $ pathBase = parse_url ( $ url , PHP_URL_SC...
Returns full path info of an URL .
44,895
private function checkByline ( $ node , $ matchString ) { if ( ! $ this -> configuration -> getArticleByLine ( ) ) { return false ; } if ( $ this -> getAuthor ( ) ) { return false ; } $ rel = $ node -> getAttribute ( 'rel' ) ; if ( $ rel === 'author' || preg_match ( NodeUtility :: $ regexps [ 'byline' ] , $ matchString...
Checks if the node is a byline .
44,896
private function isValidByline ( $ text ) { if ( gettype ( $ text ) == 'string' ) { $ byline = trim ( $ text ) ; return ( mb_strlen ( $ byline ) > 0 ) && ( mb_strlen ( $ byline ) < 100 ) ; } return false ; }
Checks the validity of a byLine . Based on string length .
44,897
private function removeScripts ( DOMDocument $ dom ) { foreach ( [ 'script' , 'noscript' ] as $ tag ) { $ nodes = $ dom -> getElementsByTagName ( $ tag ) ; foreach ( iterator_to_array ( $ nodes ) as $ node ) { NodeUtility :: removeNode ( $ node ) ; } } }
Removes all the scripts of the html .
44,898
private function prepDocument ( DOMDocument $ dom ) { $ this -> logger -> info ( '[PrepDocument] Preparing document for parsing...' ) ; foreach ( $ dom -> shiftingAwareGetElementsByTagName ( 'br' ) as $ br ) { $ next = $ br -> nextSibling ; $ replaced = false ; while ( ( $ next = NodeUtility :: nextElement ( $ next ) )...
Prepares the document for parsing .
44,899
public function _cleanStyles ( $ node ) { if ( property_exists ( $ node , 'tagName' ) && $ node -> tagName === 'svg' ) { return ; } if ( method_exists ( $ node , 'removeAttribute' ) ) { $ presentational_attributes = [ 'align' , 'background' , 'bgcolor' , 'border' , 'cellpadding' , 'cellspacing' , 'frame' , 'hspace' , '...
Remove the style attribute on every e and under .