public void DrawFields(ExperienceProfile profile, string name)
        {
            EditorGUILayout.BeginHorizontal();
            {
                GUILayout.Label(name, GUILayout.Width(Screen.width * 0.2F));
            }
            EditorGUILayout.EndHorizontal();

            _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos);

            var tmpEditor = UnityEditor.Editor.CreateEditor(profile);

            if (_currentConfigEditor != null)
            {
                Object.DestroyImmediate(_currentConfigEditor);
            }

            _currentConfigEditor = tmpEditor;

            if (_currentConfigEditor != null && _limappConfig != null)
            {
                _currentConfigEditor.OnInspectorGUI();
            }

            EditorGUILayout.EndScrollView();
        }
 private void GetConfig()
 {
     if (_limappConfig == null)
     {
         _limappConfig = AssetDatabase.LoadAssetAtPath <ExperienceProfile>($"{SDKResourcesConsts.LiminalSettingsConfigPath}");
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Create experience profile
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        private async Task <string> CreateExperienceProfileAsync(string accessToken)
        {
            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
                var experienceRequest = new ExperienceProfile
                {
                    Name        = $"gear_{Guid.NewGuid()}",
                    InputFields = new InputFields
                    {
                        NoShipping = 1
                    },
                    Temporary = true
                };
                var response = await httpClient.PostJsonAsync(
                    $"https://api{_payPalOptions.Value.EnvironmentUrlPart}.paypal.com/v1/payment-experience/web-profiles",
                    experienceRequest);

                var responseBody = await response.Content.ReadAsStringAsync();

                dynamic experience = JObject.Parse(responseBody);
                string  profileId  = experience.id;
                return(profileId);
            }
        }
        private void CreateConfig()
        {
            if (File.Exists($"{SDKResourcesConsts.LiminalSettingsConfigPath}"))
            {
                return;
            }

            LiminalSDKResources.InitialiseSettingsConfig();
            _limappConfig = AssetDatabase.LoadAssetAtPath <ExperienceProfile>($"{SDKResourcesConsts.LiminalSettingsConfigPath}");
        }
Exemplo n.º 5
0
        private async Task <string> CreateExperienceProfile(string accessToken)
        {
            var httpClient = new HttpClient();

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
            var experienceRequest = new ExperienceProfile
            {
                name         = $"simpl_{Guid.NewGuid()}",
                input_fields = new InputFields
                {
                    no_shipping = 1
                },
                temporary = true
            };
            var response = await httpClient.PostJsonAsync($"https://api{_setting.Value.EnvironmentUrlPart}.paypal.com/v1/payment-experience/web-profiles", experienceRequest);

            var responseBody = await response.Content.ReadAsStringAsync();

            dynamic experience = JObject.Parse(responseBody);
            // Has to explicitly declare the type to be able to get the propery
            string profileId = experience.id;

            return(profileId);
        }