DBA Data[Home] [Help]

PACKAGE BODY: APPS.HZ_PAYMENT_METHOD_PUB

Source


1 PACKAGE BODY HZ_PAYMENT_METHOD_PUB AS
2 /*$Header: ARHPYMPB.pls 120.5 2005/12/07 19:33:12 acng noship $*/
3 
4 PROCEDURE log(
5    message      IN      VARCHAR2,
6    newline      IN      BOOLEAN DEFAULT TRUE);
7 
8 FUNCTION logerror(SQLERRM VARCHAR2 DEFAULT NULL)
9          RETURN VARCHAR2;
10 
11   -- PROCEDURE create_payment_method
12   --
13   -- DESCRIPTION
14   --     Create payment method.
15   --
16   -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
17   --
18   -- ARGUMENTS
19   --   IN:
20   --     p_payment_method_rec Payment method record.
21   --   OUT:
22   --     x_return_status      Return status after the call. The status can
23   --                          be fnd_api.g_ret_sts_success (success),
24   --                          fnd_api.g_ret_sts_error (error),
25   --                          FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
26   --     x_msg_count          Number of messages in message stack.
27   --     x_msg_data           Message text if x_msg_count is 1.
28   --     x_cust_receipt_method_id      Payment method Id.
29   --
30   -- NOTES
31   --
32   -- MODIFICATION HISTORY
33   --
34   --   14-DEC-2004    Arnold Ng          Created.
35   --
36 
37 PROCEDURE create_payment_method (
38   p_init_msg_list             IN            VARCHAR2 := FND_API.G_FALSE,
39   p_payment_method_rec        IN payment_method_rec_type,
40   x_cust_receipt_method_id    OUT NOCOPY    NUMBER,
41   x_return_status             OUT NOCOPY    VARCHAR2,
42   x_msg_count                 OUT NOCOPY    NUMBER,
43   x_msg_data                  OUT NOCOPY    VARCHAR2
44 ) IS
45   l_rowid                      VARCHAR2(64);
46   l_pm_rec                     payment_method_rec_type;
47   l_debug_prefix               VARCHAR2(30);
48 BEGIN
49   SAVEPOINT create_pm_pub;
50 
51   -- Debug info.
52   IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
53     hz_utility_v2pub.debug(p_message=>'create_payment_method(+)',
54                            p_prefix=>l_debug_prefix,
55                            p_msg_level=>fnd_log.level_procedure);
56   END IF;
57 
58   -- initialize message list if p_init_msg_list is set to TRUE.
59   IF FND_API.to_Boolean(p_init_msg_list) THEN
60       FND_MSG_PUB.initialize;
61   END IF;
62 
63   l_pm_rec := p_payment_method_rec;
64 
65   --Initialize API return status to success.
66   x_return_status := FND_API.G_RET_STS_SUCCESS;
67 
68   validate_payment_method(
69      p_create_update_flag        => 'C'
70     ,p_payment_method_rec        => l_pm_rec
71     ,x_return_status             => x_return_status );
72 
73   IF(x_return_status = FND_API.G_RET_STS_ERROR) THEN
74     RAISE FND_API.G_EXC_ERROR;
75   ELSIF(x_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
76     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
77   END IF;
78 
79   HZ_PAYMENT_METHOD_PKG.Insert_Row (
80      x_cust_receipt_method_id    => l_pm_rec.cust_receipt_method_id,
81      x_customer_id               => l_pm_rec.cust_account_id,
82      x_receipt_method_id         => l_pm_rec.receipt_method_id,
83      x_primary_flag              => l_pm_rec.primary_flag,
84      x_site_use_id               => l_pm_rec.site_use_id,
85      x_start_date                => l_pm_rec.start_date,
86      x_end_date                  => l_pm_rec.end_date,
87      x_attribute_category        => l_pm_rec.attribute_category,
88      x_attribute1                => l_pm_rec.attribute1,
89      x_attribute2                => l_pm_rec.attribute2,
90      x_attribute3                => l_pm_rec.attribute3,
91      x_attribute4                => l_pm_rec.attribute4,
92      x_attribute5                => l_pm_rec.attribute5,
93      x_attribute6                => l_pm_rec.attribute6,
94      x_attribute7                => l_pm_rec.attribute7,
95      x_attribute8                => l_pm_rec.attribute8,
96      x_attribute9                => l_pm_rec.attribute9,
97      x_attribute10               => l_pm_rec.attribute10,
98      x_attribute11               => l_pm_rec.attribute11,
99      x_attribute12               => l_pm_rec.attribute12,
100      x_attribute13               => l_pm_rec.attribute13,
101      x_attribute14               => l_pm_rec.attribute14,
102      x_attribute15               => l_pm_rec.attribute15
103   );
104 
105   x_cust_receipt_method_id := l_pm_rec.cust_receipt_method_id;
106 
107   IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('EVENTS_ENABLED', 'BO_EVENTS_ENABLED')) THEN
108     -- populate function for integration service
109     HZ_POPULATE_BOT_PKG.pop_ra_cust_receipt_methods(
110       p_operation => 'I',
111       p_cust_receipt_method_id => x_cust_receipt_method_id);
112   END IF;
113 
114   -- standard call to get message count and if count is 1, get message info.
115   FND_MSG_PUB.Count_And_Get(p_encoded => FND_API.G_FALSE,
116                             p_count => x_msg_count,
117                             p_data  => x_msg_data);
118 
119   -- Debug info.
120   IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
121     hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
122                                            p_msg_data=>x_msg_data,
123                                            p_msg_type=>'WARNING',
124                                            p_msg_level=>fnd_log.level_exception);
125   END IF;
126 
127   IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
128     hz_utility_v2pub.debug(p_message=>'create_payment_method(-)',
129                            p_prefix=>l_debug_prefix,
130                            p_msg_level=>fnd_log.level_procedure);
131   END IF;
132 
133 EXCEPTION
134    WHEN FND_API.G_EXC_ERROR THEN
135      ROLLBACK TO create_pm_pub;
136      x_return_status := FND_API.G_RET_STS_ERROR;
137      FND_MSG_PUB.Count_And_Get(
138         p_encoded => FND_API.G_FALSE,
139         p_count => x_msg_count,
140         p_data  => x_msg_data);
141 
142    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
143      ROLLBACK TO create_pm_pub;
144      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
145      FND_MSG_PUB.Count_And_Get(
146         p_encoded => FND_API.G_FALSE,
147         p_count => x_msg_count,
148         p_data  => x_msg_data);
149 
150    WHEN OTHERS THEN
151      ROLLBACK TO create_pm_pub;
152      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
153      FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
154      FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
155      FND_MSG_PUB.ADD;
156      FND_MSG_PUB.Count_And_Get(
157         p_encoded => FND_API.G_FALSE,
158         p_count => x_msg_count,
159         p_data  => x_msg_data);
160 END create_payment_method;
161 
162   -- PROCEDURE update_payment_method
163   --
164   -- DESCRIPTION
165   --     Update payment method.
166   --
167   -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
168   --
169   -- ARGUMENTS
170   --   IN:
171   --     p_payment_method_rec Payment method record.
172   --   IN/OUT:
173   --     px_last_update_date  Last update date of payment method record.
174   --   OUT:
175   --     x_return_status      Return status after the call. The status can
176   --                          be fnd_api.g_ret_sts_success (success),
177   --                          fnd_api.g_ret_sts_error (error),
178   --                          FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
179   --     x_msg_count          Number of messages in message stack.
180   --     x_msg_data           Message text if x_msg_count is 1.
181   --
182   -- NOTES
183   --
184   -- MODIFICATION HISTORY
185   --
186   --   14-DEC-2004    Arnold Ng          Created.
187 
188 PROCEDURE update_payment_method (
189   p_init_msg_list             IN            VARCHAR2 :=  FND_API.G_FALSE,
190   p_payment_method_rec        IN payment_method_rec_type,
191   px_last_update_date         IN OUT NOCOPY DATE,
192   x_return_status             OUT NOCOPY    VARCHAR2,
193   x_msg_count                 OUT NOCOPY    NUMBER,
194   x_msg_data                  OUT NOCOPY    VARCHAR2
195 ) IS
196   l_last_update_date          DATE;
197   l_rowid                     ROWID := NULL;
198   l_pm_id                     NUMBER;
199   l_debug_prefix              VARCHAR2(30);
200 BEGIN
201   SAVEPOINT update_pm_pub;
202 
203   -- Debug info.
204   IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
205     hz_utility_v2pub.debug(p_message=>'update_payment_method(+)',
206                            p_prefix=>l_debug_prefix,
207                            p_msg_level=>fnd_log.level_procedure);
208   END IF;
209 
210   -- initialize message list if p_init_msg_list is set to TRUE.
211   IF FND_API.to_Boolean(p_init_msg_list) THEN
212     FND_MSG_PUB.initialize;
213   END IF;
214 
215   --Initialize API return status to success.
216   x_return_status := FND_API.G_RET_STS_SUCCESS;
217 
218   -- Lock record.
219   BEGIN
220     l_pm_id := p_payment_method_rec.cust_receipt_method_id;
221 
222     SELECT ROWID, LAST_UPDATE_DATE
223     INTO l_rowid, l_last_update_date
224     FROM RA_CUST_RECEIPT_METHODS
225     WHERE cust_receipt_method_id = l_pm_id
226     FOR UPDATE NOWAIT;
227 
228     IF NOT (
229       ( px_last_update_date IS NULL AND l_last_update_date IS NULL ) OR
230       ( px_last_update_date IS NOT NULL AND
231         l_last_update_date IS NOT NULL AND
232         px_last_update_date = l_last_update_date ) )
233     THEN
234       FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_RECORD_CHANGED' );
235       FND_MESSAGE.SET_TOKEN( 'TABLE', 'RA_CUST_RECEIPT_METHODS' );
236       FND_MSG_PUB.ADD;
237       RAISE FND_API.G_EXC_ERROR;
238     END IF;
239 
240   EXCEPTION
241     WHEN NO_DATA_FOUND THEN
242       FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_NO_RECORD' );
243       FND_MESSAGE.SET_TOKEN( 'RECORD', 'RA_CUST_RECEIPT_METHODS' );
244       FND_MESSAGE.SET_TOKEN( 'VALUE', l_pm_id);
245       FND_MSG_PUB.ADD;
246       RAISE FND_API.G_EXC_ERROR;
247   END;
248 
249   validate_payment_method(
250      p_create_update_flag        => 'U'
251     ,p_payment_method_rec        => p_payment_method_rec
252     ,x_return_status             => x_return_status );
253 
254   IF(x_return_status = FND_API.G_RET_STS_ERROR) THEN
255     RAISE FND_API.G_EXC_ERROR;
256   ELSIF(x_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
257     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
258   END IF;
259 
260   HZ_PAYMENT_METHOD_PKG.Update_Row(
261     x_rowid                  => l_rowid,
262     x_cust_receipt_method_id => p_payment_method_rec.cust_receipt_method_id,
263     x_customer_id            => p_payment_method_rec.cust_account_id,
264     x_receipt_method_id      => p_payment_method_rec.receipt_method_id,
265     x_primary_flag           => p_payment_method_rec.primary_flag,
266     x_site_use_id            => p_payment_method_rec.site_use_id,
267     x_start_date             => p_payment_method_rec.start_date,
268     x_end_date               => p_payment_method_rec.end_date,
269     x_attribute_category     => p_payment_method_rec.attribute_category,
270     x_attribute1             => p_payment_method_rec.attribute1,
271     x_attribute2             => p_payment_method_rec.attribute2,
272     x_attribute3             => p_payment_method_rec.attribute3,
273     x_attribute4             => p_payment_method_rec.attribute4,
274     x_attribute5             => p_payment_method_rec.attribute5,
275     x_attribute6             => p_payment_method_rec.attribute6,
276     x_attribute7             => p_payment_method_rec.attribute7,
277     x_attribute8             => p_payment_method_rec.attribute8,
278     x_attribute9             => p_payment_method_rec.attribute9,
279     x_attribute10            => p_payment_method_rec.attribute10,
280     x_attribute11            => p_payment_method_rec.attribute11,
281     x_attribute12            => p_payment_method_rec.attribute12,
282     x_attribute13            => p_payment_method_rec.attribute13,
283     x_attribute14            => p_payment_method_rec.attribute14,
284     x_attribute15            => p_payment_method_rec.attribute15
285   );
286 
287   px_last_update_date := l_last_update_date;
288 
289   IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('EVENTS_ENABLED', 'BO_EVENTS_ENABLED')) THEN
290     -- populate function for integration service
291     HZ_POPULATE_BOT_PKG.pop_ra_cust_receipt_methods(
292       p_operation => 'U',
293       p_cust_receipt_method_id => p_payment_method_rec.cust_receipt_method_id);
294   END IF;
295 
296   -- standard call to get message count and if count is 1, get message info.
297   FND_MSG_PUB.Count_And_Get(p_encoded => FND_API.G_FALSE,
298                             p_count => x_msg_count,
299                             p_data  => x_msg_data);
300 
301   -- Debug info.
302   IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
303     hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
304                                            p_msg_data=>x_msg_data,
305                                            p_msg_type=>'WARNING',
306                                            p_msg_level=>fnd_log.level_exception);
307   END IF;
308 
309   IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
310     hz_utility_v2pub.debug(p_message=>'update_payment_method(-)',
311                            p_prefix=>l_debug_prefix,
312                            p_msg_level=>fnd_log.level_procedure);
313   END IF;
314 
315 EXCEPTION
316   WHEN FND_API.G_EXC_ERROR THEN
317     ROLLBACK TO update_pm_pub;
318     x_return_status := FND_API.G_RET_STS_ERROR;
319     FND_MSG_PUB.Count_And_Get(
320        p_encoded => FND_API.G_FALSE,
321        p_count => x_msg_count,
322        p_data  => x_msg_data);
323 
324   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
325     ROLLBACK TO update_pm_pub;
326     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
327     FND_MSG_PUB.Count_And_Get(
331 
328        p_encoded => FND_API.G_FALSE,
329        p_count => x_msg_count,
330        p_data  => x_msg_data);
332   WHEN OTHERS THEN
333     ROLLBACK TO update_pm_pub;
334     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
335     FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
336     FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
337     FND_MSG_PUB.ADD;
338     FND_MSG_PUB.Count_And_Get(
339        p_encoded => FND_API.G_FALSE,
340        p_count => x_msg_count,
341        p_data  => x_msg_data);
342 END update_payment_method;
343 
344 PROCEDURE log(
345    message      IN      VARCHAR2,
346    newline      IN      BOOLEAN DEFAULT TRUE
347 ) IS
348 BEGIN
349   IF message = 'NEWLINE' THEN
350    FND_FILE.NEW_LINE(FND_FILE.LOG, 1);
351   ELSIF (newline) THEN
352     FND_FILE.put_line(fnd_file.log,message);
353   ELSE
354     FND_FILE.put(fnd_file.log,message);
355   END IF;
356 END log;
357 
358 /*-----------------------------------------------------------------------
359  | Function to fetch messages of the stack and log the error
360  | Also returns the error
361  |-----------------------------------------------------------------------*/
362 FUNCTION logerror(SQLERRM VARCHAR2 DEFAULT NULL)
363 RETURN VARCHAR2 IS
364   l_msg_data VARCHAR2(2000);
365 BEGIN
366   FND_MSG_PUB.Reset;
367 
368   FOR I IN 1..FND_MSG_PUB.Count_Msg LOOP
369     l_msg_data := l_msg_data || FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE );
370   END LOOP;
371   IF (SQLERRM IS NOT NULL) THEN
372     l_msg_data := l_msg_data || SQLERRM;
373   END IF;
374   log(l_msg_data);
375   RETURN l_msg_data;
376 END logerror;
377 
378   -- PROCEDURE validate_payment_method
379   --
380   -- DESCRIPTION
381   --     Validate payment method.
382   --
383   -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
384   --
385   -- ARGUMENTS
386   --   IN:
387   --     p_create_update_flag Create or update flag.
388   --     p_payment_method_rec Payment method record.
389   --   OUT:
390   --     x_return_status      Return status after the call. The status can
391   --                          be fnd_api.g_ret_sts_success (success),
392   --                          fnd_api.g_ret_sts_error (error),
393   --                          FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
394   --
395   -- NOTES
396   --
397   -- MODIFICATION HISTORY
398   --
399   --   14-DEC-2004    Arnold Ng          Created.
400 
401 PROCEDURE validate_payment_method (
402    p_create_update_flag        IN VARCHAR2,
403    p_payment_method_rec        IN payment_method_rec_type,
404    x_return_status             IN OUT NOCOPY VARCHAR2
405 ) IS
406    l_dummy                     VARCHAR2(1);
407 
408    CURSOR check_cust_acct_id(l_ca_id NUMBER) IS
409    select 'X'
410    from HZ_CUST_ACCOUNTS
411    where cust_account_id = l_ca_id;
412 
413    CURSOR check_site_use_id(l_ca_id NUMBER, l_casu_id NUMBER) IS
414    SELECT 'X'
415    FROM HZ_CUST_SITE_USES_ALL casu, HZ_CUST_ACCT_SITES cas
416    WHERE casu.cust_acct_site_id = cas.cust_acct_site_id
417    AND cas.cust_account_id = l_ca_id
418    AND casu.site_use_id = l_casu_id;
419 
420    CURSOR check_receipt_method_id(l_rm_id NUMBER) IS
421    SELECT 'X'
422    FROM AR_RECEIPT_METHODS
423    WHERE receipt_method_id = l_rm_id
424    AND sysdate between start_date and nvl(end_date, sysdate);
425 BEGIN
426    -- check not null first
427    IF(p_payment_method_rec.receipt_method_id IS NULL OR p_payment_method_rec.receipt_method_id = FND_API.G_MISS_NUM) THEN
428      FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
429      FND_MESSAGE.SET_TOKEN('COLUMN' ,'RECEIPT_METHOD_ID');
430      FND_MSG_PUB.ADD;
431      RAISE FND_API.G_EXC_ERROR;
432    END IF;
433 
434    IF(p_payment_method_rec.primary_flag IS NULL OR p_payment_method_rec.primary_flag = FND_API.G_MISS_CHAR) THEN
435      FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
436      FND_MESSAGE.SET_TOKEN('COLUMN' ,'PRIMARY_FLAG');
437      FND_MSG_PUB.ADD;
438      RAISE FND_API.G_EXC_ERROR;
439    END IF;
440 
441    IF(p_payment_method_rec.cust_account_id IS NULL OR p_payment_method_rec.cust_account_id = FND_API.G_MISS_NUM) THEN
442      FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
443      FND_MESSAGE.SET_TOKEN('COLUMN' ,'CUSTOMER_ID');
444      FND_MSG_PUB.ADD;
445      RAISE FND_API.G_EXC_ERROR;
446    END IF;
447 
448    IF(p_payment_method_rec.start_date IS NULL or p_payment_method_rec.start_date = FND_API.G_MISS_DATE) THEN
449      FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
450      FND_MESSAGE.SET_TOKEN('COLUMN' ,'START_DATE');
451      FND_MSG_PUB.ADD;
452      RAISE FND_API.G_EXC_ERROR;
453    END IF;
454 
455    -- check cust_account_id
456    OPEN check_cust_acct_id(p_payment_method_rec.cust_account_id);
457    FETCH check_cust_acct_id INTO l_dummy;
458    -- if found, then raise error saying already exist
459    IF(check_cust_acct_id%NOTFOUND) THEN
460      CLOSE check_cust_acct_id;
461      FND_MESSAGE.SET_NAME('AR', 'HZ_API_INVALID_FK');
462      FND_MESSAGE.SET_TOKEN('FK','CUSTOMER_ID');
463      FND_MESSAGE.SET_TOKEN('COLUMN','CUST_ACCOUNT_ID');
464      FND_MESSAGE.SET_TOKEN('TABLE','HZ_CUST_ACCOUNTS');
465      FND_MSG_PUB.ADD;
466      RAISE FND_API.G_EXC_ERROR;
467    END IF;
468    CLOSE check_cust_acct_id;
469 
470    -- check site_use_id and customer_id
471    IF NOT(p_payment_method_rec.site_use_id IS NULL or p_payment_method_rec.site_use_id = FND_API.G_MISS_NUM) THEN
472      OPEN check_site_use_id(p_payment_method_rec.cust_account_id, p_payment_method_rec.site_use_id);
473      FETCH check_site_use_id INTO l_dummy;
474      IF(check_site_use_id%NOTFOUND) THEN
478        FND_MESSAGE.SET_TOKEN('COLUMN','SITE_USE_ID');
475        CLOSE check_site_use_id;
476        FND_MESSAGE.SET_NAME('AR', 'HZ_API_INVALID_FK');
477        FND_MESSAGE.SET_TOKEN('FK','SITE_USE_ID');
479        FND_MESSAGE.SET_TOKEN('TABLE','HZ_CUST_SITE_USES_ALL');
480        FND_MSG_PUB.ADD;
481        RAISE FND_API.G_EXC_ERROR;
482      END IF;
483      CLOSE check_site_use_id;
484    END IF;
485 
486    -- check receipt_method_id
487    OPEN check_receipt_method_id(p_payment_method_rec.receipt_method_id);
488    FETCH check_receipt_method_id INTO l_dummy;
489    IF(check_receipt_method_id%NOTFOUND) THEN
490      CLOSE check_receipt_method_id;
491      FND_MESSAGE.SET_NAME('AR', 'HZ_API_INVALID_FK');
492      FND_MESSAGE.SET_TOKEN('FK','RECEIPT_METHOD_ID');
493      FND_MESSAGE.SET_TOKEN('COLUMN','RECEIPT_METHOD_ID');
494      FND_MESSAGE.SET_TOKEN('TABLE','AR_RECEIPT_METHODS');
495      FND_MSG_PUB.ADD;
496      RAISE FND_API.G_EXC_ERROR;
497    END IF;
498    CLOSE check_receipt_method_id;
499 
500    -- check primary_flag
501    IF NOT(p_payment_method_rec.primary_flag in ('Y','N')) THEN
502      fnd_message.set_name('AR', 'HZ_API_INVALID_LOOKUP');
503      fnd_message.set_token('COLUMN', 'PRIMARY_FLAG');
504      fnd_message.set_token('LOOKUP_TYPE', 'YES/NO');
505      fnd_msg_pub.add;
506      raise fnd_api.g_exc_error;
507    END IF;
508 
509    -- check start_date and end_date
510    IF NOT(p_payment_method_rec.end_date IS NULL or p_payment_method_rec.end_date = FND_API.G_MISS_DATE) THEN
511      IF(p_payment_method_rec.start_date > p_payment_method_rec.end_date) THEN
512        fnd_message.set_name('AR', 'HZ_API_DATE_GREATER');
513        fnd_message.set_token('DATE2', 'END_DATE');
514        fnd_message.set_token('DATE1', 'START_DATE');
515        fnd_msg_pub.add;
516        raise fnd_api.g_exc_error;
517      END IF;
518    END IF;
519 
520 EXCEPTION
521    WHEN FND_API.G_EXC_ERROR THEN
522      x_return_status := FND_API.G_RET_STS_ERROR;
523 
524    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
525      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
526 
527    WHEN OTHERS THEN
528      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
529      FND_MESSAGE.SET_NAME('AR', 'HZ_API_OTHERS_EXCEP');
530      FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
531      FND_MSG_PUB.ADD;
532 END validate_payment_method;
533 
534 END HZ_PAYMENT_METHOD_PUB;