is_collected === self::COLLECTED_BY_MERCHANT ? self::COLLECTED_BY_MERCHANT : self::COLLECTED_BY_CREDIT_FAIR; } /** * The full processing fee collection method, preserving all three values and * NULL. Use this when seeding `pro_forma_invoice.processing_fee_collection_method` * so that "add in loan amount" propagates from the merchant default to the * application, and an unconfigured merchant leaves the application unset. * * @return int|null 0, 1, 2 or null */ public function processingFeeCollectionMethod() { return is_null($this->is_collected) ? null : (int) $this->is_collected; } public function merchant_category() { return $this->hasOne('App\MerchantCategory','id','category_id'); } public function gst_authentication(){ return $this->hasOne('App\KarzaAPI','merchant_id','id'); } public function merchant_category_many() { return $this->hasMany('App\MerchantCategory','id','category_id'); } public function bank_details() { return $this->hasOne('App\MerchantBank','merchant_id','id'); } public function offer() { return $this->hasMany('App\MerchantOffers','merchant_id','id'); } public function module() { return $this->hasMany('App\MerchantModule','merchant_id','id')->where('status','>',0); } public function moduleAll() { return $this->hasMany('App\MerchantModule','merchant_id','id'); } public function gst_filling_data() { return $this->hasMany('App\MerchantGstFillingData','merchant_id','id')->where('type','merchant_id'); } public function centers() { return $this->hasMany('App\MerchantLocation','merchant_id','id'); } public function digital_sign() { return $this->hasOne('App\DigitalSignDetails','application_id','id') ->where('type','merchant'); } public function grade() { return $this->hasOne('App\Grades','id','grade_id'); } public function grade_v1() { return $this->hasOne('App\GradesV1','id','grade_id'); } public function custom_grade(){ return $this->hasOne('App\CustomGradesMain','id','custom_grade_id'); } public function document_rule() { return $this->hasMany('App\DocumentRule','grade_id','grade_id'); } public function preApproval() { return $this->hasMany('App\PreApproval','grade_id','grade_id'); } public function autoRejectConsumer() { return $this->hasOne('App\AutoReject','grade_id','grade_id')->where('for_consumer', 1); } public function autoReject() { return $this->hasOne('App\AutoReject','grade_id','grade_id')->where('for_consumer', 0); } public function autoRejectRule() { return $this->hasMany('App\AutoRejectRule','grade_id','grade_id'); } public function applications(){ return $this->hasMany('App\ConsumerApplication','merchant_id','id'); } public function users(){ return $this->hasMany('App\User','merchant_id','id'); } public function rm_exotel(){ return $this->hasMany('App\User','id','rm_id')->where('user_availability',1)->whereNull('deleted_at'); } public function rmDetails(){ return $this->hasOne('App\User','id','rm_id')->whereNull('deleted_at'); } public function active_offers(){ return $this->hasMany('App\MerchantOffers','merchant_id','id')->where('status',"=",1); } public function calls(){ return $this->hasMany('App\CallLogs','_id','id')->where('id_type','merchant_id')->where(function ($query) { $query->whereNull('status') ->orWhereIn('status', ['in-progress','ringing']); }); } public function anchorMerchant(){ return $this->hasOne('App\Merchant','id','anchor_merchant_id')->select('id','merchant_name'); } public function adjustable_transaction(){ return $this->hasMany('App\PaymentTransaction','collected_by','id')->where('collected_by_type',2)->where('adjust_with_disbursement',1)->where('adjusted_to', 0)->where('status','success')->select('id','collected_by','application_id','amount'); } public function products() { return $this->hasMany('App\Products','merchant_id','id'); } public function merchant_logs(){ return $this->hasMany('App\MerchantLogs', 'merchant_id', 'id'); } public function webhook(){ return $this->hasMany('App\Webhook', 'merchant_id', 'id'); } public function credential(){ return $this->hasOne('App\MerchantApiCredentials', 'merchant_id', 'id')->where('status', 1); } public function merchant_files() { return $this->hasOne('App\MerchantFiles', 'merchant_id', 'id')->whereNull('type')->where('file_type','signed_agreement'); } public function fldg_categories(){ return $this->hasMany('App\FLDGCategory', 'merchant_id', 'id')->whereNull('deleted_at'); } public function risk_mitigation(){ return $this->hasOne('App\MerchantRiskMitigation', 'merchant_id', 'id'); } }