internal static bool StoreDunningAttempt(string accountId, string storagePartition, string stripeChargeId, string chargeAmount, string stripeSubscriptionId, string stripeEventId, string failureMessage) { var automaticDunningAttempts = new AutomaticDunningAttemptsTableEntity(accountId, storagePartition, stripeChargeId); automaticDunningAttempts.ChargeAmount = Sahara.Core.Common.Methods.Billing.ConvertStripeAmountToDollars(chargeAmount); automaticDunningAttempts.StripeSubscriptionID = stripeSubscriptionId; automaticDunningAttempts.StripeEventID = stripeEventId; automaticDunningAttempts.FailureMessage = failureMessage; //automaticDunningAttempts.AttemptTime = DateTime.UtcNow; TableOperation operation = TableOperation.Insert((automaticDunningAttempts as TableEntity)); automaticDunningAttempts.cloudTable.Execute(operation); return(true); }
internal static DunningAttempt TransformAutomaticDunningAttemptsTableEntityToDunningAttempt(AutomaticDunningAttemptsTableEntity tableEntity) { var dunningAttempt = new DunningAttempt(); dunningAttempt.WarningDate = tableEntity.Timestamp; dunningAttempt.Description = tableEntity.FailureMessage; dunningAttempt.Amount = tableEntity.ChargeAmount; dunningAttempt.StripeChargeId = tableEntity.StripeChargeID; dunningAttempt.StripeEventId = tableEntity.StripeEventID; dunningAttempt.StripeSubscriptionId = tableEntity.StripeSubscriptionID; return(dunningAttempt); }