/// <summary> /// Update a record for transaction details /// </summary> /// <param name="transactionDetails">Transaction details</param> /// <returns>Response with success, message, and profile token</returns> public ProcessorResponse UpdateTransactionRecord(TransactionDetail transactionDetails) { var response = new ProcessorResponse(); try { using (var db = new GenerousAPIEntities()) { //save changes to database db.Entry(transactionDetails).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } response.Message = "Transaction successfully updated"; response.AuthToken = transactionDetails.PaymentProfileTokenId; response.IsSuccess = true; } catch (Exception ex) { response.IsSuccess = false; response.Message = ex.Message; } return(response); }
/// <summary> /// Delete a payment profile for a donor /// </summary> /// <param name="paymentProfileTokenId">Payment profile token id</param> /// <returns>Payment Response with success, message, and profile token</returns> public ProcessorResponse DeletePaymentProfile(string paymentProfileTokenId) { var response = new ProcessorResponse(); try { using (var db = new GenerousAPIEntities()) { var paymentProfile = db.PaymentProfiles.Where(x => x.TokenId == paymentProfileTokenId).SingleOrDefault(); DbEntityEntry dbEntityEntry = db.Entry(paymentProfile); if (dbEntityEntry.State == System.Data.Entity.EntityState.Detached) { db.PaymentProfiles.Attach(paymentProfile); } db.PaymentProfiles.Remove(paymentProfile); db.SaveChanges(); } response.Message = "Payment profile successfully deleted"; response.IsSuccess = true; } catch (Exception ex) { response.IsSuccess = false; response.Message = ex.Message; } return(response); }
/// <summary> /// Update the Transaction List with the donation details /// </summary> /// <param name="donationTransList">Donation Transaction List</param> public void UpdateDonationTransactionList(IEnumerable <TransactionDetail> donationTransList) { try { using (var db = new GenerousAPIEntities()) { foreach (TransactionDetail trans in donationTransList) { try { db.Entry(trans).State = System.Data.Entity.EntityState.Modified; } catch (Exception ex) { //Common.Helper.LogException(ex); } } db.SaveChanges(); //batching multiple updates } //create log entries for multiple transactions //CreateTransactionLogEntries(donationTransList); } catch (Exception ex) { //Common.Helper.LogException(ex); } }
/// <summary> /// Update existing donor payment profile for a donor /// </summary> /// <param name="BankAccount">Donor payment profile details</param> /// <returns>Payment Response with success, message, and profile token</returns> public ProcessorResponse UpdateBankAccount(BankAccount BankAccount) { var response = new ProcessorResponse(); try { using (var db = new GenerousAPIEntities()) { //save changes to database db.Entry(BankAccount).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } response.Message = "Bank Account successfully updated"; response.AuthToken = BankAccount.BankAccountTokenId; response.IsSuccess = true; } catch (Exception ex) { response.IsSuccess = false; response.Message = ex.Message; } return(response); }
/// <summary> /// Delete a payment profile for a donor /// </summary> /// <param name="BankAccountTokenId">Payment profile token id</param> /// <returns>Payment Response with success, message, and profile token</returns> public ProcessorResponse DeleteBankAccount(string BankAccountTokenId) { var response = new ProcessorResponse(); try { using (var db = new GenerousAPIEntities()) { var BankAccount = db.BankAccounts.Where(x => x.BankAccountTokenId == BankAccountTokenId).SingleOrDefault(); DbEntityEntry dbEntityEntry = db.Entry(BankAccount); if (dbEntityEntry.State == System.Data.Entity.EntityState.Detached) { db.BankAccounts.Attach(BankAccount); } BankAccount.Active = false; db.SaveChanges(); } response.AuthToken = BankAccountTokenId; response.Message = "Bank Account successfully deleted"; response.IsSuccess = true; } catch (Exception ex) { response.IsSuccess = false; response.Message = ex.Message; } return(response); }
/// <summary> /// Updates the the batch line item list /// </summary> /// <param name="batchLineItemList">Line items</param> public void UpdatePaymentToOrganisationBatchLineItemList(List <PaymentToOrganisationBatchLineItem> batchLineItemList) { using (var db = new GenerousAPIEntities()) { foreach (PaymentToOrganisationBatchLineItem lineItem in batchLineItemList) { db.Entry(lineItem).State = System.Data.Entity.EntityState.Modified; } db.SaveChanges(); //batching multiple updates } //create log entries for multiple transactions CreateTransactionLogEntries(batchLineItemList); }
/// <summary> /// Update the organisation fee processing record /// </summary> /// <param name="processedFee"></param> public void UpdateOrganisationFeeStandardPrices(OrganisationStandardFee standFees) { try { using (var db = new GenerousAPIEntities()) { db.Entry(standFees).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception ex) { //Helper.LogException(ex); } }
/// <summary> /// Update the organisation fee processing record /// </summary> /// <param name="processedFee"></param> public void UpdateOrganisationFeeProces(OrganisationFeeProcessing processedFee) { try { using (var db = new GenerousAPIEntities()) { db.Entry(processedFee).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception ex) { //Helper.LogException(ex); } }