Monday, May 16, 2011

Create Credit Card in Oracle Payments using API (IBY_FNDCPT_SETUP_PUB.CREATE_CARD)


                                                                                                                            

Below script will help you to create a credit card details in IBY_CREDITCARD table using the API IBY_FNDCPT_SETUP_PUB.CREATE_CARD
Test InstanceR12.1.1
Parameters:
CREDITCARD_REC_TYPE
Meaning
Owner_Id
Owner TCA Party ID
Card_Holder_Name
Name of the card holder as mentioned on the card
Billing_Address_Id
Party Site Id (of a Party Site created previously) linking the Owner_Id (above) and a Location Id containing the Billing Address for the CC. The Party Site must have a created Party Site Use (BILL_TO) before invoking the API.
Card_Number:
The number of the credit card
Expiration_Date
Expiration date of the card
Instrument_Type
Must be 'CREDITCARD'
PurchaseCard_Flag
N' if a CC, 'Y' if a PC.
Card_Issuer
VISA', 'MASTERCARD', 'AMEX', etc…
Note: 'UNKNOWN' credit card type will bypass CC number validation.
Single_Use_Flag
allways set to 'N'
Info_Only_Flag
allways set to 'N', otherwise the CC wont be usable for Payments

SCRIPT:
DECLARE
   l_return_status     VARCHAR2 (1000);
   l_msg_count         NUMBER;
   l_msg_data          VARCHAR2 (4000);
   l_card_id           NUMBER;
   l_msg_data_out      VARCHAR2 (240);
   l_mesg              VARCHAR2 (240);
   p_count             NUMBER;
   l_response          iby_fndcpt_common_pub.result_rec_type;
   l_card_instrument   iby_fndcpt_setup_pub.creditcard_rec_type;
   v_context           VARCHAR2 (10);

   FUNCTION set_context (
      i_user_name   IN   VARCHAR2,
      i_resp_name   IN   VARCHAR2,
      i_org_id      IN   NUMBER
   )
      RETURN VARCHAR2
   IS
   BEGIN
      NULL;
-- Inorder to reduce the content of the post I moved the implementation part of this function to another post and it is available here
   END set_context;
BEGIN
   DBMS_OUTPUT.put_line ('1');
--1. Set applications context if not already set.
   v_context := set_context ('&username', '&resp_name', '&org_id');
   IF v_context = 'F'
   THEN
      DBMS_OUTPUT.put_line ('Error while setting the context');
   END IF;

   DBMS_OUTPUT.put_line ('2');
   mo_global.init ('IBY');
   l_card_instrument.owner_id          := 51426;                      
   l_card_instrument.card_holder_name  := Share Oracle Apps';
   l_card_instrument.billing_address_id:= NULL;                             
   l_card_instrument.card_number       := '5011478596211882';
   l_card_instrument.expiration_date   := '21-OCT-2011';
   l_card_instrument.instrument_type   := 'CREDITCARD';
   l_card_instrument.purchasecard_flag := 'N';
   l_card_instrument.card_issuer       := 'VISA';
   l_card_instrument.single_use_flag   := 'N';
   l_card_instrument.info_only_flag    := 'N';
   l_card_instrument.card_purpose      := 'N';
   l_card_instrument.card_description  := 'Card for Testing';
   l_card_instrument.active_flag       := 'Y';

   IBY_FNDCPT_SETUP_PUB.CREATE_CARD
                       (p_api_version          => 1.0,
                        x_return_status        => l_return_status,
                        x_msg_count            => l_msg_count,
                        x_msg_data             => l_msg_data,
                        p_card_instrument      => l_card_instrument,
                        x_card_id              => l_card_id,
                        x_response             => l_response,
                        p_init_msg_list        => fnd_api.g_true,
                        p_commit               => fnd_api.g_false
                        );
   DBMS_OUTPUT.put_line ('l_return_status = ' || l_return_status);
   DBMS_OUTPUT.put_line ('l_msg_count = ' || l_msg_count);
   DBMS_OUTPUT.put_line ('l_card_id = ' || l_card_id);
   DBMS_OUTPUT.put_line ('l_response.Result_Code = ' ||               
                          l_response.result_code);
   DBMS_OUTPUT.put_line (   'l_response.Result_Category = '
                         || l_response.result_category
                        );
   DBMS_OUTPUT.put_line (   'l_response.Result_Message = '
                         || l_response.result_message
                        );

   IF l_msg_count = 1
   THEN
      DBMS_OUTPUT.put_line ('l_msg_data ' || l_msg_data);
   ELSIF l_msg_count > 1
   THEN
      LOOP
         p_count := p_count + 1;
         l_msg_data := fnd_msg_pub.get (fnd_msg_pub.g_next, fnd_api.g_false);

         IF l_msg_data IS NULL
         THEN
            EXIT;
         END IF;

         DBMS_OUTPUT.put_line ('Message' || p_count || ' ---' || l_msg_data);
      END LOOP;
   END IF;
END;

2 Responses to “Create Credit Card in Oracle Payments using API (IBY_FNDCPT_SETUP_PUB.CREATE_CARD)”

Anonymous said...
September 30, 2013 at 8:05 AM

Hi, Thanks for the program, I just ran the program but i don't see the record in IBY_CREDITCARD table. We are on 12.1.3. Is there any other program that i need to run after this script?

Thanks.
Raj.


Anonymous said...
June 13, 2022 at 7:50 AM

After the code where do you expect the data to appear. As I cannot see the record in IBY_CREDITCARD table. We are on 12.2.10 Is there any other program that i need to run after this script? The question was asked before by Raj.
Thanks.


Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.