public ServiceResponse DeletePaymentMethod(String VaultPaymentId) { OPERATIONPARAMETERS operationParameters = new OPERATIONPARAMETERS(); operationParameters.ACTIONCODE = 3; TRANSACTION_VAULT transactionVault = SecureNetController.GetVaultTransactionWithDefaults(); transactionVault.ACCOUNT_VAULT = new ACCOUNT_VAULT(); transactionVault.ACCOUNT_VAULT.CUSTOMERID = ThisCustomer.CustomerID.ToString(); transactionVault.ACCOUNT_VAULT.PAYMENTID = VaultPaymentId; transactionVault.OPERATIONPARAMETERS = operationParameters; GATEWAYRESPONSE gatewayResponse = gsClient.ProcessAccount(transactionVault); if (gatewayResponse.VAULTACCOUNTRESPONSE.RESPONSE_CODE != "1") { return(new ServiceResponse(true, gatewayResponse.VAULTACCOUNTRESPONSE.RESPONSE_REASON_TEXT, gatewayResponse.VAULTACCOUNTRESPONSE.RESPONSE_REASON_CODE)); } return(new ServiceResponse(false, "Payment Account Added")); }
public ServiceResponse AddCreditCardToCustomerVault(String CardHolderName, String CardNumber, String CardCCV, String CardType, String ExpMonth, String ExpYear) { String CleanedCardNumber = ParseCardInt(CardNumber); if (CleanedCardNumber.Length != 16) { return(new ServiceResponse(true, "Please enter a valid credit card number.")); } if (this.CardExists(CardNumber, ExpMonth, ExpYear)) { return(new ServiceResponse(true, "This card has already been saved.")); } else { OPERATIONPARAMETERS operationParameters = new OPERATIONPARAMETERS(); operationParameters.ACTIONCODE = 1; operationParameters.ADD_IF_DECLINED = 0; TRANSACTION_VAULT transactionVault = SecureNetController.GetVaultTransactionWithDefaults(); transactionVault.TRANSACTION = SecureNetController.GetTransactionWithDefaults(); transactionVault.TRANSACTION.TRANSACTION_SERVICE = 3; transactionVault.TRANSACTION.CUSTOMER_BILL = GetVaultAccountCustomerBill(); transactionVault.TRANSACTION.CODE = SecureNetController.GetTypeCodeString(SecureNetTransactionTypeCode.VERIFICATION); transactionVault.ACCOUNT_VAULT = GetAccountVault(ThisCustomer, CardHolderName, CardNumber, CardCCV, CardType, ExpMonth, ExpYear); transactionVault.CUSTOMER_VAULT = GetCustomerVault(); transactionVault.OPERATIONPARAMETERS = operationParameters; GATEWAYRESPONSE gatewayResponse = gsClient.ProcessCustomerAndAccount(transactionVault); if (gatewayResponse.VAULTACCOUNTRESPONSE.RESPONSE_CODE != "1") { return(new ServiceResponse(true, gatewayResponse.VAULTACCOUNTRESPONSE.RESPONSE_REASON_TEXT, gatewayResponse.VAULTACCOUNTRESPONSE.RESPONSE_REASON_CODE)); } if (gatewayResponse.VAULTCUSTOMERRESPONSE.RESPONSE_CODE != "1") { return(new ServiceResponse(true, gatewayResponse.VAULTCUSTOMERRESPONSE.RESPONSE_REASON_TEXT, gatewayResponse.VAULTCUSTOMERRESPONSE.RESPONSE_REASON_CODE)); } return(new ServiceResponse(false, "Payment Account Added")); } }