UFN_CREDITCARDPROCESSING_GETCURRENCIESNOTMAPPEDTOMERCHANTACCOUNTS

Returns currencies that will be included in the credit card process but aren't mapped to a merchant account.

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@CREDITCARDPROCESSINGID uniqueidentifier IN
@BATCHID uniqueidentifier IN
@ORGANIZATIONCURRENCYID uniqueidentifier IN

Definition

Copy


            CREATE function dbo.UFN_CREDITCARDPROCESSING_GETCURRENCIESNOTMAPPEDTOMERCHANTACCOUNTS
            (
                @CREDITCARDPROCESSINGID uniqueidentifier,
                @BATCHID uniqueidentifier,
                @ORGANIZATIONCURRENCYID uniqueidentifier
            )
            returns table
            as
            return
            (
                select 
                    distinct CURRENCY.NAME + ' (' + ISO4217 + ')' as NAME
                from 
                    dbo.BATCHREVENUE
                    inner join dbo.CREDITCARD on BATCHREVENUE.CREDITCARDID = CREDITCARD.ID
                    inner join dbo.CURRENCY on CURRENCY.ID = coalesce(TRANSACTIONCURRENCYID, @ORGANIZATIONCURRENCYID)
                where
                    BATCHREVENUE.BATCHID = @BATCHID and
                    dbo.UFN_CONDITIONSETTING_EVALUATEEXISTSCONDITION('Multicurrency') = 1 and
                    coalesce(TRANSACTIONCURRENCYID, @ORGANIZATIONCURRENCYID) not in (    select 
                                                                                            CURRENCYID
                                                                                        from dbo.CREDITCARDPROCESSINGMERCHANTACCOUNT
                                                                                        where
                                                                                            CREDITCARDPROCESSINGID = @CREDITCARDPROCESSINGID) and
                    -- The below filters are used to only include records that will be included in the process as

                    -- credit card transactions that need to be sent to BBPS.  The same logic is kept in 

                    -- CreditCardProcessing.GetBatchData so they need to be kept in synch.

                    BATCHREVENUE.TYPECODE = 0 and
                    BATCHREVENUE.PAYMENTMETHODCODE = 2 and
                    len(BATCHREVENUE.AUTHORIZATIONCODE) = 0 and
                    CREDITCARD.CREDITCARDTOKEN is not null
            )