示例#1
0
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.orderId)
            {
                hashcode = (hashcode * 397) + OrderId.GetHashCode();
            }
            if (__isset.confirmUrl)
            {
                hashcode = (hashcode * 397) + ConfirmUrl.GetHashCode();
            }
            if (__isset.extras)
            {
                hashcode = (hashcode * 397) + TCollections.GetHashCode(Extras);
            }
        }
        return(hashcode);
    }
示例#2
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("PaymentReservationResult(");
        bool __first = true;

        if (OrderId != null && __isset.orderId)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("OrderId: ");
            OrderId.ToString(sb);
        }
        if (ConfirmUrl != null && __isset.confirmUrl)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ConfirmUrl: ");
            ConfirmUrl.ToString(sb);
        }
        if (Extras != null && __isset.extras)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Extras: ");
            Extras.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
示例#3
0
        public async ValueTask <App?> ExecuteAsync(App app, IServiceProvider serviceProvider,
                                                   CancellationToken ct)
        {
            Validate <Validator> .It(this);

            var newApp = app;

            if (Is.Changed(Languages, app.Languages))
            {
                newApp = newApp with
                {
                    Languages = Languages.ToReadonlyList()
                };
            }

            if (Is.Changed(Name, app.Name))
            {
                newApp = newApp with
                {
                    Name = Name.Trim()
                };
            }

            if (Is.Changed(ConfirmUrl, app.ConfirmUrl))
            {
                newApp = newApp with
                {
                    ConfirmUrl = ConfirmUrl.Trim()
                };
            }

            if (app.ApiKeys.Count == 0)
            {
                var apiKeyGenerator = serviceProvider.GetRequiredService <IApiKeyGenerator>();

                newApp = newApp with
                {
                    ApiKeys = new Dictionary <string, string>
                    {
                        [await apiKeyGenerator.GenerateAppTokenAsync(app.Id)] = NotifoRoles.AppAdmin,
                        [await apiKeyGenerator.GenerateAppTokenAsync(app.Id)] = NotifoRoles.AppAdmin,
                        [await apiKeyGenerator.GenerateAppTokenAsync(app.Id)] = NotifoRoles.AppWebManager,
                        [await apiKeyGenerator.GenerateAppTokenAsync(app.Id)] = NotifoRoles.AppWebManager
                    }.ToReadonlyDictionary()
                };
            }

            if (app.Contributors.Count == 0 && !string.IsNullOrWhiteSpace(UserId))
            {
                newApp = newApp with
                {
                    Contributors = new Dictionary <string, string>
                    {
                        [UserId] = NotifoRoles.AppOwner
                    }.ToReadonlyDictionary()
                };
            }

            return(newApp);
        }
    }
}