23: G_CLAIM_STATUS CONSTANT VARCHAR2(30) := 'OZF_CLAIM_STATUS';
24: G_OPEN_STATUS CONSTANT VARCHAR2(30) := 'OPEN';
25: G_CLOSED_STATUS CONSTANT VARCHAR2(30) := 'CLOSED';
26:
27: OZF_DEBUG_HIGH_ON BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_high);
28: OZF_DEBUG_LOW_ON BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_low);
29:
30: ---------------------------------------------------------------------
31: -- Definitions of some packagewise cursors.
24: G_OPEN_STATUS CONSTANT VARCHAR2(30) := 'OPEN';
25: G_CLOSED_STATUS CONSTANT VARCHAR2(30) := 'CLOSED';
26:
27: OZF_DEBUG_HIGH_ON BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_high);
28: OZF_DEBUG_LOW_ON BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_low);
29:
30: ---------------------------------------------------------------------
31: -- Definitions of some packagewise cursors.
32: ---------------------------------------------------------------------
126: -- Initialize API return status to sucess
127: x_return_status := FND_API.G_RET_STS_SUCCESS;
128:
129: IF p_customer_info.claim_currency is null THEN
130: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
131: OPEN csr_cust_name(l_cust_account_id);
132: FETCH csr_cust_name INTO l_cust_name_num;
133: CLOSE csr_cust_name;
134:
133: CLOSE csr_cust_name;
134:
135: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_CURRENCY_MISS');
136: FND_MESSAGE.Set_Token('ID',l_cust_name_num);
137: FND_MSG_PUB.ADD;
138: END IF;
139: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
140: END IF;
141:
139: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
140: END IF;
141:
142: IF p_customer_info.payment_method is null THEN
143: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
144: OPEN csr_cust_name(l_cust_account_id);
145: FETCH csr_cust_name INTO l_cust_name_num;
146: CLOSE csr_cust_name;
147:
146: CLOSE csr_cust_name;
147:
148: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_PYMTHD_MISS');
149: FND_MESSAGE.Set_Token('ID',l_cust_name_num);
150: FND_MSG_PUB.ADD;
151: END IF;
152: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
153: END IF;
154:
154:
155: IF p_customer_info.payment_method = 'CHECK' THEN
156: IF p_customer_info.vendor_id is NULL OR
157: p_customer_info.vendor_site_id is NULL THEN
158: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
159: OPEN csr_cust_name(l_cust_account_id);
160: FETCH csr_cust_name INTO l_cust_name_num;
161: CLOSE csr_cust_name;
162:
161: CLOSE csr_cust_name;
162:
163: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_VENDOR_MISS');
164: FND_MESSAGE.Set_Token('ID',l_cust_name_num);
165: FND_MSG_PUB.ADD;
166: END IF;
167: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
168: --Added for Bug 16301629
169: ELSE
170: OPEN csr_active_vendor(p_customer_info.vendor_id, p_customer_info.vendor_site_id);
171: FETCH csr_active_vendor INTO l_active_vendor_num;
172: CLOSE csr_active_vendor;
173: IF l_active_vendor_num is null THEN
174: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
175: OPEN csr_cust_name(l_cust_account_id);
176: FETCH csr_cust_name INTO l_cust_name_num;
177: CLOSE csr_cust_name;
178: FND_MESSAGE.Set_Name('OZF', 'OZF_TRADE_VENDOR_INACTIVE');
176: FETCH csr_cust_name INTO l_cust_name_num;
177: CLOSE csr_cust_name;
178: FND_MESSAGE.Set_Name('OZF', 'OZF_TRADE_VENDOR_INACTIVE');
179: FND_MESSAGE.Set_Token('ID',l_cust_name_num);
180: FND_MSG_PUB.ADD;
181: END IF;
182: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
183: END IF;
184: --end bug 16301629
185: END IF;
186: --nepanda : fix for bug # 9539273 - issue #2
187: /* ELSIF p_customer_info.payment_method = 'CREDIT_MEMO' THEN
188: IF p_customer_info.site_use_id is NULL THEN
189: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
190: OPEN csr_cust_name(l_cust_account_id);
191: FETCH csr_cust_name INTO l_cust_name_num;
192: CLOSE csr_cust_name;
193:
192: CLOSE csr_cust_name;
193:
194: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_SITEID_MISS');
195: FND_MESSAGE.Set_Token('ID',l_cust_name_num);
196: FND_MSG_PUB.ADD;
197: END IF;
198: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
199: END IF;*/
200: END IF;
200: END IF;
201:
202: /*
203: IF p_customer_info.org_id is null THEN
204: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
205: OPEN csr_cust_name(l_cust_account_id);
206: FETCH csr_cust_name INTO l_cust_name_num;
207: CLOSE csr_cust_name;
208:
207: CLOSE csr_cust_name;
208:
209: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_ORG_ID_MISS');
210: FND_MESSAGE.Set_Token('ID',l_cust_name_num);
211: FND_MSG_PUB.add;
212: END IF;FND_MSG_PUB.ADD;
213: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
214: END IF;
215: */
208:
209: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_ORG_ID_MISS');
210: FND_MESSAGE.Set_Token('ID',l_cust_name_num);
211: FND_MSG_PUB.add;
212: END IF;FND_MSG_PUB.ADD;
213: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
214: END IF;
215: */
216:
216:
217: EXCEPTION
218: WHEN OTHERS THEN
219: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
220: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
221: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_ATPY_CUSTOMER_ERR');
222: FND_MSG_PUB.add;
223: END IF;
224: END validate_customer_info;
218: WHEN OTHERS THEN
219: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
220: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
221: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_ATPY_CUSTOMER_ERR');
222: FND_MSG_PUB.add;
223: END IF;
224: END validate_customer_info;
225:
226:
265: -- l_return_date := add_months(p_last_date, p_period*6);
266: ELSIF p_type = G_ANNUAL THEN
267: l_return_date := add_months(p_last_date, p_period*12);
268: ELSE
269: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
270: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_ATPY_AUPD_MISS');
271: FND_MSG_PUB.add;
272: END IF;
273: RAISE FND_API.G_EXC_ERROR;
267: l_return_date := add_months(p_last_date, p_period*12);
268: ELSE
269: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
270: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_ATPY_AUPD_MISS');
271: FND_MSG_PUB.add;
272: END IF;
273: RAISE FND_API.G_EXC_ERROR;
274: END IF;
275: x_pay_date := l_return_date;
395: IF p_autopay_periodicity is NULL OR
396: p_autopay_periodicity_type is NULL THEN
397: -- write to a log file
398: -- skip this customer
399: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
400: OPEN csr_cust_name(p_customer_info.cust_account_id);
401: FETCH csr_cust_name INTO l_cust_name_num;
402: CLOSE csr_cust_name;
403:
402: CLOSE csr_cust_name;
403:
404: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_PERIOD_MISS');
405: FND_MESSAGE.Set_Token('ID', l_cust_name_num);
406: FND_MSG_PUB.ADD;
407: END IF;
408: RAISE FND_API.g_exc_unexpected_error;
409: --goto end_loop;
410: END IF;
425: x_pay_date => l_last_pay_date,
426: x_return_status => l_return_status
427: );
428: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
429: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
430: OPEN csr_cust_name(p_customer_info.cust_account_id);
431: FETCH csr_cust_name INTO l_cust_name_num;
432: CLOSE csr_cust_name;
433:
432: CLOSE csr_cust_name;
433:
434: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_PAY_DATE_MISS');
435: FND_MESSAGE.Set_Token('ID', l_cust_name_num);
436: FND_MSG_PUB.ADD;
437: END IF;
438: RAISE FND_API.g_exc_unexpected_error;
439: END IF;
440: END IF;
555: END IF;
556: END IF;
557:
558: ELSE
559: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
560: OPEN csr_cust_name(p_customer_info.cust_account_id);
561: FETCH csr_cust_name INTO l_cust_name_num;
562: CLOSE csr_cust_name;
563:
562: CLOSE csr_cust_name;
563:
564: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_CUST_INELIG');
565: FND_MESSAGE.Set_Token('ID', l_cust_name_num);
566: FND_MSG_PUB.ADD;
567: END IF;
568: RAISE FND_API.g_exc_unexpected_error;
569: END IF;
570: ELSE
567: END IF;
568: RAISE FND_API.g_exc_unexpected_error;
569: END IF;
570: ELSE
571: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
572: OPEN csr_cust_name(p_customer_info.cust_account_id);
573: FETCH csr_cust_name INTO l_cust_name_num;
574: CLOSE csr_cust_name;
575:
574: CLOSE csr_cust_name;
575:
576: FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_ATPY_AMT_SMALL');
577: FND_MESSAGE.Set_Token('ID', l_cust_name_num);
578: FND_MSG_PUB.ADD;
579: END IF;
580: RAISE FND_API.g_exc_unexpected_error;
581: END IF;
582:
666: -- Debug Message
667: IF OZF_DEBUG_LOW_ON THEN
668: FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
669: FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
670: FND_MSG_PUB.Add;
671: END IF;
672:
673: -- get autopay_flag, reason_code_id
674: OPEN sys_parameter_info_csr;
680: CLOSE sys_parameter_info_csr;
681:
682: -- check reason_code and claim_type from sys_parameters.
683: IF l_auto_reason_code_id is NULL THEN
684: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
685: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_REASON_CD_MISSING');
686: FND_MSG_PUB.add;
687: END IF;
688: RAISE FND_API.g_exc_unexpected_error;
682: -- check reason_code and claim_type from sys_parameters.
683: IF l_auto_reason_code_id is NULL THEN
684: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
685: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_REASON_CD_MISSING');
686: FND_MSG_PUB.add;
687: END IF;
688: RAISE FND_API.g_exc_unexpected_error;
689: END IF;
690:
688: RAISE FND_API.g_exc_unexpected_error;
689: END IF;
690:
691: IF l_auto_claim_type_id is NULL THEN
692: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
693: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_CLAIM_TYPE_MISSING');
694: FND_MSG_PUB.add;
695: END IF;
696: RAISE FND_API.g_exc_unexpected_error;
690:
691: IF l_auto_claim_type_id is NULL THEN
692: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
693: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_CLAIM_TYPE_MISSING');
694: FND_MSG_PUB.add;
695: END IF;
696: RAISE FND_API.g_exc_unexpected_error;
697: END IF;
698:
747: -- Debug Message
748: IF OZF_DEBUG_LOW_ON THEN
749: FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
750: FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
751: FND_MSG_PUB.Add;
752: END IF;
753:
754: EXCEPTION
755: WHEN FND_API.g_exc_error THEN
753:
754: EXCEPTION
755: WHEN FND_API.g_exc_error THEN
756: ROLLBACK TO BDOffer;
757: FND_MSG_PUB.count_and_get (
758: p_encoded => FND_API.g_false
759: ,p_count => l_msg_count
760: ,p_data => l_msg_data
761: );
760: ,p_data => l_msg_data
761: );
762: WHEN FND_API.g_exc_unexpected_error THEN
763: ROLLBACK TO BDOffer;
764: FND_MSG_PUB.count_and_get (
765: p_encoded => FND_API.g_false
766: ,p_count => l_msg_count
767: ,p_data => l_msg_data
768: );
767: ,p_data => l_msg_data
768: );
769: WHEN OTHERS THEN
770: ROLLBACK TO BDOffer;
771: FND_MSG_PUB.count_and_get (
772: p_encoded => FND_API.g_false
773: ,p_count => l_msg_count
774: ,p_data => l_msg_data
775: );
977: -- Debug Message
978: IF OZF_DEBUG_LOW_ON THEN
979: FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
980: FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
981: FND_MSG_PUB.Add;
982: END IF;
983:
984: --Multiorg Changes
985: MO_GLOBAL.init('OZF');
1119: CLOSE sys_parameter_info_csr;
1120:
1121: -- check reason_code and claim_type from sys_parameters.
1122: IF l_auto_reason_code_id is NULL THEN
1123: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
1124: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_REASON_CD_MISSING');
1125: FND_MSG_PUB.add;
1126: END IF;
1127: RAISE FND_API.g_exc_unexpected_error;
1121: -- check reason_code and claim_type from sys_parameters.
1122: IF l_auto_reason_code_id is NULL THEN
1123: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
1124: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_REASON_CD_MISSING');
1125: FND_MSG_PUB.add;
1126: END IF;
1127: RAISE FND_API.g_exc_unexpected_error;
1128: END IF;
1129:
1127: RAISE FND_API.g_exc_unexpected_error;
1128: END IF;
1129:
1130: IF l_auto_claim_type_id is NULL THEN
1131: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
1132: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_CLAIM_TYPE_MISSING');
1133: FND_MSG_PUB.add;
1134: END IF;
1135: RAISE FND_API.g_exc_unexpected_error;
1129:
1130: IF l_auto_claim_type_id is NULL THEN
1131: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
1132: FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_CLAIM_TYPE_MISSING');
1133: FND_MSG_PUB.add;
1134: END IF;
1135: RAISE FND_API.g_exc_unexpected_error;
1136: END IF;
1137:
1223: FND_DSQL.do_binds;
1224:
1225: l_ignore := DBMS_SQL.execute(l_emp_csr);
1226: LOOP
1227: FND_MSG_PUB.initialize;
1228:
1229: IF DBMS_SQL.fetch_rows(l_emp_csr) > 0 THEN
1230: DBMS_SQL.column_value(l_emp_csr, 1, l_offer_pay_method);
1231: DBMS_SQL.column_value(l_emp_csr, 2, l_amount);
1466: OZF_UTILITY_PVT.write_conc_log;
1467: FND_FILE.PUT_LINE(FND_FILE.LOG, '/*--- End ---*/');
1468: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
1469: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'Status : Auto Pay Failed. ');
1470: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'Error : ' || FND_MSG_PUB.get(FND_MSG_PUB.count_msg, FND_API.g_false));
1471: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, '');
1472: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1473: ROLLBACK TO AUTOPAY_CUST;
1474: FND_FILE.PUT_LINE(FND_FILE.LOG, '===> Failed.');
1475: OZF_UTILITY_PVT.write_conc_log;
1476: FND_FILE.PUT_LINE(FND_FILE.LOG, '/*--- End ---*/');
1477: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
1478: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'Status : Auto Pay Failed. ');
1479: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'Error : ' || FND_MSG_PUB.get(FND_MSG_PUB.count_msg, FND_API.g_false));
1480: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, '');
1481:
1482: WHEN OTHERS THEN
1483: ROLLBACK TO AUTOPAY_CUST;
1484: FND_FILE.PUT_LINE(FND_FILE.LOG, '===> Failed.');
1485: IF OZF_DEBUG_LOW_ON THEN
1486: FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
1487: FND_MESSAGE.Set_Token('TEXT',sqlerrm);
1488: FND_MSG_PUB.Add;
1489: END IF;
1490: OZF_UTILITY_PVT.write_conc_log;
1491: FND_FILE.PUT_LINE(FND_FILE.LOG, '/*--- End ---*/');
1492: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
1512: -- Debug Message
1513: IF OZF_DEBUG_LOW_ON THEN
1514: FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
1515: FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
1516: FND_MSG_PUB.Add;
1517: END IF;
1518:
1519: -- Write all messages to a log
1520: OZF_UTILITY_PVT.Write_Conc_Log;
1530:
1531: OZF_UTILITY_PVT.Write_Conc_Log;
1532: ERRBUF := l_msg_data;
1533: RETCODE := 2;
1534: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'Execution Status: Failure (Error:' || FND_MSG_PUB.get(1, FND_API.g_false)||')');
1535: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'Execution Ends On: ' || to_char(sysdate,'MM-DD-YYYY HH24:MI:SS'));
1536: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, '*---------------------------------------------------------------------------------------------*');
1537:
1538: WHEN FND_API.g_exc_unexpected_error THEN
1540:
1541: OZF_UTILITY_PVT.Write_Conc_Log;
1542: ERRBUF := l_msg_data;
1543: RETCODE := 1; -- show status as warning if claim type/reason is missing, Fix for 5158782
1544: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'Execution Status: ( Warning:' || FND_MSG_PUB.get(1, FND_API.g_false)||')');
1545: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'Execution Ends On: ' || to_char(sysdate,'MM-DD-YYYY HH24:MI:SS'));
1546: FND_FILE.PUT_LINE(FND_FILE.OUTPUT, '*---------------------------------------------------------------------------------------------*');
1547:
1548: WHEN OTHERS THEN