DBA Data[Home] [Help]

PACKAGE BODY: APPS.AR_PUBLIC_UTILS

Source


4 /*=======================================================================+
1 PACKAGE BODY AR_PUBLIC_UTILS  AS
2 /* $Header: ARXPUTLB.pls 120.5 2005/10/30 04:28:14 appldev noship $ */
3 
5  |  Declare PUBLIC Data Types and Variables
6  +=======================================================================*/
7 
8 /*=======================================================================+
9  |  Declare PUBLIC Exceptions
10  +=======================================================================*/
11 
12 /*========================================================================
13  | PUBLIC Procedure get_payment_info
14  |
15  | DESCRIPTION
16  |       This function retunrs the receipt and application details for a
17  |       payment server order number passed.
18  |
19  | PSEUDO CODE/LOGIC
20  |
21  | PARAMETERS
22  |       IN
23  |         p_payment_server_order_num
24  |         p_application_type -Valid values APP,UNAPP,ACC,OTHER ACC, ACTIVITY
25  |       OUT NOCOPY
26  |         p_receipt_header - Receipt Header Rowtype
27  |         p_app_rec        - Application Rowtype
28  |         x_return_status  - Standard return status
29  |         x_msg_data       - Standard msg data
30  |         x_msg_count      - Standard msg count
31  |
32  |
33  | RETURNS
34  |      nothing
35  |
36  | KNOWN ISSUES
37  |
38  |
39  |
40  | NOTES
41  |
42  |
43  | MODIFICATION HISTORY
44  | Date                  Author         Description of Changes
45  | 22-Jan-2002           S.Nambiar      Created
46  | 22-Jan-2002           S.Nambiar      Bug 2195124 - CRM-iPayment needs to get
47  |                                      the invoice informations for a payment
48  |                                      server order number.
49  |
50  *=======================================================================*/
51  PROCEDURE get_payment_info(
52                p_payment_server_order_num IN
53                               ar_cash_receipts.payment_server_order_num%TYPE,
54                p_application_type IN ar_receivable_applications.status%TYPE DEFAULT 'APP',
55                p_receipt_header  OUT NOCOPY ar_cash_receipts%ROWTYPE,
56                p_app_rec         OUT NOCOPY application_tbl_type,
57                x_return_status   OUT NOCOPY VARCHAR2,
58                x_msg_count       OUT NOCOPY NUMBER,
59                x_msg_data        OUT NOCOPY VARCHAR2
60                ) IS
61 
62  CURSOR app_rec_cur(c_cash_receipt_id ar_cash_receipts.cash_receipt_id%TYPE) IS
63                 SELECT *
64                 FROM   ar_receivable_applications
65                 WHERE  cash_receipt_id=c_cash_receipt_id
66                 AND    status = p_application_type
67                 AND    display='Y';
68 
69  l_receipt_header            ar_cash_receipts%ROWTYPE;
73  BEGIN
70  l_payment_server_order_num  ar_cash_receipts.payment_server_order_num%TYPE;
71  table_index  NUMBER := 1;
72 
74      arp_util.debug('ar_public_utils.get_payment_info (+)');
75      x_return_status := FND_API.G_RET_STS_SUCCESS;
76 
77      IF p_payment_server_order_num IS NOT NULL THEN
78 
79         SELECT cr.*
80         INTO   l_receipt_header
81         FROM   ar_cash_receipts cr
82         WHERE  cr.payment_server_order_num=p_payment_server_order_num
83         AND EXISTS  (SELECT status from ar_cash_receipt_history crh
84                     WHERE crh.status = 'REMITTED'
85                     AND crh.cash_receipt_id=cr.cash_receipt_id);
86 
87      END IF;
88 
89      IF l_receipt_header.cash_receipt_id IS NOT NULL THEN
90 
91         FOR app_rec IN app_rec_cur(l_receipt_header.cash_receipt_id)
92         LOOP
93             p_app_rec(table_index) := app_rec;
94             table_index := table_index+1;
95 
96         END LOOP;
97 
98      END IF;
99 
100      p_receipt_header := l_receipt_header;
101 
102      arp_util.debug('ar_public_utils.get_payment_info (-)');
103 
104  EXCEPTION
105     WHEN no_data_found THEN
106 
107       FND_MESSAGE.SET_NAME ('AR','GENERIC_MESSAGE');
108       FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','ar_public_utils.get_payment_info:PSON Does not exist');
109       FND_MSG_PUB.Add;
110 
111       FND_MSG_PUB.Count_And_Get( p_encoded => FND_API.G_FALSE,
112                                  p_count  =>  x_msg_count,
113                                  p_data   => x_msg_data
114                                               );
115       x_return_status := FND_API.G_RET_STS_ERROR;
116 
117     WHEN others THEN
118       FND_MESSAGE.SET_NAME ('AR','GENERIC_MESSAGE');
119       FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','ar_public_utils.get_payment_info:'||SQLERRM);
120       FND_MSG_PUB.Add;
121 
122       FND_MSG_PUB.Count_And_Get( p_encoded => FND_API.G_FALSE,
123                                  p_count  =>  x_msg_count,
124                                  p_data   => x_msg_data
125                                               );
126       x_return_status := FND_API.G_RET_STS_ERROR;
127 
128  END;
129 /*========================================================================
130  | PUBLIC Function Check_Prepay_Payment_Term
131  |
132  | DESCRIPTION
133  |       If the passed payment term is a prepayment payment term,this
134  |       function returns value 'Y' else 'N'.
135  |
136  | PSEUDO CODE/LOGIC
137  |
138  | PARAMETERS
139  |       IN
140  |         p_payment_term_id
141  |
142  |
143  | RETURNS
144  |       Returns value 'Y' or 'N'.
145  |
146  | KNOWN ISSUES
147  |
148  |
149  |
150  | NOTES
151  |     A stub version of this routine is provided to product team which
152  |     access the prepayment_flag from ra_terms view.Stub version always
153  |     returns 'N'.
154  |
155  | MODIFICATION HISTORY
156  | Date                  Author         Description of Changes
157  | 22-Jan-2002           S.Nambiar      Created
158  | 24-Jan-2002           S.Nambiar      Stub version created to return 'N'
159  | 21-Feb-2002           S.Nambiar      Removed debug messages for the functions
160  |                                      and removed direct reference to table
161  |                                      column for function parameter.
162  *=======================================================================*/
163  FUNCTION Check_Prepay_Payment_Term
164                (p_payment_term_id IN NUMBER)
165  RETURN VARCHAR2 IS
166 
167  l_prepayment_flag VARCHAR2(1) := 'N';
168 
169  BEGIN
170 
171      SELECT NVL(prepayment_flag,'N')
172      INTO   l_prepayment_flag
173      FROM   ra_terms
174      WHERE  term_id=p_payment_term_id;
175 
176 
177      RETURN l_prepayment_flag;
178  EXCEPTION
179    WHEN others THEN
180      RETURN l_prepayment_flag;
181  END;
182 /*========================================================================
183  | PUBLIC Function Check_Prepay_Transaction
184  |
185  | DESCRIPTION
186  |       If the transaction is a prepaid transaction,function returns value 'Y'
187  |       else 'N'.
188  |
189  | PSEUDO CODE/LOGIC
190  |
191  | PARAMETERS
192  |       IN
193  |         p_customer_trx_id
194  |
195  |
196  | RETURNS
197  |       Returns value 'Y' or 'N'.
198  |
199  | KNOWN ISSUES
200  |
201  |
202  |
203  | NOTES
204  |     A stub version of this routine is provided to product teams which
205  |     access the prepayment_flag from ra_customer_trx view.Stub version
206  |     always  returns 'N'.
207  |
208  | MODIFICATION HISTORY
209  | Date                  Author         Description of Changes
210  | 22-Jan-2002           S.Nambiar      Created
211  | 24-Jan-2002           S.Nambiar      Stub version created to return 'N'
212  | 21-Feb-2002           S.Nambiar      Removed debug messages for the functions
213  |                                      and removed direct reference to table
214  |                                      column for function parameter.
215  *=======================================================================*/
216  FUNCTION Check_Prepay_Transaction
217                 (p_customer_trx_id IN NUMBER)
218  RETURN VARCHAR2 IS
219 
220  l_prepayment_flag VARCHAR2(1) := 'N';
221 
222  BEGIN
223 
224      SELECT NVL(prepayment_flag,'N')
225      INTO   l_prepayment_flag
226      FROM   ra_customer_trx
227      WHERE  customer_trx_id=p_customer_trx_id;
228 
229      RETURN l_prepayment_flag;
230  EXCEPTION
231    WHEN others THEN
232      RETURN l_prepayment_flag;
233  END;
234 
235 END AR_PUBLIC_UTILS;