You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

992 lines
78 KiB

3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_GetHoldedTxnForApprovedByAdminCompliance] Script Date: 7/24/2024 10:33:52 AM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. -- =============================================
  9. -- Author: <Author,Anoj Kattel>
  10. -- Create date: <Create Date,2019/04/23>
  11. -- Description: <Description,This sp is used for get transaction going for approv by admin>
  12. -- Modified on: 2021/06/03 -> Add mapping for Dongav2
  13. -- -> Add mapping for BOC
  14. --#5402 fix REMITTENCETYPE for BOC
  15. --EXEC proc_GetHoldedTxnForApprovedByAdminCompliance @user = 'scheduler', @tranId = '100644593', @callFro = null
  16. --select * FROM remittran where holdtranid='10385635'
  17. -- =============================================
  18. ALTER PROCEDURE [dbo].[proc_GetHoldedTxnForApprovedByAdminCompliance]
  19. (
  20. -- Add the parameters for the stored procedure here
  21. @user VARCHAR(50),
  22. @tranId VARCHAR(100),
  23. @callFro VARCHAR(30)
  24. )
  25. AS
  26. BEGIN
  27. -- SET NOCOUNT ON added to prevent extra result sets from
  28. -- interfering with SELECT statements.
  29. -- #9387 - Cebuana
  30. -- #12184 - Wing Cambodia Integration
  31. SET NOCOUNT ON;
  32. DECLARE @PartnerId VARCHAR(100),
  33. @tranStatus VARCHAR(100)
  34. SELECT @PartnerId=pSuperAgent,@tranStatus=tranStatus FROM dbo.remitTran WHERE id=@tranId
  35. --IF @tranStatus <> 'Hold'
  36. --BEGIN
  37. --IF @callFro!='txnHoldRelease'
  38. -- BEGIN
  39. -- SELECT 'NotForTPAPI' ErrorCode, @tranStatus msg,@tranId id
  40. -- END
  41. --END
  42. BEGIN TRY
  43. IF @PartnerId='394130' --- for transfast
  44. BEGIN
  45. SELECT DISTINCT
  46. RTT.id tranId
  47. ,'transfast' processId
  48. ,RTT.createdDate txnDate
  49. ,AU.userName userName
  50. ,ISNULL(am.parentId,0) partnerId
  51. ,ISNULL(cm.customerId,0) customerId
  52. ,isFirstTran 'Y'
  53. ,'' sfirstName
  54. ,'' smiddleName
  55. ,'' slastName1
  56. ,'' slastName2
  57. ,CM.fullName sfullName
  58. ,CM.idIssueDate sissuedDate
  59. ,CM.idExpiryDate svalidDate
  60. ,CM.dob sdob
  61. ,TST.email semail
  62. ,CASE WHEN SCC.CITY_CODE = '113179' THEN '113071'
  63. ELSE SCC.CITY_CODE END scity
  64. ,CASE WHEN SSC.STATE_CODE = 'JP037' THEN 'JP036'
  65. ELSE SSC.STATE_CODE END sstate
  66. --,SSC.STATE_CODE sstate
  67. ,CM.zipCode szipCode
  68. ,SNCC.countryCode snativeCountry
  69. ,CASE CM.idType
  70. WHEN 'Business Registation' THEN 'BZ'
  71. WHEN 'DRIVERS LICENSE' THEN 'DL'
  72. WHEN 'National ID' THEN 'G2'
  73. WHEN 'PASSPORT' THEN 'PA'
  74. WHEN 'Tohon' THEN 'BZ'
  75. ELSE 'PA'
  76. END sidType --- map idtype name and code with transfast sender idtype value
  77. ,CM.idNumber sidNumber
  78. ,REPLACE(CM.mobile,'+','') smobile
  79. ,CASE
  80. WHEN CM.customerType='4700'
  81. THEN 1
  82. ELSE 0 END IsIndividual
  83. ,ISNULL(CM.address,CM.city) saddress
  84. ,ISNULL(cm.occupation,0) occupationId
  85. ,ISNULL(OCU.detailTitle,0) occupationName
  86. ,'JP' sCountry
  87. --------- receiver details
  88. ,ISNULL(TRT.id,0) receiverId
  89. ,TRT.firstName rfirstName
  90. ,TRT.middleName rmiddleName
  91. ,TRT.lastName1 rlastName1
  92. ,TRT.firstName
  93. +ISNULL(' ' +TRT.middleName,'')
  94. +ISNULL(' '+TRT.lastName1,'')
  95. +ISNULL(' '+TRT.lastName2,'')
  96. rfullName
  97. ,CASE RCON.countryCode
  98. WHEN 'LK' THEN --------- for sri lanka
  99. CASE TRT.idType
  100. WHEN 'Driver License' THEN '188'
  101. WHEN 'Business Registation' THEN '189'
  102. WHEN 'National ID' THEN '195'
  103. WHEN 'Passport' THEN '197'
  104. ELSE '195'
  105. END
  106. WHEN 'ID' THEN -- indonesia
  107. CASE TRT.idType
  108. WHEN 'Driver License' THEN '286'
  109. WHEN 'Passport' THEN '287'
  110. WHEN 'National ID' THEN '288'
  111. ELSE '287'
  112. END
  113. WHEN 'PH' THEN -- PHILIPPINES
  114. CASE TRT.idType
  115. WHEN 'Tohon' THEN '307'
  116. WHEN 'Driver License' THEN '310'
  117. WHEN 'Passport' THEN '316'
  118. WHEN 'Alien Registration Card' THEN '326'
  119. ELSE '316'
  120. END
  121. WHEN 'PK' THEN --- pakistan
  122. CASE TRT.idType
  123. WHEN 'Passport' THEN '270'
  124. WHEN 'Business Registation' THEN '272'
  125. WHEN 'Driver License' THEN '269'
  126. WHEN 'National ID' THEN '271'
  127. ELSE '270'
  128. END
  129. WHEN 'BD' THEN --- bangladesh
  130. CASE TRT.idType
  131. WHEN 'Passport' THEN '12'
  132. WHEN 'National ID' THEN '13'
  133. WHEN 'Driver License' THEN '14'
  134. WHEN 'Business Registation' THEN '16'
  135. ELSE '430'
  136. END
  137. WHEN 'IN' THEN --- india
  138. CASE TRT.idType
  139. WHEN 'Passport' THEN '136'
  140. WHEN 'Business Registation' THEN '137'
  141. WHEN 'Alien Registration Card' THEN '140'
  142. WHEN 'Driver License' THEN '142'
  143. WHEN 'National ID' THEN '329'
  144. ELSE '136'
  145. END
  146. END
  147. ridType --- map with transfast receiver idtype id code
  148. ,TRT.idNumber ridNumber
  149. ,TRT.validDate rvalidDate
  150. ,TRT.dob rdob
  151. ,TRT.homePhone rhomePhone
  152. ,TRT.mobile rmobile
  153. ,RNC.countryCode rnativeCountry
  154. ,ISNULL(TRT.city,TRT.address) rcity
  155. ,TRT.address raddress
  156. ,TRT.email remail
  157. ,raccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  158. ,RCON.countryCode rcountry
  159. ,'' branchId
  160. --,CASE RTT.paymentMethod
  161. -- WHEN 'Bank Deposit' THEN APBL.BRANCH_CODE
  162. -- WHEN 'Cash Payment' THEN ABBL.BRANCH_CODE1 END branchId -------- Need To Map With Transfast PayingBranchId
  163. ,CASE RTT.paymentMethod
  164. WHEN 'Bank Deposit' THEN PBD.PAYER_CODE
  165. WHEN 'Cash Payment' THEN ABL.BANK_CODE1 END payerId -------- Need To Map With Transfast PayerId
  166. ,TRT.branchName branchName
  167. ,AU.city city
  168. ,ISNULL(RTT.pAgent,0) pAgent
  169. ,RTT.pAgentName pAgentName
  170. ,RTT.pBankType pBankType
  171. ,CASE RTT.paymentMethod
  172. WHEN 'Bank Deposit' THEN ISNULL(ABL.BANK_CODE1,'')
  173. ELSE '' END pBank
  174. ,ISNULL(abl.BANK_CODE2,0) pBankLocation
  175. ,CASE RTT.paymentMethod
  176. WHEN 'Bank Deposit' THEN ISNULL(ABBL.BRANCH_CODE1,'')
  177. ELSE '' END pBankBranchId
  178. ,RTT.pBankName pBankName
  179. ,RTT.payoutCurr payoutCurr
  180. ,RTT.collCurr collCurr
  181. ,ISNULL(RTT.cAmt,0) cAmt
  182. ,ISNULL(RTT.pAmt,0) pAmt
  183. ,ISNULL(RTT.tAmt,0) tAmt
  184. ,serviceCharge serviceCharge
  185. ,ISNULL(RTT.pAgentComm,0) pAgentComm
  186. ,CASE RCON.countryCode
  187. WHEN 'LK' THEN
  188. CASE RTT.purposeOfRemit
  189. WHEN 'Family maintenance' THEN '1'
  190. WHEN 'Educational expenses' THEN '2'
  191. WHEN 'Medical Expenses' THEN '3'
  192. WHEN 'Business travel' THEN '7'
  193. WHEN 'Trading' THEN '14'
  194. WHEN 'Savings' THEN '18'
  195. WHEN 'Purchase of land / property' THEN '23'
  196. WHEN 'Utility payment' THEN '24'
  197. WHEN 'Rent' THEN '25'
  198. WHEN 'Personal travels and tours' THEN '26'
  199. WHEN 'Trading' THEN '27'
  200. WHEN 'Salary / Commission' THEN '29'
  201. WHEN 'Loan payment / Interest' THEN '30'
  202. ELSE '1'
  203. END
  204. WHEN 'ID' THEN
  205. CASE RTT.purposeOfRemit
  206. WHEN 'Family maintenance' THEN '1'
  207. WHEN 'Educational expenses' THEN '2'
  208. WHEN 'Medical Expenses' THEN '3'
  209. WHEN 'Purchase of land / property' THEN '9'
  210. WHEN 'Trading' THEN '14'
  211. WHEN 'Savings' THEN '18'
  212. WHEN 'Utility payment' THEN '24'
  213. WHEN 'Personal travels and tours' THEN '26'
  214. WHEN 'Loan payment / Interest' THEN '30'
  215. ELSE '1'
  216. END
  217. WHEN 'PH' THEN
  218. CASE RTT.purposeOfRemit
  219. WHEN 'Family maintenance' THEN '1'
  220. WHEN 'Educational expenses' THEN '2'
  221. WHEN 'Medical Expenses' THEN '3'
  222. WHEN 'Business travel' THEN '7'
  223. WHEN 'Trading' THEN '14'
  224. WHEN 'Savings' THEN '18'
  225. WHEN 'Purchase of land / property' THEN '23'
  226. WHEN 'Utility payment' THEN '24'
  227. WHEN 'Personal travels and tours' THEN '26'
  228. WHEN 'Trading' THEN '27'
  229. WHEN 'Salary / Commission' THEN '29'
  230. WHEN 'Loan payment / Interest' THEN '30'
  231. ELSE '1'
  232. END
  233. WHEN 'PK' THEN
  234. CASE RTT.purposeOfRemit
  235. WHEN 'Family maintenance' THEN '1'
  236. WHEN 'Educational expenses' THEN '2'
  237. WHEN 'Medical Expenses' THEN '3'
  238. WHEN 'Trading' THEN '14'
  239. WHEN 'Savings' THEN '18'
  240. WHEN 'Purchase of land / property' THEN '23'
  241. WHEN 'Utility payment' THEN '24'
  242. WHEN 'Personal travels and tours' THEN '26'
  243. WHEN 'Loan payment / Interest' THEN '30'
  244. ELSE '1'
  245. END
  246. WHEN 'BD' THEN
  247. CASE RTT.purposeOfRemit
  248. WHEN 'Family maintenance' THEN '1'
  249. WHEN 'Educational expenses' THEN '2'
  250. WHEN 'Medical Expenses' THEN '3'
  251. WHEN 'Purchase of land / property' THEN '9'
  252. WHEN 'Trading' THEN '14'
  253. WHEN 'Savings' THEN '18'
  254. WHEN 'Utility payment' THEN '24'
  255. WHEN 'Personal travels and tours' THEN '26'
  256. WHEN 'Loan payment / Interest' THEN '30'
  257. ELSE '1'
  258. END
  259. WHEN 'IN' THEN
  260. CASE RTT.purposeOfRemit
  261. WHEN 'Family maintenance' THEN '1'
  262. WHEN 'Savings' THEN '18'
  263. WHEN 'Purchase of land / property' THEN '23'
  264. WHEN 'Educational expenses' THEN '24'
  265. WHEN 'Rent' THEN '25'
  266. WHEN 'Personal travels and tours' THEN '26'
  267. WHEN 'Trading' THEN '27'
  268. WHEN 'Utility payment' THEN '28'
  269. WHEN 'Salary / Commission' THEN '29'
  270. WHEN 'Loan payment / Interest' THEN '30'
  271. WHEN 'Medical Expenses' THEN '32'
  272. ELSE '1'
  273. END
  274. END purposeOfRemit ----------- Map With Transfast code
  275. ,CASE RTT.sourceOfFund
  276. WHEN 'Own business' THEN '1'
  277. WHEN 'Business' THEN '2'
  278. WHEN 'Salary / Wages' THEN '3'
  279. WHEN 'Return from Investment' THEN '4'
  280. WHEN 'Loan from bank' THEN '5'
  281. WHEN 'Lottery' THEN '6'
  282. WHEN 'Part time job' THEN '7'
  283. WHEN 'Pension' THEN '8'
  284. WHEN 'Savings or accumulated' THEN '10'
  285. ELSE '9'
  286. END sourceOfFund
  287. ,rel.detailTitle relationName
  288. ,cm.remarks remarks
  289. ,ISNULL(RTT.sAgent,0) sAgent
  290. ,RTT.sAgentName sAgentName
  291. ,ISNULL(RTT.sSuperAgent,0) sSuperAgent
  292. ,cm.ipAddress ipAddress
  293. ,AU.countryId countryId
  294. ,RSC.STATE_CODE rstate ----- Receiver State Code
  295. ,ISNULL(RTT.sBranch,0) sBranch
  296. ,RTT.pLocation pLocation
  297. ,CASE RTT.paymentMethod
  298. WHEN 'Bank Deposit' THEN 'C'
  299. WHEN 'Cash Payment' THEN '2'
  300. END paymentMethod -------- map with transfast payoutmethod id
  301. ,dbo.decryptDb(RTT.controlNo) controlNo
  302. ,RCC.CITY_CODE rcityCode ----- Receiver City Code
  303. ,RTC.TOWN_CODE rTownCode ----- Receiver Town Code
  304. ,cm.sessionId sessionId
  305. ,'true' IsRealtime
  306. ,bankAccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  307. ,'CA' formOfPaymentId
  308. ,CM.SSNNO ssnno
  309. ,RTT.customerrate Rate
  310. ,'N' IsRealtime
  311. FROM remitTran RTT WITH(NOLOCK)
  312. INNER JOIN dbo.tranSenders TST(NOLOCK) ON TST.TRANID = RTT.ID
  313. INNER JOIN customerMaster CM(NOLOCK) ON CM.customerId = TST.customerId
  314. INNER JOIN dbo.tranReceivers TRT(NOLOCK) ON TRT.TRANID = RTT.id
  315. LEFT JOIN applicationUsers AU(NOLOCK) ON AU.USERNAME = RTT.CREATEDBY
  316. LEFT JOIN dbo.agentMaster AM(NOLOCK) ON AM.agentId=RTT.pAgent
  317. LEFT JOIN API_BANK_LIST ABL (NOLOCK) ON ABL.BANK_ID=RTT.pBank
  318. LEFT JOIN dbo.API_BANK_BRANCH_LIST ABBL (NOLOCK) ON ABBL.BRANCH_ID=RTT.pBankBranch -- OR ABBL.BRANCH_NAME=RTT.pBankBranchName
  319. LEFT JOIN dbo.staticDataValue OCU (NOLOCK) ON OCU.valueId=cm.occupation
  320. LEFT JOIN dbo.staticDataValue REL (NOLOCK) ON REL.detailTitle=RTT.relWithSender
  321. --LEFT JOIN dbo.staticDataValue IDT (NOLOCK) ON IDT.valueId=TRT.idType
  322. LEFT JOIN dbo.countryStateMaster CSM(NOLOCK) ON CSM.stateId=cm.state
  323. LEFT JOIN dbo.API_CITY_LIST SCC (NOLOCK) ON SCC.CITY_NAME=CM.city
  324. LEFT JOIN dbo.API_STATE_LIST SSC (NOLOCK) ON SSC.STATE_ID=SCC.STATE_ID
  325. LEFT JOIN dbo.API_STATE_LIST RSC (NOLOCK) ON RSC.STATE_NAME=TRT.STATE
  326. LEFT JOIN dbo.API_CITY_LIST RCC (NOLOCK) ON SCC.CITY_NAME=TRT.city
  327. LEFT JOIN dbo.API_TOWN_LIST RTC (NOLOCK) ON RTC.TOWN_ID=RTT.pLocation
  328. LEFT JOIN dbo.countryMaster SNCC (NOLOCK) ON SNCC.countryId=CM.country
  329. LEFT JOIN dbo.countryMaster RCON (NOLOCK) ON RCON.countryName=TRT.country
  330. LEFT JOIN dbo.countryMaster RNC (NOLOCK) ON RNC.countryName=TRT.NativeCountry OR RNC.countryId = TRT.NativeCountry
  331. LEFT JOIN dbo.PAYER_BANK_DETAILS PBD(NOLOCK) ON PBD.PAYER_ID = RTT.PayerId
  332. --LEFT JOIN dbo.API_PAYOUT_LOACTION APL(NOLOCK) ON APL.Id=RTT.PayerId
  333. --LEFT JOIN dbo.API_PAYOUT_BRANCH_LOACTION APBL (NOLOCK) ON APBL.Id=RTT.PayerBranchId
  334. WHERE RTT.id =@tranId
  335. END
  336. IF @PartnerId= '394397' ----- For GME NEPAL
  337. BEGIN
  338. SELECT
  339. RTT.id tranId ----
  340. ,'gmenepal' processId
  341. ,CONVERT(VARCHAR, RTT.createdDate, 110) txnDate
  342. ,AU.userName userName -- notes -- Filds are use for jme nepal send model
  343. ,ISNULL(AM.parentId,0) partnerId ---- use for to get thirdparty api partner services
  344. ,ISNULL(CM.customerId,0) customerId
  345. ,isFirstTran 'Y' ----
  346. ,'' sfirstName
  347. ,'' smiddleName
  348. ,'' slastName1
  349. ,'' slastName2
  350. ,CM.fullName sfullName --
  351. ,TST.address saddress --
  352. ,CM.mobile smobile --
  353. ,tst.city scity --
  354. ,RTT.sCountry sCountry --
  355. ,TST.idType sidType --
  356. ,TST.idNumber sidNumber --
  357. ,TRT.fullName rfullName --
  358. ,TRT.address raddress --
  359. ,TRT.mobile rmobile --
  360. ,ISNULL(TRT.city,TRT.address) rcity --
  361. ,TRT.country rcountry --
  362. ,RTT.sourceOfFund sourceOfFund --
  363. ,RTT.relwithsender relationName --
  364. ,RTT.purposeOfRemit purposeOfRemit --
  365. ,ISNULL(RTT.cAmt,0) cAmt --
  366. ,ISNULL(RTT.pAmt,0) pAmt --
  367. ,ISNULL(RTT.tAmt,0) tAmt --
  368. ,RTT.paymentMethod paymentMethod --
  369. ,RTT.pBankName pBankName --
  370. ,ISNULL(PBID.BANK_CODE1,0) pBank --
  371. ,pBankLocation = CASE WHEN PBID.BANK_CODE1='11006083' THEN PBID.BANK_CODE2 ELSE ISNULL(PBBID.BRANCH_CODE1,'0') END
  372. ,ISNULL(PBBID.BRANCH_NAME,'') pBankBranchName --
  373. ,raccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  374. ,CM.idIssueDate sissuedDate --
  375. ,CM.idExpiryDate svalidDate --
  376. ,CM.dob sdob --
  377. ,'' semail
  378. ,'' szipCode
  379. ,CM.nativeCountry snativeCountry --
  380. ,0 occupationId
  381. ,CASE WHEN CM.occupation = '11383' THEN CM.occupationother ELSE ISNULL(OCU.detailTitle,0) END occupationName --
  382. --------- receiver details
  383. ,'' receiverId
  384. ,'' rfirstName
  385. ,'' rmiddleName
  386. ,'' rlastName1
  387. ,'' ridType
  388. ,'' ridNumber
  389. ,'' rvalidDate
  390. ,'' rdob
  391. ,'' rhomePhone
  392. --,RE.countryCode
  393. ,'' rnativeCountry
  394. ,'' remail
  395. ,'' branchId
  396. ,'' branchName
  397. ,'' city
  398. ,0 pAgent
  399. ,'' pAgentName
  400. ,'' pBankType
  401. ,RTT.payoutCurr
  402. ,RTT.collCurr
  403. ,RTT.SERVICECHARGE serviceCharge --
  404. ,'' pAgentComm
  405. ,'' relationId
  406. ,'' remarks
  407. ,0 sAgent
  408. ,'' sAgentName
  409. ,0 sSuperAgent
  410. ,'' ipAddress
  411. ,0 countryId
  412. ,'' rstate
  413. ,0 sBranch
  414. ,'' pLocation
  415. ,dbo.decryptDb(RTT.controlNo) controlNo --
  416. ,0 exRate
  417. ,'' rcityCode
  418. ,CM.sessionId sessionId ----
  419. ,'true' IsRealtime ----
  420. ,bankAccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  421. ,'Y' IsRealtime
  422. ,RTT.company exRateConfirmId
  423. ,ISNULL(RTT.pCurrCostRate,0) SettlementDollarRate
  424. FROM remitTran RTT WITH(NOLOCK)
  425. INNER JOIN dbo.tranSenders TST(NOLOCK) ON TST.TRANID = RTT.ID
  426. INNER JOIN customerMaster CM(NOLOCK) ON CM.customerId = TST.customerId
  427. INNER JOIN dbo.tranReceivers TRT(NOLOCK) ON TRT.TRANID = RTT.ID
  428. LEFT JOIN applicationUsers AU(NOLOCK) ON AU.USERNAME = RTT.CREATEDBY
  429. INNER JOIN dbo.agentMaster AM(NOLOCK) ON AM.agentId=RTT.pAgent
  430. LEFT JOIN API_BANK_LIST PBID (NOLOCK) ON PBID.BANK_ID=RTT.pBank
  431. LEFT JOIN dbo.API_BANK_BRANCH_LIST PBBID (NOLOCK) ON PBBID.BRANCH_ID=RTT.pBankBranch
  432. LEFT JOIN dbo.staticDataValue OCU (NOLOCK) ON OCU.valueId=TST.occupation
  433. LEFT JOIN dbo.staticDataValue REL (NOLOCK) ON REL.valueId=CM.relationId
  434. WHERE RTT.id = @tranId
  435. END
  436. IF @PartnerId= '394449' ----- For GCC REMIT
  437. BEGIN
  438. SELECT
  439. RTT.id tranId ----
  440. ,'gccremit' processId
  441. ,CONVERT(VARCHAR, RTT.createdDate, 110) txnDate
  442. ,AU.userName userName -- notes -- Filds are use for jme nepal send model
  443. ,ISNULL(AM.parentId,0) partnerId ---- use for to get thirdparty api partner services
  444. ,ISNULL(CM.customerId,0) customerId
  445. ,isFirstTran 'Y' ----
  446. ,CM.firstName sfirstName
  447. ,CM.middleName smiddleName
  448. ,CM.lastName1 slastName1
  449. ,CM.lastName2 slastName2
  450. ,CM.fullName sfullName --
  451. ,ISNULL(TST.address, CM.address) saddress --
  452. ,CM.mobile smobile --
  453. ,CM.email semail
  454. ,tst.city scity --
  455. ,sCON.countryCode sCountry --
  456. ,CASE TST.idType
  457. WHEN 'PASSPORT' THEN '2'
  458. WHEN 'DRIVER LICENSE' THEN '4'
  459. WHEN 'Biometric Residence Permit' THEN '5'
  460. ELSE '2'
  461. END As sidType --
  462. ,TST.idNumber sidNumber --
  463. ,TRT.fullName rfullName --
  464. ,TRT.address raddress --
  465. ,TRT.mobile rmobile --
  466. ,ISNULL(TRT.city,TRT.address) rcity --
  467. ,TRT.country rcountry --
  468. ,CASE RTT.sourceOfFund
  469. WHEN 'Business Income' THEN '5'
  470. WHEN 'Salary' THEN '2'
  471. ELSE '5'
  472. END sourceOfFund
  473. --,RTT.relwithsender relationName --
  474. , CASE RTT.relwithsender
  475. WHEN 'Business Partner' THEN '7' -- RTR001 FAMILY
  476. WHEN 'Friend' THEN '3'
  477. WHEN 'Parents' THEN '1'
  478. WHEN 'Self' THEN '5'
  479. WHEN 'Husband/Wife' THEN '12'
  480. ELSE '1'
  481. END relationName --
  482. ,CASE RTT.purposeOfRemit
  483. WHEN 'Family Support' THEN '1'
  484. WHEN 'Education Support' THEN '4'
  485. WHEN 'Investment' THEN '8'
  486. WHEN 'Loan Payment' THEN '9'
  487. WHEN 'Medical Support' THEN '2'
  488. WHEN 'Salary Payments' THEN '10'
  489. WHEN 'Personal Savings' THEN '6'
  490. ELSE '1'
  491. END AS purposeOfRemit
  492. ,ISNULL(RTT.cAmt,0) cAmt --
  493. ,ISNULL(RTT.pAmt,0) pAmt --
  494. ,ISNULL(RTT.tAmt,0) tAmt --
  495. ,CASE
  496. WHEN RTT.pCountry = 'INDIA' and RTT.paymentMethod = 'Bank Deposit' THEN '9'
  497. WHEN RTT.pCountry = 'BANGLADESH' and RTT.paymentMethod = 'Bank Deposit' THEN '3'
  498. WHEN RTT.pCountry = 'HONG KONG' and RTT.paymentMethod = 'Bank Deposit' THEN '2'
  499. WHEN RTT.pCountry = 'PAKISTAN' and RTT.paymentMethod = 'Bank Deposit' THEN '2'
  500. WHEN RTT.pCountry = 'SINGAPORE' and RTT.paymentMethod = 'Bank Deposit' THEN '2'
  501. WHEN RTT.pCountry = 'SRI LANKA' and RTT.paymentMethod = 'Bank Deposit' THEN '2'
  502. WHEN RTT.pCountry = 'UNITED ARAB EMIRATES' and RTT.paymentMethod = 'Bank Deposit' THEN '2'
  503. --WHEN RTT.pCountry = 'UNITED STATES OF AMERICA' and RTT.paymentMethod = 'Bank Deposit' THEN '3'
  504. WHEN RTT.pCountry = 'AUSTRIA' and RTT.paymentMethod = 'Bank Deposit' THEN '3'
  505. --WHEN 'Cash Payment' THEN '1'
  506. --WHEN 'Mobile Wallet' THEN '!4'
  507. END paymentMethod
  508. ,RTT.pBankName pBankName --
  509. ,ISNULL(PBID.BANK_CODE1,0) pBank --
  510. ,pBankLocation = CASE WHEN PBID.BANK_CODE1='11006083' THEN PBID.BANK_CODE2 ELSE ISNULL(PBBID.BRANCH_CODE1,'0') END
  511. ,ISNULL(PBBID.BRANCH_NAME,'') pBankBranchName --
  512. ,raccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  513. ,CM.idIssueDate sissuedDate --
  514. ,CM.idExpiryDate svalidDate --
  515. ,CM.dob sdob --
  516. ,'' semail
  517. ,sCON.countryCode szipCode
  518. ,CM.nativeCountry snativeCountry --
  519. ,0 occupationId
  520. ,CASE WHEN CM.occupation = '11383' THEN CM.occupationother ELSE ISNULL(OCU.detailTitle,0) END occupationName --
  521. --------- receiver details
  522. --,'' receiverId
  523. --,'' rfirstName
  524. --,'' rmiddleName
  525. --,'' rlastName1
  526. ,ISNULL(TRT.id,0) receiverId
  527. ,TRT.firstName rfirstName
  528. ,TRT.middleName rmiddleName
  529. ,TRT.lastName1 rlastName1
  530. ,TRT.idType ridType
  531. ,'' ridNumber
  532. ,'' rvalidDate
  533. ,'' rdob
  534. ,'' rhomePhone
  535. --,RE.countryCode
  536. ,RCON.countryCode rnativeCountry
  537. ,TRT.email remail
  538. --,CASE when rtt.sCountry = 'INDIA' and branchId = 'INSII00002-9' then ''
  539. , CASE
  540. WHEN TRT.country = 'INDIA' THEN PBID.BANK_CODE1 -- 'INSIB00001-9'
  541. WHEN TRT.country = 'PAKISTAN' THEN PBID.BANK_CODE1
  542. WHEN TRT.country = 'SINGAPORE' THEN PBID.BANK_CODE1
  543. WHEN TRT.country = 'BANGLADESH' THEN PBID.BANK_CODE1
  544. WHEN TRT.country = 'SRI LANKA' THEN PBBID.BRANCH_CODE1
  545. WHEN TRT.country = 'United Arab Emirates' THEN PBID.BANK_CODE1
  546. WHEN TRT.country = 'AUSTRIA' THEN PBID.BANK_CODE1
  547. WHEN TRT.country = 'HONG KONG' THEN PBBID.BRANCH_CODE1
  548. END AS branchId
  549. --End branchid
  550. --,'INSII00002-9' branchId
  551. -- ,Branchid = CASE
  552. -- WHEN TRT.country = 'INDIA' then branchId = 'INSII00002-9'
  553. --WHEN TRT.country = 'Pakistan' then branchId = 'PKBOP00001-6'
  554. --END
  555. ,'' branchName
  556. ,'' city
  557. ,0 pAgent
  558. ,'' pAgentId
  559. ,PBBID.BRANCH_CODE1 pAgentName
  560. ,'' pBankType
  561. ,RTT.payoutCurr
  562. ,RTT.collCurr
  563. ,RTT.SERVICECHARGE serviceCharge --
  564. ,'' pAgentComm
  565. ,TRT.relationType relationId
  566. ,'' remarks
  567. ,0 sAgent
  568. ,'' sAgentName
  569. ,0 sSuperAgent
  570. ,'' ipAddress
  571. ,0 countryId
  572. ,'' rstate
  573. ,0 sBranch
  574. ,'' pLocation
  575. ,dbo.decryptDb(RTT.controlNo) controlNo --
  576. ,0 exRate
  577. ,'' rcityCode
  578. ,CM.sessionId sessionId ----
  579. ,'true' IsRealtime ----
  580. ,bankAccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  581. ,'Y' IsRealtime
  582. ,RTT.company exRateConfirmId
  583. ,ISNULL(RTT.pCurrCostRate,0) SettlementDollarRate
  584. FROM remitTran RTT WITH(NOLOCK)
  585. INNER JOIN dbo.tranSenders TST(NOLOCK) ON TST.TRANID = RTT.ID
  586. INNER JOIN customerMaster CM(NOLOCK) ON CM.customerId = TST.customerId
  587. INNER JOIN dbo.tranReceivers TRT(NOLOCK) ON TRT.TRANID = RTT.ID
  588. LEFT JOIN applicationUsers AU(NOLOCK) ON AU.USERNAME = RTT.CREATEDBY
  589. INNER JOIN dbo.agentMaster AM(NOLOCK) ON AM.agentId=RTT.pAgent
  590. LEFT JOIN API_BANK_LIST PBID (NOLOCK) ON PBID.BANK_ID=RTT.pBank
  591. LEFT JOIN dbo.API_BANK_BRANCH_LIST PBBID (NOLOCK) ON PBBID.BRANCH_ID=RTT.pBankBranch
  592. LEFT JOIN dbo.staticDataValue OCU (NOLOCK) ON OCU.valueId=TST.occupation
  593. LEFT JOIN dbo.staticDataValue REL (NOLOCK) ON REL.valueId=CM.relationId
  594. LEFT JOIN dbo.countryMaster RCON (NOLOCK) ON RCON.countryName=TRT.Country
  595. LEFT JOIN dbo.countryMaster sCON (NOLOCK) ON sCON.countryName=TST.nativeCountry
  596. --LEFT JOIN countryMaster RCC (NOLOCK) ON RCC.countryId= RTT.ID
  597. WHERE RTT.id = @tranId
  598. END
  599. IF @PartnerId= '394488' ----- For SEND MN REMIT
  600. BEGIN
  601. SELECT
  602. RTT.id tranId ----
  603. ,'sendMN' processId
  604. ,CONVERT(VARCHAR, RTT.createdDate, 110) txnDate
  605. ,AU.userName userName -- notes -- Filds are use for jme nepal send model
  606. ,ISNULL(AM.parentId,0) partnerId ---- use for to get thirdparty api partner services
  607. ,ISNULL(CM.customerId,0) customerId
  608. ,isFirstTran 'Y' ----
  609. ,CM.firstName sfirstName
  610. ,CM.middleName smiddleName
  611. ,CM.lastName1 slastName1
  612. ,CM.lastName2 slastName2
  613. ,CM.fullName sfullName --
  614. ,ISNULL(TST.address, CM.address) saddress --
  615. ,CM.mobile smobile --
  616. ,CM.email semail
  617. ,tst.city scity --
  618. ,sCON.countryCode sCountry --
  619. ,CASE TST.idType
  620. WHEN 'Passport' THEN 'PASSPORT'
  621. WHEN 'National Id' THEN 'DRIVER LICENSE'
  622. ELSE 'Passport'
  623. END As sidType --
  624. ,TST.idNumber sidNumber --
  625. ,TRT.fullName rfullName --
  626. ,TRT.address raddress --
  627. ,TRT.mobile rmobile --
  628. ,ISNULL(TRT.city,TRT.address) rcity --
  629. ,TRT.country rcountry --
  630. ,CASE RTT.sourceOfFund
  631. WHEN 'Business'
  632. THEN 'Business Income'
  633. WHEN 'Loan'
  634. THEN 'Loan'
  635. WHEN 'Salary'
  636. THEN 'Salary'
  637. WHEN 'Savings'
  638. THEN 'Investment'
  639. WHEN 'Others'
  640. THEN 'Others'
  641. ELSE 'Salary'
  642. END sourceOfFund
  643. --,RTT.relwithsender relationName --
  644. , CASE RTT.relwithsender
  645. WHEN 'Business Partner'
  646. THEN 'Business Partner' -- RTR001 FAMILY
  647. WHEN 'Relation'
  648. THEN 'Friend'
  649. WHEN 'Parents'
  650. THEN 'Family'
  651. WHEN 'Husband/Wife'
  652. THEN 'Family'
  653. WHEN 'Brother/Sister'
  654. THEN 'Family'
  655. WHEN 'Son/Daughter'
  656. THEN 'Family'
  657. WHEN 'Uncle/Aunt'
  658. THEN 'Family'
  659. WHEN 'Niece/Nephew'
  660. THEN 'Family'
  661. WHEN 'self'
  662. THEN 'Relation'
  663. WHEN 'Cousins'
  664. THEN 'Family'
  665. ELSE 'Family'
  666. END relationName --
  667. ,CASE RTT.purposeOfRemit
  668. WHEN 'Family Support'
  669. THEN 'Family support'
  670. WHEN 'Tuition fee'
  671. THEN 'Education Support'
  672. --WHEN 'Investment' THEN '8'
  673. WHEN 'Payment'
  674. THEN 'Loan Payment'
  675. WHEN 'Medical Expense'
  676. THEN 'Medical Support'
  677. WHEN 'Others'
  678. THEN 'Other'
  679. WHEN 'Tuition fee C2B'
  680. THEN 'Education Support'
  681. --WHEN 'Personal Savings' THEN '6'
  682. ELSE 'Family support'
  683. END AS purposeOfRemit
  684. ,ISNULL(RTT.cAmt,0) cAmt --
  685. ,ISNULL(RTT.pAmt,0) pAmt --
  686. ,ISNULL(RTT.tAmt,0) tAmt --
  687. ,CASE RTT.paymentMethod
  688. -- WHEN RTT.pCountry = 'MONGOLIA' and RTT.paymentMethod = 'Bank Deposit' THEN '1'
  689. --WHEN RTT.pCountry = 'MONGOLIA' and RTT.paymentMethod = 'Cash Payment' THEN '2'
  690. WHEN 'Bank Deposit' THEN 'Bank Deposit'
  691. WHEN 'Cash Payment' THEN 'Cash Payment'
  692. END paymentMethod
  693. ,RTT.pBankName pBankName --
  694. ,PBID.BANK_CODE2 pBank --
  695. ,pBankLocation = CASE WHEN PBID.BANK_CODE2='11006083' THEN PBID.BANK_CODE1 ELSE ISNULL(PBBID.BRANCH_CODE2,'0') END
  696. ,ISNULL(PBBID.BRANCH_NAME,'') pBankBranchName --
  697. ,raccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  698. ,CM.idIssueDate sissuedDate --
  699. ,CM.idExpiryDate svalidDate --
  700. ,CM.dob sdob --
  701. ,'' semail
  702. ,sCON.countryCode szipCode
  703. ,CM.nativeCountry snativeCountry --
  704. ,0 occupationId
  705. ,CASE WHEN CM.occupation = '11383' THEN CM.occupationother ELSE ISNULL(OCU.detailTitle,0) END occupationName --
  706. --------- receiver details
  707. --,'' receiverId
  708. --,'' rfirstName
  709. --,'' rmiddleName
  710. --,'' rlastName1
  711. ,ISNULL(TRT.id,0) receiverId
  712. ,TRT.firstName rfirstName
  713. ,TRT.middleName rmiddleName
  714. ,TRT.lastName1 rlastName1
  715. ,TRT.idType ridType
  716. ,'' ridNumber
  717. ,'' rvalidDate
  718. ,'' rdob
  719. ,'' rhomePhone
  720. --,RE.countryCode
  721. ,RCON.countryCode rnativeCountry
  722. ,TRT.email remail
  723. --,CASE when rtt.sCountry = 'INDIA' and branchId = 'INSII00002-9' then ''
  724. --, CASE
  725. -- WHEN TRT.country = 'INDIA' THEN PBID.BANK_CODE1 -- 'INSIB00001-9'
  726. -- WHEN TRT.country = 'PAKISTAN' THEN PBID.BANK_CODE1
  727. --WHEN TRT.country = 'SINGAPORE' THEN PBID.BANK_CODE1
  728. --WHEN TRT.country = 'BANGLADESH' THEN PBID.BANK_CODE1
  729. --WHEN TRT.country = 'SRI LANKA' THEN PBBID.BRANCH_CODE1
  730. --WHEN TRT.country = 'United Arab Emirates' THEN PBID.BANK_CODE1
  731. --WHEN TRT.country = 'AUSTRIA' THEN PBID.BANK_CODE1
  732. --WHEN TRT.country = 'HONG KONG' THEN PBBID.BRANCH_CODE1
  733. -- END AS branchId
  734. --End branchid
  735. --,'INSII00002-9' branchId
  736. -- ,Branchid = CASE
  737. -- WHEN TRT.country = 'INDIA' then branchId = 'INSII00002-9'
  738. --WHEN TRT.country = 'Pakistan' then branchId = 'PKBOP00001-6'
  739. --END
  740. ,'' branchId
  741. ,'' branchName
  742. ,'' city
  743. ,0 pAgent
  744. ,'' pAgentId
  745. ,PBBID.BRANCH_CODE1 pAgentName
  746. ,'' pBankType
  747. ,RTT.payoutCurr
  748. ,RTT.collCurr
  749. ,RTT.SERVICECHARGE serviceCharge --
  750. ,'' pAgentComm
  751. ,TRT.relationType relationId
  752. ,'' remarks
  753. ,0 sAgent
  754. ,'' sAgentName
  755. ,0 sSuperAgent
  756. ,'' ipAddress
  757. ,0 countryId
  758. ,'' rstate
  759. ,0 sBranch
  760. ,'' pLocation
  761. ,dbo.decryptDb(RTT.controlNo) controlNo --
  762. ,0 exRate
  763. ,'' rcityCode
  764. ,CM.sessionId sessionId ----
  765. ,'true' IsRealtime ----
  766. ,bankAccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  767. ,'Y' IsRealtime
  768. ,RTT.company exRateConfirmId
  769. ,ISNULL(RTT.pCurrCostRate,0) SettlementDollarRate
  770. FROM remitTran RTT WITH(NOLOCK)
  771. INNER JOIN dbo.tranSenders TST(NOLOCK) ON TST.TRANID = RTT.ID
  772. INNER JOIN customerMaster CM(NOLOCK) ON CM.customerId = TST.customerId
  773. INNER JOIN dbo.tranReceivers TRT(NOLOCK) ON TRT.TRANID = RTT.ID
  774. LEFT JOIN applicationUsers AU(NOLOCK) ON AU.USERNAME = RTT.CREATEDBY
  775. INNER JOIN dbo.agentMaster AM(NOLOCK) ON AM.agentId=RTT.pAgent
  776. LEFT JOIN API_BANK_LIST PBID (NOLOCK) ON PBID.BANK_ID=RTT.pBank
  777. LEFT JOIN dbo.API_BANK_BRANCH_LIST PBBID (NOLOCK) ON PBBID.BRANCH_ID=RTT.pBankBranch
  778. LEFT JOIN dbo.staticDataValue OCU (NOLOCK) ON OCU.valueId=TST.occupation
  779. LEFT JOIN dbo.staticDataValue REL (NOLOCK) ON REL.valueId=CM.relationId
  780. LEFT JOIN dbo.countryMaster RCON (NOLOCK) ON RCON.countryName=TRT.Country
  781. LEFT JOIN dbo.countryMaster sCON (NOLOCK) ON sCON.countryName=TST.nativeCountry
  782. --LEFT JOIN countryMaster RCC (NOLOCK) ON RCC.countryId= RTT.ID
  783. WHERE RTT.id = @tranId
  784. END
  785. IF @PartnerId= '394490' ----- For SEND MN REMIT
  786. BEGIN
  787. SELECT
  788. RTT.id tranId ----
  789. ,'guavaPay' processId
  790. ,CONVERT(VARCHAR, RTT.createdDate, 110) txnDate
  791. ,AU.userName userName -- notes -- Filds are use for jme nepal send model
  792. ,ISNULL(AM.parentId,0) partnerId ---- use for to get thirdparty api partner services
  793. ,ISNULL(CM.customerId,0) customerId
  794. ,isFirstTran 'Y' ----
  795. ,CM.firstName sfirstName
  796. ,CM.middleName smiddleName
  797. ,CM.lastName1 slastName1
  798. ,CM.lastName2 slastName2
  799. ,CM.fullName sfullName --
  800. ,ISNULL(TST.address, CM.address) saddress --
  801. ,CM.mobile smobile --
  802. ,CM.email semail
  803. ,tst.city scity --
  804. ,sCON.isoAlpha3 sCountry --
  805. ,CASE TST.idType
  806. WHEN 'PASSPORT' THEN 'PASSPORT'
  807. WHEN 'DRIVER LICENSE' THEN 'DRIVING_LICENSE'
  808. WHEN 'Any Others Gov ID' THEN 'NATIONAL_ID'
  809. ELSE 'Passport'
  810. END As sidType --
  811. ,TST.idNumber sidNumber --
  812. ,TRT.fullName rfullName --
  813. ,TRT.address raddress --
  814. ,TRT.mobile rmobile --
  815. ,ISNULL(TRT.city,TRT.address) rcity --
  816. ,TRT.country rcountry --
  817. ,CASE RTT.sourceOfFund
  818. WHEN 'Business Income' THEN 'Business'
  819. WHEN 'Loan' THEN 'Loan'
  820. WHEN 'Salary' THEN 'Salary'
  821. WHEN 'Savings' THEN 'Savings'
  822. WHEN 'Others' THEN 'Others'
  823. ELSE 'Salary'
  824. END sourceOfFund
  825. --,RTT.relwithsender relationName --
  826. , CASE RTT.relwithsender
  827. WHEN 'Business Partner' THEN 'BusinessPartner' -- RTR001 FAMILY
  828. WHEN 'Friend' THEN 'Relative'
  829. WHEN 'Parents' THEN 'Family'
  830. WHEN 'Husband/Wife' THEN 'Relation'
  831. WHEN 'Others' THEN 'Others'
  832. ELSE 'BusinessPartner'
  833. END relationName --
  834. ,CASE RTT.purposeOfRemit
  835. WHEN 'Family Support' THEN 'Family support'
  836. WHEN 'Education Support' THEN 'Tuition fee'
  837. --WHEN 'Investment' THEN '8'
  838. WHEN 'Loan Payment' THEN 'Payment'
  839. WHEN 'Medical Support' THEN 'Medical Expense'
  840. WHEN 'Others' THEN 'Other'
  841. --WHEN 'Personal Savings' THEN '6'
  842. ELSE 'Family support'
  843. END AS purposeOfRemit
  844. ,ISNULL(RTT.cAmt,0) cAmt --
  845. ,ISNULL(RTT.pAmt,0) pAmt --
  846. ,ISNULL(RTT.tAmt,0) tAmt --
  847. ,CASE RTT.paymentMethod
  848. -- WHEN RTT.pCountry = 'MONGOLIA' and RTT.paymentMethod = 'Bank Deposit' THEN '1'
  849. --WHEN RTT.pCountry = 'MONGOLIA' and RTT.paymentMethod = 'Cash Payment' THEN '2'
  850. WHEN 'Bank Deposit' THEN 'ACCOUNT'
  851. WHEN 'Cash Payment' THEN 'CASH'
  852. END paymentMethod
  853. ,RTT.pBankName pBankName --
  854. ,PBD.PAYER_NAME pBank
  855. --,PBID.BANK_CODE2 pBank --
  856. ,pBankLocation = CASE WHEN PBID.BANK_CODE2='11006083' THEN PBID.BANK_CODE1 ELSE ISNULL(PBBID.BRANCH_CODE2,'0') END
  857. ,ISNULL(PBBID.BRANCH_NAME,'') pBankBranchName --
  858. ,raccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  859. ---,CM.idIssueDate sissuedDate --
  860. ,CONVERT(VARCHAR(10), CM.idIssueDate , 23) sissuedDate
  861. --,CM.idExpiryDate svalidDate --
  862. ,CONVERT(VARCHAR(10), CM.idExpiryDate , 23) svalidDate
  863. -- ,CM.dob sdob --
  864. , CONVERT(VARCHAR(10), CM.dob, 23) sdob
  865. ,'' semail
  866. ,CM.zipcode szipCode
  867. ,CM.nativeCountry snativeCountry --
  868. ,0 occupationId
  869. ,CASE WHEN CM.occupation = '11383' THEN CM.occupationother ELSE ISNULL(OCU.detailTitle,0) END occupationName --
  870. --------- receiver details
  871. --,'' receiverId
  872. --,'' rfirstName
  873. --,'' rmiddleName
  874. --,'' rlastName1
  875. ,ISNULL(TRT.id,0) receiverId
  876. ,TRT.firstName rfirstName
  877. ,TRT.middleName rmiddleName
  878. ,TRT.lastName1 rlastName1
  879. ,TRT.idType ridType
  880. ,'' ridNumber
  881. ,'' rvalidDate
  882. ,'' rdob
  883. ,'' rhomePhone
  884. --,RE.countryCode
  885. ,RCON.isoAlpha3 rnativeCountry
  886. ,TRT.email remail
  887. ,'' branchId
  888. ,'' branchName
  889. ,'' city
  890. ,0 pAgent
  891. ,'' pAgentId
  892. ,PBBID.BRANCH_CODE1 pAgentName
  893. ,'' pBankType
  894. ,RTT.payoutCurr
  895. ,RTT.collCurr
  896. ,RTT.SERVICECHARGE serviceCharge --
  897. ,'' pAgentComm
  898. ,TRT.relationType relationId
  899. ,'' remarks
  900. ,0 sAgent
  901. ,'' sAgentName
  902. ,0 sSuperAgent
  903. ,'' ipAddress
  904. ,0 countryId
  905. ,'' rstate
  906. ,0 sBranch
  907. ,'' pLocation
  908. ,dbo.decryptDb(RTT.controlNo) controlNo --
  909. ,0 exRate
  910. ,'' rcityCode
  911. ,CM.sessionId sessionId ----
  912. ,'true' IsRealtime ----
  913. ,bankAccountNo = CASE WHEN RTT.paymentMethod = 'Bank Deposit' THEN RTT.accountNo ELSE '' END
  914. ,'Y' IsRealtime
  915. ,RTT.company exRateConfirmId
  916. ,ISNULL(RTT.pCurrCostRate,0) SettlementDollarRate
  917. FROM remitTran RTT WITH(NOLOCK)
  918. INNER JOIN dbo.tranSenders TST(NOLOCK) ON TST.TRANID = RTT.ID
  919. INNER JOIN customerMaster CM(NOLOCK) ON CM.customerId = TST.customerId
  920. INNER JOIN dbo.tranReceivers TRT(NOLOCK) ON TRT.TRANID = RTT.ID
  921. LEFT JOIN applicationUsers AU(NOLOCK) ON AU.USERNAME = RTT.CREATEDBY
  922. INNER JOIN dbo.agentMaster AM(NOLOCK) ON AM.agentId=RTT.pAgent
  923. LEFT JOIN API_BANK_LIST PBID (NOLOCK) ON PBID.BANK_ID=RTT.pBank
  924. LEFT JOIN dbo.API_BANK_BRANCH_LIST PBBID (NOLOCK) ON PBBID.BRANCH_ID=RTT.pBankBranch
  925. LEFT JOIN dbo.staticDataValue OCU (NOLOCK) ON OCU.valueId=TST.occupation
  926. LEFT JOIN dbo.staticDataValue REL (NOLOCK) ON REL.valueId=CM.relationId
  927. LEFT JOIN dbo.countryMaster RCON (NOLOCK) ON RCON.countryName=TRT.Country
  928. LEFT JOIN dbo.PAYER_BANK_DETAILS PBD(NOLOCK) ON PBD.PAYER_ID = RTT.PayerId
  929. LEFT JOIN dbo.countryMaster sCON (NOLOCK) ON sCON.countryName=TST.nativeCountry
  930. --LEFT JOIN countryMaster RCC (NOLOCK) ON RCC.countryId= RTT.ID
  931. WHERE RTT.id = @tranId
  932. END
  933. END TRY
  934. BEGIN CATCH
  935. IF @@TRANCOUNT > 0
  936. ROLLBACK TRANSACTION
  937. SELECT 1 error_code, ERROR_MESSAGE() mes, NULL id
  938. END CATCH
  939. END