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