def processValidExpDate(expDate, serverMode): r"""The ValidExpDate service checks the expiration date to ensure it is valid. Args: expDate (str): The expiration date of the credit card to verify in MMYY format. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL else: domain = ConstantResources.PRODUCTION_SERVER_URL paramStr = {"ExpDate": expDate} response = ConnectionHandler.sendHttpPostRequest( paramStr, domain, '/transactservices.svc/ValidExpDate') if isinstance(response, Exception): return response elif response is not None and response != "": validationResponse = TransactionXMLParser.getValidateExpDateResponse( response) return validationResponse else: return None
def processValidCard(cardNum, expDate, serverMode): r"""The ValidCard service operation performs a validation check on a credit card. It checks the card length based on the card type, performs a mod 10 checksum, and checks the expiration date. Args: cardNum (str): The credit card number to verify. |br| expDate (str): The expiration date of the credit card to verify in MMYY format. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL else: domain = ConstantResources.PRODUCTION_SERVER_URL paramStr = {"CardNumber": cardNum, "ExpDate": expDate} response = ConnectionHandler.sendHttpPostRequest( paramStr, domain, '/transactservices.svc/ValidCard') if isinstance(response, Exception): return response elif response is not None and response != "": validationResponse = TransactionXMLParser.getValidateCardResponse( response) return validationResponse else: return None
def processValidCardLength(cardNum, serverMode): r"""The ValidCardLength service checks the card length based on the card type. Args: cardNum (str): The credit card number to verify. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL else: domain = ConstantResources.PRODUCTION_SERVER_URL paramStr = {"CardNumber": cardNum} response = ConnectionHandler.sendHttpPostRequest( paramStr, domain, '/transactservices.svc/ValidCardLength') if isinstance(response, Exception): return response elif response is not None and response != "": validationResponse = TransactionXMLParser.getValidateCardLengthResponse( response) return validationResponse else: return None
def processValidCardLength(cardNum, serverMode): r"""The ValidCardLength service checks the card length based on the card type. Args: cardNum (str): The credit card number to verify. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL else: domain = ConstantResources.PRODUCTION_SERVER_URL paramStr = { "CardNumber" : cardNum } response = ConnectionHandler.sendHttpPostRequest(paramStr, domain, '/transactservices.svc/ValidCardLength') if isinstance(response, Exception): return response elif response is not None and response != "": validationResponse = TransactionXMLParser.getValidateCardLengthResponse(response) return validationResponse; else: return None
def processValidExpDate(expDate, serverMode): r"""The ValidExpDate service checks the expiration date to ensure it is valid. Args: expDate (str): The expiration date of the credit card to verify in MMYY format. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL else: domain = ConstantResources.PRODUCTION_SERVER_URL paramStr = { "ExpDate" : expDate } response = ConnectionHandler.sendHttpPostRequest(paramStr, domain, '/transactservices.svc/ValidExpDate') if isinstance(response, Exception): return response elif response is not None and response != "": validationResponse = TransactionXMLParser.getValidateExpDateResponse(response) return validationResponse; else: return None
def processValidCard(cardNum, expDate, serverMode): r"""The ValidCard service operation performs a validation check on a credit card. It checks the card length based on the card type, performs a mod 10 checksum, and checks the expiration date. Args: cardNum (str): The credit card number to verify. |br| expDate (str): The expiration date of the credit card to verify in MMYY format. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL else: domain = ConstantResources.PRODUCTION_SERVER_URL paramStr = { "CardNumber" : cardNum, "ExpDate" : expDate } response = ConnectionHandler.sendHttpPostRequest(paramStr, domain, '/transactservices.svc/ValidCard') if isinstance(response, Exception): return response elif response is not None and response != "": validationResponse = TransactionXMLParser.getValidateCardResponse(response) return validationResponse; else: return None
def processCreditCard(transType, cardNum, expDate, nameOnCard, magData, amount, invNum, pnref, zipCode, street, cvNumber, extData, serverMode): r"""This method will help to build the ProcessCreditCard request, to send the same request and after getting it's response will extract it's data and will return the response Args: transType (str): The transaction type being performed. e.g. Sale, Adjustment etc. |br| cardNum (str): The credit card number used for the transaction. |br| expDate (str): The expiration date of the credit card used for the transaction in MMYY format. |br| nameOnCard (str): The cardholder's name as printed on the card. |br| magData (str): For swiped transactions, the complete raw magnetic stripe data from the card wrapped in single quotes. |br| amount (str): The dollar amount of the transaction in DDDDDDDDDD.CC format. This amount includes any tax or tip amounts specified in ExtData. |br| invNum (str): The invoice number used by the merchant to identify the transaction. |br| pnref (str): Not used for this transaction type. |br| zipCode (str): The cardholder's billing ZIP code. Used for AVS. |br| street (str): The cardholder's street address. Used for AVS. |br| cvNumber (str): The 3 to 4 digit card verification number. For American Express, four digits displayed on the front of the card; for other card types, usually three digits displayed on the back of the card. |br| extData (str): An XML string containing additional data for the transaction. See the following section for more information. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL userName = ConstantResources.UAT_USER_ID password = ConstantResources.UAT_USER_PASSWORD else: domain = ConstantResources.PRODUCTION_SERVER_URL userName = ConstantResources.PRODUCTION_USER_ID password = ConstantResources.PRODUCTION_USER_PASSWORD paramStr = { "UserName" : userName, "Password" : password, "TransType" : transType, "CardNum" : cardNum, "ExpDate" : expDate, "MagData" : magData, "NameOnCard" : nameOnCard, "Amount" : amount, "InvNum" : invNum, "PNRef" : pnref, "Zip" : zipCode, "Street" : street, "CVNum" : cvNumber, "ExtData" : extData } response = ConnectionHandler.sendHttpPostRequest(paramStr, domain, '/transactServices.svc/ProcessCreditCard') if isinstance(response, Exception): return response elif response is not None and response != "": transactionXMLParser = TransactionXMLParser(response); return transactionXMLParser; else: return None
def processGiftCard(transType, cardNum, expDate, magData, amount, invNum, pnref, extData, serverMode): r"""This method will help to build the ProcessGiftCard request, to send the same request and after getting it's response will extract it's data and will return the response Args: transType (str): The transaction type being performed. |br| cardNum (str): The gift card number used for the transaction. |br| expDate (str): The expiration date of the gift card used for the transaction in MMYY format. |br| magData (str): The complete raw magnetic stripe data from the card wrapped in single quotes. |br| amount (str): The dollar amount of the transaction in DDDDDDDDDD.CC format. |br| invNum (str): The invoice number used by the merchant to identify the transaction. |br| pnref (str): The PNRef number of the original transaction being refunded. If applicable. |br| extData (str): An XML string containing additional data for the transaction. See the following section for more information. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL userName = ConstantResources.UAT_USER_ID password = ConstantResources.UAT_USER_PASSWORD else: domain = ConstantResources.PRODUCTION_SERVER_URL userName = ConstantResources.PRODUCTION_USER_ID password = ConstantResources.PRODUCTION_USER_PASSWORD paramStr = { "UserName" : userName, "Password" : password, "TransType" : transType, "CardNum" : cardNum, "ExpDate" : expDate, "MagData" : magData, "Amount" : amount, "InvNum" : invNum, "PNRef" : pnref, "ExtData" : extData } response = ConnectionHandler.sendHttpPostRequest(paramStr, domain, '/transactservices.svc/ProcessGiftCard') if isinstance(response, Exception): return response elif response is not None and response != "": transactionXMLParser = TransactionXMLParser(response); return transactionXMLParser; else: return None
def processDebitCard(transType, cardNum, expDate, magData, nameOnCard, amount, invNum, pNRef, pin, sureChargeAmt, cashBackAmt, registerNum, extData, serverMode): r"""This method will help to build the ProcessDebitCard request, to send the same request and after getting it's response will extract it's data and will return the response Args: transType (str): The transaction type being performed. |br| cardNum (str): The debit card number used for the transaction. |br| expDate (str): The expiration date of the debit card used for the transaction in MMYY format. |br| magData (str): The complete raw magnetic stripe data from the card wrapped in single quotes. |br| nameOnCard (str): The cardholder's name as printed on the card. |br| amount (str): The dollar amount of the transaction in DDDDDDDDDD.CC format. This amount includes any cash back or surcharge amounts and any tax or tip amounts specified in ExtData. |br| invNum (str): The invoice number used by the merchant to identify the transaction. |br| pNRef (str): The PNRef number of the original sale transaction being refunded. |br| pin (str): The encrypted PIN block returned by the PIN pad. The transaction will fail if an unencrypted PIN value is used. |br| sureChargeAmt (str): The amount in DDDD.CC format that a merchant charges for processing a debit card transaction. |br| cashBackAmt (str): The amount in DDDD.CC format that a cardholder requests for cash back |br| registerNum (str): Not used |br| extData (str): An XML string containing additional data for the transaction. See the following section for more information. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL userName = ConstantResources.UAT_USER_ID password = ConstantResources.UAT_USER_PASSWORD else: domain = ConstantResources.PRODUCTION_SERVER_URL userName = ConstantResources.PRODUCTION_USER_ID password = ConstantResources.PRODUCTION_USER_PASSWORD paramStr = { "UserName": userName, "Password": password, "TransType": transType, "CardNum": cardNum, "ExpDate": expDate, "MagData": magData, "NameOnCard": nameOnCard, "Amount": amount, "InvNum": invNum, "PNRef": pNRef, "Pin": pin, "SureChargeAmt": sureChargeAmt, "CashBackAmt": cashBackAmt, "RegisterNum": registerNum, "ExtData": extData } response = ConnectionHandler.sendHttpPostRequest( paramStr, domain, '/transactservices.svc/ProcessDebitCard') if isinstance(response, Exception): return response elif response is not None and response != "": transactionXMLParser = TransactionXMLParser(response) return transactionXMLParser else: return None
def processCheck(transType, checkNum, transitNum, accountNum, invNum, amount, micr, nameOnCheck, dl, ss, dob, stateCode, checkType, pnref, magdata, extData, serverMode): r"""This method will help to build the ProcessCheck request, to send the same request and after getting it's response will extract it's data and will return the response Args: transType (str): The transaction type being performed. |br| checkNum (str): The check number printed on the check. |br| transitNum (str): The routing number printed on the check. |br| accountNum (str): The account number printed on the check. |br| invNum (str): Not used for this service. |br| amount (str): The dollar amount of the transaction in DDDDDDDDDD.CC format. |br| micr (str): The raw MICR data from the check in the following format. |br| [TransitNum]T[AccountNum]O[CheckNum] |br| Required only for the following SecCode values specified in ExtData: POP, BOC, ARC, C21 |br| nameOnCheck (str): The customer's name as printed on the check. |br| dl (str): The customer's driver's license number. Usage varies by check processor. |br| ss (str): The customer's social security number. Usage varies by check processor. |br| dob (str): The customer's date of birth in MM/DD/YYYY format. Usage varies by check processor. |br| stateCode (str): The customer's two-digit driver's license state or province code. Usage varies by check processor. |br| checkType (str): The type of bank account on which the check draws. Valid values are: |br| Personal |br| Corporate |br| Government |br| pnref (str): The PNRef number of the original sale transaction being refunded |br| magdata (str): |br| extData (str): An XML string containing additional data for the transaction. See the following section for more information. |br| serverMode (str): Valid values are: PRODUCTION, UAT. |br| Returns: TransactionXMLParser. Will populated using XML response. Raises: Exception, For all type of exceptions """ if serverMode == "UAT": domain = ConstantResources.UAT_SERVER_URL userName = ConstantResources.UAT_USER_ID password = ConstantResources.UAT_USER_PASSWORD else: domain = ConstantResources.PRODUCTION_SERVER_URL userName = ConstantResources.PRODUCTION_USER_ID password = ConstantResources.PRODUCTION_USER_PASSWORD paramStr = { "UserName": userName, "Password": password, "TransType": transType, "CheckNum": checkNum, "TransitNum": transitNum, "AccountNum": accountNum, "InvNum": invNum, "Amount": amount, "InvNum": invNum, "MICR": micr, "NameOnCheck": nameOnCheck, "DL": dl, "SS": ss, "DOB": dob, "StateCode": stateCode, "CheckType": checkType, "PNRef": pnref, "MagData": magdata, "ExtData": extData } response = ConnectionHandler.sendHttpPostRequest( paramStr, domain, '/transactservices.svc/ProcessCheck') if isinstance(response, Exception): return response elif response is not None and response != "": transactionXMLParser = TransactionXMLParser(response) return transactionXMLParser else: return None