private boolean checkMerchant ( PurchaseDataModel details ) { if ( developerMerchantId == null ) //omit merchant id checking return true ; if ( details . getPurchaseTime ( ) . before ( dateMerchantLimit1 ) ) //new format [merchantId].[orderId] applied or not? return true ; if ( details . getPurchaseTime ( ) . after ( dateMerchantLimit2 ) ) //newest format applied return true ; if ( details . getOrderId ( ) == null || details . getOrderId ( ) . trim ( ) . length ( ) == 0 ) return false ; int index = details . getOrderId ( ) . indexOf ( ' ' ) ; if ( index <= 0 ) return false ; //protect on missing merchant id //extract merchant id String merchantId = details . getOrderId ( ) . substring ( 0 , index ) ; return merchantId . compareTo ( developerMerchantId ) == 0 ; }
Checks merchant s id validity . If purchase was generated by Freedom alike program it doesn t know real merchant id unless publisher GoogleId was hacked If merchantId was not supplied function checks nothing