@ -15,6 +15,7 @@ import au.com.royalpay.payment.manage.cashback.core.CashbackService;
import au.com.royalpay.payment.manage.customers.core.CouponValidateService ;
import au.com.royalpay.payment.manage.device.core.DeviceManager ;
import au.com.royalpay.payment.manage.fund.core.impls.XPlanFundConfigServiceImpl ;
import au.com.royalpay.payment.manage.kyc.core.KycService ;
import au.com.royalpay.payment.manage.management.clearing.core.CleanService ;
import au.com.royalpay.payment.manage.mappers.client.AuthAppMessageMapper ;
import au.com.royalpay.payment.manage.mappers.log.* ;
@ -23,6 +24,7 @@ import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper ;
import au.com.royalpay.payment.manage.mappers.system.* ;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo ;
import au.com.royalpay.payment.manage.merchants.beans.ClientKycFilesInfo ;
import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo ;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService ;
import au.com.royalpay.payment.manage.merchants.core.ClientManager ;
@ -84,6 +86,7 @@ import org.jsoup.Jsoup;
import org.jsoup.nodes.Document ;
import org.slf4j.LoggerFactory ;
import org.springframework.cache.annotation.Cacheable ;
import org.springframework.context.MessageSource ;
import org.springframework.data.redis.core.StringRedisTemplate ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
@ -211,6 +214,12 @@ public class RetailAppServiceImp implements RetailAppService {
@Resource
private MpClientAppWechatApiProvider mpClientAppWechatApiProvider ;
@Resource
private KycService kycService ;
@Resource
private ClientComplianceCompanyMapper clientComplianceCompanyMapper ;
@Resource
private MessageSource messageSource ;
@Resource
private DeviceManager deviceManager ;
private final String CBBANK_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/05/1564972204689_uwZvpTBjtLUMcN8c540xcZvux1Rd3O.pdf" ;
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/10/22/1571723034726_5xK6A0FGv5aQPbMIDJzXJrUPKHFutv.pdf" ;
@ -2448,6 +2457,76 @@ public class RetailAppServiceImp implements RetailAppService {
return authFileStatus ;
}
@Override
public JSONObject getClientAuthFileStatusAggregate ( JSONObject device ) {
String clientType = device . getString ( "client_type" ) ;
deviceSupport . findRegister ( clientType ) ;
JSONObject client = clientMapper . findClient ( device . getIntValue ( "client_id" ) ) ;
JSONObject account = clientAccountMapper . findById ( device . getString ( "account_id" ) ) ;
JSONObject authFileStatus = new JSONObject ( ) ;
authFileStatus . put ( "title" , messageSource . getMessage ( "client.auth.file.aggregate.title" , null , RequestEnvironment . getLocale ( ) ) ) ;
authFileStatus . put ( "content" , messageSource . getMessage ( "client.auth.file.title" , null , RequestEnvironment . getLocale ( ) ) ) ;
List < JSONObject > supplement_array = new ArrayList < > ( ) ;
JSONObject complianceFilesNotice = complianceFilesNotice ( client , account ) ;
JSONObject kycFilesNotice = kycFilesNotice ( client , account ) ;
if ( PartnerRole . getRole ( account . getIntValue ( "role" ) ) = = PartnerRole . CASHIER ) {
return null ;
}
if ( complianceFilesNotice ! = null ) {
supplement_array . add ( complianceFilesNotice ) ;
}
if ( kycFilesNotice ! = null ) {
supplement_array . add ( kycFilesNotice ) ;
}
authFileStatus . put ( "supplement_array" , supplement_array ) ;
return authFileStatus ;
}
public JSONObject complianceFilesNotice ( JSONObject client , JSONObject account ) {
JSONObject complianceFilesNotice = new JSONObject ( ) ;
JSONObject complianceFileStatus = signInAccountService . checkAuthFileStatus ( client ) ;
if ( ! complianceFileStatus . getBoolean ( "client_less_file" ) ) {
return null ;
}
JSONObject compliance = clientComplianceCompanyMapper . findFileByClientId ( account . getIntValue ( "client_id" ) ) ;
complianceFilesNotice . put ( "type" , messageSource . getMessage ( "client.auth.file.compliance.type" , null , RequestEnvironment . getLocale ( ) ) ) ;
complianceFilesNotice . put ( "deadline" , messageSource . getMessage ( "client.auth.file.aggregate.deadline" , null , RequestEnvironment . getLocale ( ) ) ) ;
complianceFilesNotice . put ( "root_url" , "111" ) ;
complianceFilesNotice . put ( "client_less_file" , complianceFileStatus . getBoolean ( "client_less_file" ) ) ;
if ( compliance ! = null ) {
complianceFilesNotice . put ( "refused_reason" , compliance . getString ( "description" ) ) ;
complianceFilesNotice . put ( "status" , compliance . getString ( "status" ) ) ;
}
return complianceFilesNotice ;
}
public JSONObject kycFilesNotice ( JSONObject client , JSONObject account ) {
JSONObject kycFilesNotice = new JSONObject ( ) ;
JSONObject kycFileStatus = signInAccountService . checkKycFileStatusForApp ( client , account ) ;
JSONObject compliance = clientComplianceCompanyMapper . findKycFileByClientId ( account . getIntValue ( "client_id" ) ) ;
if ( ! kycFileStatus . getBoolean ( "client_less_file" ) ) {
return null ;
}
kycFilesNotice . put ( "type" , messageSource . getMessage ( "client.auth.file.kyc.type" , null , RequestEnvironment . getLocale ( ) ) ) ;
kycFilesNotice . put ( "deadline" , messageSource . getMessage ( "client.auth.file.aggregate.deadline" , null , RequestEnvironment . getLocale ( ) ) ) ;
kycFilesNotice . put ( "root_url" , "111" ) ;
kycFilesNotice . put ( "client_less_file" , kycFileStatus . getBoolean ( "client_less_file" ) ) ;
if ( compliance ! = null ) {
kycFilesNotice . put ( "refused_reason" , compliance . getString ( "description" ) ) ;
kycFilesNotice . put ( "status" , compliance . getString ( "status" ) ) ;
}
return kycFilesNotice ;
}
@Override
public JSONObject getSourceAggregateFile ( JSONObject device ) {
String clientType = device . getString ( "client_type" ) ;
@ -2560,6 +2639,17 @@ public class RetailAppServiceImp implements RetailAppService {
return clientManager . uploadAuthFilesForWaitCompliance ( account , client . getString ( "client_moniker" ) , clientAuthFilesInfo ) ;
}
@Override
public List < JSONObject > uploadKycAuthFiles ( JSONObject device , ClientKycFilesInfo clientKycFilesInfo ) {
String clientType = device . getString ( "client_type" ) ;
deviceSupport . findRegister ( clientType ) ;
JSONObject client = clientManager . getClientInfo ( device . getIntValue ( "client_id" ) ) ;
JSONObject account = clientAccountMapper . findById ( device . getString ( "account_id" ) ) ;
clientKycFilesInfo . setAuthStatus ( 0 ) ;
return clientManager . uploadKycFilesForWaitCompliance ( account , client . getString ( "client_moniker" ) , clientKycFilesInfo ) ;
}
@Override
public void deleteGreenChannelAuthFiles ( JSONObject device , String fileId ) {
String clientType = device . getString ( "client_type" ) ;
@ -2577,6 +2667,15 @@ public class RetailAppServiceImp implements RetailAppService {
clientManager . commitAuthFilesToCompliance ( client . getString ( "client_moniker" ) , account , "App" ) ;
}
@Override
public void commitAuthFilesToKyc ( JSONObject device ) {
String clientType = device . getString ( "client_type" ) ;
deviceSupport . findRegister ( clientType ) ;
JSONObject client = clientManager . getClientInfo ( device . getIntValue ( "client_id" ) ) ;
JSONObject account = clientAccountMapper . findById ( device . getString ( "account_id" ) ) ;
kycService . commitAuthKycFilesToCompliance ( client . getString ( "client_moniker" ) , account , "App" ) ;
}
public JSONObject getClientSubManage ( JSONObject device ) {
JSONObject result = new JSONObject ( ) ;
String clientType = device . getString ( "client_type" ) ;