protected override async void OnAppearing() { try { if (_vm.IsBusy) { return; } _vm.IsBusy = true; MobilePaymentSSORequest requestData = null; switch (this._vm.PaymentRequest) { case PaymentRequest.AddMoneyOnAccount: requestData = new MobilePaymentSSORequest() { RequestType = MobilePaymentSSORequestRequestType.MoneyOnAccount }; break; case PaymentRequest.FullPayment: requestData = new MobilePaymentSSORequest() { Lines = _selectedInvoices .Select(f => new PartialInvoicePaymentLineItem { AXCustomerId = f.Account.Key, InvoiceKey = f.Key, Note = "", Amount = f.Amount, PartialAmount = f.Amount, RecId = f.RecId }).ToList(), Language = MobilePaymentSSORequestLanguage.English, // Fernando to fill, RequestType = MobilePaymentSSORequestRequestType.FullPayment, }; break; case PaymentRequest.PartialPayment: requestData = new MobilePaymentSSORequest() { Lines = _selectedInvoices .Select(f => new PartialInvoicePaymentLineItem { Amount = f.Amount, AXCustomerId = f.Account.Key, InvoiceKey = f.Key, Note = "", PartialAmount = f.Amount, RecId = f.RecId }).ToList(), Language = MobilePaymentSSORequestLanguage.English, // Fernando to fill, RequestType = MobilePaymentSSORequestRequestType.PartialPayment }; break; } requestData.CustomerInfo = _vm.Api.GetCustomerContext(); requestData.CustomerInfo.CustomerId = SettingsService.Instance.CustomerId; requestData.IsDarkTheme = SettingsService.Instance.IsDarkTheme; var guidVal = await _vm.Api.PrepareMobilePaymentAsync(requestData); if (guidVal.Successful.GetValueOrDefault() && guidVal.Data.HasValue) { var url = $"{SettingsService.BASER_URL}/Payment/MobilePrePaySSO?id={guidVal.Data.Value}&appUserId={SettingsService.Instance.MyInfo.CurrentUser.AppUserId}"; this._paymentView.Source = url; #if DEBUG Debug.WriteLine($"Payments URL: {url}"); #endif } else { await AlertService.Instance.ShowMessage(guidVal.ExceptionMessage ?? "Error "); } } catch (Exception e) { await AlertService.Instance.DisplayError(e); _vm.IsBusy = false; } }
public Task <ApiResponseOfNullableOfGuid> PrepareMobilePaymentAsync(MobilePaymentSSORequest context) { return(AXClient.Instance.PrepareMobilePaymentAsync(context)); }