UFN_CREDITCARDPROCESSING_GETCURRENCIESNOTMAPPEDFORMEMBERSHIP

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_GETCURRENCIESNOTMAPPEDFORMEMBERSHIP
(
  @CREDITCARDPROCESSINGID uniqueidentifier
  , @BATCHID uniqueidentifier
  , @ORGANIZATIONCURRENCYID uniqueidentifier
)
returns table
as
return
(
  select distinct 
    CURRENCY.NAME + ' (' + ISO4217 + ')' as NAME
  from dbo.BATCHMEMBERSHIPDUES BMD
    inner join dbo.CREDITCARD on BMD.CREDITCARDID = CREDITCARD.ID
    inner join dbo.CURRENCY on CURRENCY.ID = coalesce(TRANSACTIONCURRENCYID, @ORGANIZATIONCURRENCYID)
  where
    BMD.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.

    BMD.REVENUETYPECODE in (0, 1) and
    BMD.PAYMENTMETHODCODE = 2 and
    len(BMD.AUTHORIZATIONCODE) = 0 and
    len(BMD.REJECTIONMESSAGE) = 0 and
    CREDITCARD.CREDITCARDTOKEN is not null
)