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.

60 lines
2.1 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_WingCancelPin] Script Date: 7/4/2019 11:35:48 AM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. ---- proc_WingCancelPin @flag = 'list'
  9. CREATE OR ALTER proc [dbo].[proc_WingCancelPin]
  10. @flag varchar(20),
  11. @id int = null,
  12. @tpRefNo varchar(20) = null,
  13. @tpTranId varchar(30) = null
  14. AS
  15. SET NOCOUNT ON;
  16. declare @controlNo varchar(20),@deliveryMethod varchar(50)
  17. if @flag = 'list'
  18. begin
  19. select c.id,dbo.fnadecryptstring(controlno) [gmeNo],createddate,createdby,paymentMethod
  20. into #temp
  21. from canceltranhistory(nolock) c where pagent ='221226'
  22. and ContNo is null
  23. alter table #temp add response varchar(max)
  24. update t set t.response=v.responsexml from Application_Log.DBO.vwTpApilogs(nolock) v
  25. inner join #temp t on t.gmeNo = v.controlNo
  26. where v.methodName='CommitWingTxnAccount'
  27. --update #temp set response=replace(response,'<?xml version="1.0" encoding="utf-16"?>','<?xml version="1.0" encoding="UTF-8"?>')
  28. update #temp set response=replace(response,'<WingTxnResponseDetailsCommon xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">','<WingTxnResponseDetailsCommon>')
  29. --update #temp set response=replace(response,'</WingTxnResponseDetailsCommon>','')
  30. --update #temp set response=replace(response,'<transaction_id>','')
  31. delete from #temp where response is null
  32. delete from #temp where response like '%<error_code>%'
  33. select * from #temp
  34. end
  35. ELSE IF @flag = 'approve-wing'
  36. BEGIN
  37. select @deliveryMethod = paymentMethod,@controlNo = controlno from canceltranhistory (nolock) where id = @id
  38. if @deliveryMethod <> 'Mobile Wallet'
  39. update canceltranhistory set controlno = dbo.FNAEncryptString(@tpRefNo) where id = @id
  40. UPDATE canceltranhistory SET
  41. controlno = case when @deliveryMethod = 'Mobile Wallet' then @controlNo else dbo.FNAEncryptString(@tpRefNo) end
  42. ,controlNo2 = @controlNo
  43. ,ContNo = @tpTranId
  44. ,paystatus = 'Post'
  45. WHERE id = @id
  46. SELECT 0 ErrorCode,'Transaction has been sent successfully' Msg, @id id, case when @deliveryMethod = 'Mobile Wallet' then @controlNo else @tpRefNo end extra
  47. END;
  48. GO