Exemplo n.º 1
0
 public T DoRequest <T>()
 {
     //Annul
     if (typeof(T) == typeof(AnnulResponse))
     {
         var hostedAdminResponse = HostedAdminRequest.HostedAdminCall(GetEndPointBase(), PrepareRequest());
         return((T)(object)hostedAdminResponse.To(Annul.Response));
     }
     //CancelRecurSubscription
     //Confirm
     if (typeof(T) == typeof(ConfirmResponse))
     {
         var hostedAdminResponse = HostedAdminRequest.HostedAdminCall(GetEndPointBase(), PrepareRequest());
         return((T)(object)hostedAdminResponse.To(Confirm.Response));
     }
     //Credit
     if (typeof(T) == typeof(CreditResponse))
     {
         var hostedAdminResponse = HostedAdminRequest.HostedAdminCall(GetEndPointBase(), PrepareRequest());
         return((T)(object)hostedAdminResponse.To(Credit.Response));
     }
     //GetPaymentMethods
     //GetReconciliationReport
     //LowerAmount
     if (typeof(T) == typeof(LowerAmountResponse))
     {
         var hostedAdminResponse = HostedAdminRequest.HostedAdminCall(GetEndPointBase(), PrepareRequest());
         return((T)(object)hostedAdminResponse.To(LowerAmount.Response));
     }
     //Query
     if (typeof(T) == typeof(QueryResponse))
     {
         var hostedAdminResponse = HostedAdminRequest.HostedAdminCall(GetEndPointBase(), PrepareRequest());
         return((T)(object)hostedAdminResponse.To(Query.Response));
     }
     //Recur
     if (typeof(T) == typeof(RecurResponse))
     {
         var hostedAdminResponse = HostedAdminRequest.HostedAdminCall(GetEndPointBase(), PrepareRequest());
         return((T)(object)hostedAdminResponse.To(Recur.Response));
     }
     //Raw HostedAdminResponse
     if (typeof(T) == typeof(HostedAdminResponse))
     {
         var hostedAdminResponse = HostedAdminRequest.HostedAdminCall(GetEndPointBase(), PrepareRequest());
         return((T)(object)hostedAdminResponse);
     }
     //default catch-all
     throw new SveaWebPayException("unknown request type");
 }