| [882] | 1 | using System;
|
|---|
| 2 | using Platnosci.Core.Linq;
|
|---|
| 3 | using System.Web.Mvc;
|
|---|
| 4 | using Moq;
|
|---|
| 5 |
|
|---|
| 6 | namespace Platnosci.Tests.Web
|
|---|
| 7 | {
|
|---|
| 8 | public class Function
|
|---|
| 9 | {
|
|---|
| [931] | 10 | public vPlatnosciEcard CreateInvoice(int id, string nip, string invoiceNumber, decimal brutto, byte systemKsiegowy)
|
|---|
| [882] | 11 | {
|
|---|
| [930] | 12 | var platnosc = new vPlatnosciEcard();
|
|---|
| [882] | 13 | platnosc.ID_faktury = id;
|
|---|
| 14 | platnosc.nip = nip;
|
|---|
| [931] | 15 | platnosc.Faktura_Numer = invoiceNumber;
|
|---|
| [882] | 16 | platnosc.Brutto = brutto;
|
|---|
| [931] | 17 | platnosc.SystemKsiegowyId = systemKsiegowy;
|
|---|
| [882] | 18 |
|
|---|
| 19 | return platnosc;
|
|---|
| 20 | }
|
|---|
| [951] | 21 | public vPlatnosciEcard CreateForeignInvoice(int id, string nip, string invoiceNumber, decimal brutto, byte systemKsiegowy, decimal walutaBrutto, string currency)
|
|---|
| 22 | {
|
|---|
| 23 | var platnosc = new vPlatnosciEcard();
|
|---|
| 24 | platnosc.ID_faktury = id;
|
|---|
| 25 | platnosc.nip = nip;
|
|---|
| 26 | platnosc.Faktura_Numer = invoiceNumber;
|
|---|
| 27 | platnosc.Brutto = brutto;
|
|---|
| 28 | platnosc.waluta_brutto = walutaBrutto;
|
|---|
| [957] | 29 | platnosc.waluta_miano = currency.ToUpper();
|
|---|
| [951] | 30 | platnosc.SystemKsiegowyId = systemKsiegowy;
|
|---|
| 31 |
|
|---|
| 32 | return platnosc;
|
|---|
| 33 | }
|
|---|
| [931] | 34 | public PlatnosciEcard CreateNewPayment(int orderNumber, bool status, DateTime data, int invoiceId)
|
|---|
| [882] | 35 | {
|
|---|
| [930] | 36 | var platnosc = new PlatnosciEcard();
|
|---|
| [931] | 37 | platnosc.ORDERNUMBER = orderNumber;
|
|---|
| [882] | 38 | platnosc.Status = status;
|
|---|
| 39 | platnosc.Status_data = data;
|
|---|
| [931] | 40 | platnosc.IDFaktury = invoiceId;
|
|---|
| [882] | 41 |
|
|---|
| 42 | return platnosc;
|
|---|
| 43 | }
|
|---|
| [930] | 44 | public PotwierdzeniaEcard CreateConfirm(string code, int ordernumber)
|
|---|
| [896] | 45 | {
|
|---|
| [930] | 46 | var potwierdzenie = new PotwierdzeniaEcard();
|
|---|
| [896] | 47 | potwierdzenie.CURRENTSTATE = code;
|
|---|
| 48 | potwierdzenie.ORDERNUMBER = ordernumber;
|
|---|
| 49 |
|
|---|
| 50 | return potwierdzenie;
|
|---|
| 51 | }
|
|---|
| [930] | 52 |
|
|---|
| 53 | public Payer CreatePayer(int id, string name, string surname)
|
|---|
| [882] | 54 | {
|
|---|
| [930] | 55 | var payer = new Payer {Id_faktury = id, FirstName = name, LastName = surname};
|
|---|
| [882] | 56 |
|
|---|
| 57 | return payer;
|
|---|
| 58 | }
|
|---|
| [930] | 59 |
|
|---|
| [931] | 60 | public ControllerContext CreateControllerContext(string userIdentity)
|
|---|
| [882] | 61 | {
|
|---|
| 62 |
|
|---|
| 63 | var mock = new Mock<ControllerContext>();
|
|---|
| [931] | 64 | mock.SetupGet(m => m.HttpContext.User.Identity.Name).Returns(userIdentity);
|
|---|
| [882] | 65 | mock.SetupGet(m => m.HttpContext.Request.IsAuthenticated).Returns(true);
|
|---|
| [888] | 66 |
|
|---|
| [882] | 67 | return mock.Object;
|
|---|
| 68 | }
|
|---|
| 69 | }
|
|---|
| 70 | }
|
|---|