public async Task <MobilePayPaymentDetails> InitiatePayment(MobilePayPaymentRequest paymentRequest) { try { var response = await _paymentsApi.PaymentsPOSTAsync(null, new InitiatePaymentRequest { Amount = ConvertAmountToOrer(paymentRequest.Amount), IdempotencyKey = paymentRequest.OrderId, PaymentPointId = _mobilePaySettings.PaymentPointId, RedirectUri = "analogcoffeecard://mobilepay_purchase", // FIXME Reference = paymentRequest.OrderId.ToString(), Description = paymentRequest.Description }); return(new MobilePayPaymentDetails(paymentRequest.OrderId.ToString(), response.MobilePayAppRedirectUri, response.PaymentId.ToString(), null)); } catch (ApiException <ErrorResponse> e) { var errorResponse = e.Result; Log.Error( "MobilePay InitiatePayment failed with HTTP {StatusCode}. ErrorCode: {ErrorCode} Message: {Message} CorrelationId: {CorrelationId}", e.StatusCode, errorResponse.Code, errorResponse.Message, errorResponse.CorrelationId); // FIXME Consider retry throw new MobilePayApiException(e.StatusCode, errorResponse.Message, errorResponse.Code); } catch (ApiException apiException) { LogMobilePayException(apiException); throw new MobilePayApiException(apiException.StatusCode, apiException.Message); } }
public MobilePayPaymentRequestDto(MobilePayPaymentRequest paymentRequest) { Payment = new MobilePayPaymentDetailsDto(paymentRequest.Payment); MobilePay = new MobilePayPaymentRequestDetailsDto(paymentRequest.MobilePay); }
public MobilePayPaymentRequest BuildMobilePayRequest() { var req = new MobilePayPaymentRequest(this.operation, this.intent, this.currency, this.prices, this.description, this.userAgent, this.language, this.urls, this.payeeInfo, this.shopslogoUrl); return(req); }