diff --git a/Yavsc/ApiControllers/BursherProfilesApiController.cs b/Yavsc/ApiControllers/HairCut/BursherProfilesApiController.cs similarity index 100% rename from Yavsc/ApiControllers/BursherProfilesApiController.cs rename to Yavsc/ApiControllers/HairCut/BursherProfilesApiController.cs diff --git a/Yavsc/ApiControllers/HairCutController.cs b/Yavsc/ApiControllers/HairCut/HairCutController.cs similarity index 95% rename from Yavsc/ApiControllers/HairCutController.cs rename to Yavsc/ApiControllers/HairCut/HairCutController.cs index eea1657a..0e7b3ea8 100644 --- a/Yavsc/ApiControllers/HairCutController.cs +++ b/Yavsc/ApiControllers/HairCut/HairCutController.cs @@ -48,6 +48,10 @@ namespace Yavsc.ApiControllers _localizer = localizer; _logger = loggerFactory.CreateLogger(); } + + // GET: api/HairCutQueriesApi + // Get the active queries for current + // user, as a client public IActionResult Index() { var uid = User.GetUserId(); diff --git a/Yavsc/ApiControllers/HairCutQueriesApiController.cs b/Yavsc/ApiControllers/HairCut/HairCutQueriesApiController.cs similarity index 94% rename from Yavsc/ApiControllers/HairCutQueriesApiController.cs rename to Yavsc/ApiControllers/HairCut/HairCutQueriesApiController.cs index 88a15171..dcf739f1 100644 --- a/Yavsc/ApiControllers/HairCutQueriesApiController.cs +++ b/Yavsc/ApiControllers/HairCut/HairCutQueriesApiController.cs @@ -25,9 +25,8 @@ namespace Yavsc.Controllers // GET: api/HairCutQueriesApi - // Get the queries for current - // user as a client - // To get active queries + // Get the active queries for current + // user, as a client [HttpGet] public async Task GetHairCutQueries() { diff --git a/Yavsc/ApiControllers/DjProfileApiController.cs b/Yavsc/ApiControllers/Musical/DjProfileApiController.cs similarity index 100% rename from Yavsc/ApiControllers/DjProfileApiController.cs rename to Yavsc/ApiControllers/Musical/DjProfileApiController.cs diff --git a/Yavsc/ApiControllers/MusicalPreferencesApiController.cs b/Yavsc/ApiControllers/Musical/MusicalPreferencesApiController.cs similarity index 100% rename from Yavsc/ApiControllers/MusicalPreferencesApiController.cs rename to Yavsc/ApiControllers/Musical/MusicalPreferencesApiController.cs diff --git a/Yavsc/ApiControllers/MusicalTendenciesApiController.cs b/Yavsc/ApiControllers/Musical/MusicalTendenciesApiController.cs similarity index 100% rename from Yavsc/ApiControllers/MusicalTendenciesApiController.cs rename to Yavsc/ApiControllers/Musical/MusicalTendenciesApiController.cs diff --git a/Yavsc/ApiControllers/PodcastController.cs b/Yavsc/ApiControllers/Musical/PodcastController.cs similarity index 100% rename from Yavsc/ApiControllers/PodcastController.cs rename to Yavsc/ApiControllers/Musical/PodcastController.cs diff --git a/Yavsc/ApiControllers/PaymentApiController.cs b/Yavsc/ApiControllers/PaymentApiController.cs new file mode 100644 index 00000000..c99c96d5 --- /dev/null +++ b/Yavsc/ApiControllers/PaymentApiController.cs @@ -0,0 +1,104 @@ + +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNet.Mvc; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.OptionsModel; +using PayPal.Api; +using Yavsc.Helpers; +using Yavsc.Models; + +namespace Yavsc.ApiControllers +{ + [Route("api/payment")] + public class PaymentApiController : Controller + { + private ApplicationDbContext dbContext; + PayPalSettings paymentSettings; + private SiteSettings siteSettings; + private readonly ILogger _logger; + public PaymentApiController( + ApplicationDbContext dbContext, + IOptions paypalSettingsReceiver, + IOptions siteSettingsReceiver, + ILoggerFactory loggerFactory) + { + this.dbContext = dbContext; + paymentSettings = paypalSettingsReceiver.Value; + siteSettings = siteSettingsReceiver.Value; + _logger = loggerFactory.CreateLogger(); + } + + + + [HttpPost("execute")] + public async Task Execute(string paymentId, string payerId) + { + Payment result=null; + await Task.Run( () => { + var apiContext = paymentSettings.CreateAPIContext(); + var payment = Payment.Get(apiContext,paymentId); + var execution = new PaymentExecution(); + execution.payer_id = payerId; + execution.transactions = payment.transactions; + result = payment.Execute(apiContext,execution); + }); + return Ok(result); + } + + [HttpPost("create")] + public async Task Create() + { + var apiContext = paymentSettings.CreateAPIContext(); + var payment = Payment.Create(apiContext, + new Payment + { + intent = "authorize", // "sale", "order", "authorize" + payer = new Payer + { + payment_method = "paypal" + }, + transactions = new List + { + new Transaction + { + description = "Transaction description.", + invoice_number = "001", + amount = new Amount + { + currency = "EUR", + total = "0.11", + details = new Details + { + tax = "0.01", + shipping = "0.02", + subtotal = "0.08" + } + }, + item_list = new ItemList + { + items = new List + { + new Item + { + name = "nah", + currency = "EUR", + price = "0.02", + quantity = "4", + sku = "sku" + } + } + } + } + }, + redirect_urls = new RedirectUrls + { + return_url = siteSettings.Audience+ "/Manage/Credit/Return", + cancel_url = siteSettings.Audience+ "/Manage/Credit/Cancel" + } + }); + return Json(payment); + } + + } +} diff --git a/Yavsc/Controllers/ManageController.cs b/Yavsc/Controllers/ManageController.cs index 2a045a96..ba2e9172 100644 --- a/Yavsc/Controllers/ManageController.cs +++ b/Yavsc/Controllers/ManageController.cs @@ -23,8 +23,6 @@ using Yavsc.Models.Identity; namespace Yavsc.Controllers { using Models.Relationship; - using PayPal.PayPalAPIInterfaceService; - using PayPal.PayPalAPIInterfaceService.Model; using Yavsc.Models.Bank; [Authorize] @@ -638,154 +636,17 @@ namespace Yavsc.Controllers return View(); } - public Dictionary PaypalConfig {  - get {  - var config = - new Dictionary(); - config.Add("mode", "sandbox"); - config.Add("account1.apiUsername", _payPalSettings.UserId); - config.Add("account1.apiPassword", _payPalSettings.Secret); - config.Add("account1.apiSignature", _payPalSettings.Signature); - return config; - } - } - - protected IActionResult DoDirectCredit(DoDirectCreditViewModel model) + public IActionResult Credit(string id) { - // Create request object - DoDirectPaymentRequestType request = new DoDirectPaymentRequestType(); - DoDirectPaymentRequestDetailsType requestDetails = new DoDirectPaymentRequestDetailsType(); - request.DoDirectPaymentRequestDetails = requestDetails; - - // (Optional) How you want to obtain payment. It is one of the following values: - // * Authorization – This payment is a basic authorization subject to settlement with PayPal Authorization and Capture. - // * Sale – This is a final sale for which you are requesting payment (default). - // Note: Order is not allowed for Direct Payment. - requestDetails.PaymentAction = (PaymentActionCodeType) - Enum.Parse(typeof(PaymentActionCodeType), model.PaymentType); - - // (Required) Information about the credit card to be charged. - CreditCardDetailsType creditCard = new CreditCardDetailsType(); - requestDetails.CreditCard = creditCard; - PayerInfoType payer = new PayerInfoType(); - // (Optional) First and last name of buyer. - PersonNameType name = new PersonNameType(); - name.FirstName = model.FirstName; - name.LastName = model.LastName; - payer.PayerName = name; - // (Required) Details about the owner of the credit card. - creditCard.CardOwner = payer; - - // (Required) Credit card number. - creditCard.CreditCardNumber = model.CreditCardNumber; - // (Optional) Type of credit card. For UK, only Maestro, MasterCard, Discover, and Visa are allowable. For Canada, only MasterCard and Visa are allowable and Interac debit cards are not supported. It is one of the following values: - // * Visa - // * MasterCard - // * Discover - // * Amex - // * Maestro: See note. - // Note: If the credit card type is Maestro, you must set currencyId to GBP. In addition, you must specify either StartMonth and StartYear or IssueNumber. - creditCard.CreditCardType = (CreditCardTypeType) - Enum.Parse(typeof(CreditCardTypeType), model.CreditCardType); - // Card Verification Value, version 2. Your Merchant Account settings determine whether this field is required. To comply with credit card processing regulations, you must not store this value after a transaction has been completed. - // Character length and limitations: For Visa, MasterCard, and Discover, the value is exactly 3 digits. For American Express, the value is exactly 4 digits. - creditCard.CVV2 = model.Cvv2Number; - string[] cardExpiryDetails = model.CardExpiryDate.Split(new char[] { '/' }); - if (cardExpiryDetails.Length == 2) - { - // (Required) Credit card expiration month. - creditCard.ExpMonth = Convert.ToInt32(cardExpiryDetails[0]); - // (Required) Credit card expiration year. - creditCard.ExpYear = Convert.ToInt32(cardExpiryDetails[1]); - } - - requestDetails.PaymentDetails = new PaymentDetailsType(); - // (Optional) Your URL for receiving Instant Payment Notification (IPN) about this transaction. If you do not specify this value in the request, the notification URL from your Merchant Profile is used, if one exists. - // Important: The notify URL applies only to DoExpressCheckoutPayment. This value is ignored when set in SetExpressCheckout or GetExpressCheckoutDetails. - requestDetails.PaymentDetails.NotifyURL = model.IpnNotificationUrl.Trim(); - - // (Optional) Buyer's shipping address information. - AddressType billingAddr = new AddressType(); - if (model.FirstName != string.Empty && model.LastName != string.Empty - && model.Street1 != string.Empty && model.Country != string.Empty) - { - billingAddr.Name = model.PayerName; - // (Required) First street address. - billingAddr.Street1 = model.Street1; - // (Optional) Second street address. - billingAddr.Street2 = model.Street2; - // (Required) Name of city. - billingAddr.CityName = model.City; - // (Required) State or province. - billingAddr.StateOrProvince = model.State; - // (Required) Country code. - billingAddr.Country = (CountryCodeType)Enum.Parse(typeof(CountryCodeType), model.Country); - // (Required) U.S. ZIP code or other country-specific postal code. - billingAddr.PostalCode = model.PostalCode; - - // (Optional) Phone number. - billingAddr.Phone = model.Phone; - - payer.Address = billingAddr; - } - - // (Required) The total cost of the transaction to the buyer. If shipping cost and tax charges are known, include them in this value. If not, this value should be the current subtotal of the order. If the transaction includes one or more one-time purchases, this field must be equal to the sum of the purchases. This field must be set to a value greater than 0. - // Note: You must set the currencyID attribute to one of the 3-character currency codes for any of the supported PayPal currencies. - CurrencyCodeType currency = (CurrencyCodeType) - Enum.Parse(typeof(CurrencyCodeType), model.CurrencyCode); - BasicAmountType paymentAmount = new BasicAmountType(currency, model.Amount); - requestDetails.PaymentDetails.OrderTotal = paymentAmount; - - // Invoke the API - DoDirectPaymentReq wrapper = new DoDirectPaymentReq(); - wrapper.DoDirectPaymentRequest = request; - - // Configuration map containing signature credentials and other required configuration. - // For a full list of configuration parameters refer in wiki page - // [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters] - //// TODO clean Dictionary configurationMap = Configuration.GetAcctAndConfig(); - - // Create the PayPalAPIInterfaceServiceService service object to make the API call - PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(PaypalConfig); - - // # API call - // Invoke the DoDirectPayment method in service wrapper object - DoDirectPaymentResponseType response = service.DoDirectPayment(wrapper); - - // Check for API return status - return setKeyResponseObjects(service, response); - } - - private IActionResult setKeyResponseObjects(PayPalAPIInterfaceServiceService service, DoDirectPaymentResponseType response) - { - HttpContext.Items.Add("Response_apiName", "DoDirectPayment"); - HttpContext.Items.Add("Response_redirectURL", null); - HttpContext.Items.Add("Response_requestPayload", service.getLastRequest()); - HttpContext.Items.Add("Response_responsePayload", service.getLastResponse()); - - Dictionary responseParams = new Dictionary(); - responseParams.Add("Correlation Id", response.CorrelationID); - responseParams.Add("API Result", response.Ack.ToString()); - - if (response.Ack.Equals(AckCodeType.FAILURE) || - (response.Errors != null && response.Errors.Count > 0)) - { - HttpContext.Items.Add("Response_error", response.Errors); - } - else - { - HttpContext.Items.Add("Response_error", null); - responseParams.Add("Transaction Id", response.TransactionID); - responseParams.Add("Payment status", response.PaymentStatus.ToString()); - if(response.PendingReason != null) { - responseParams.Add("Pending reason", response.PendingReason.ToString()); + if (id == "Cancel" || id == "Return") + { + return View ("Credit"+id); } - } - HttpContext.Items.Add("Response_keyResponseObject", responseParams); - return View("APIResponse"); + return View(); } + #region Helpers private void AddErrors(IdentityResult result) diff --git a/Yavsc/Helpers/BankInfoHelpers.cs b/Yavsc/Helpers/BankInfoHelpers.cs index 74de1bb6..c087f412 100644 --- a/Yavsc/Helpers/BankInfoHelpers.cs +++ b/Yavsc/Helpers/BankInfoHelpers.cs @@ -14,5 +14,6 @@ namespace Yavsc.Helpers return (info.BankCode != null && info.WicketCode != null && info.AccountNumber != null && info.BankedKey >0); } + } } diff --git a/Yavsc/Helpers/PayPalHelpers.cs b/Yavsc/Helpers/PayPalHelpers.cs new file mode 100644 index 00000000..32bbcee8 --- /dev/null +++ b/Yavsc/Helpers/PayPalHelpers.cs @@ -0,0 +1,97 @@ +using System.Collections.Generic; +using PayPal.Api; +using Yavsc.Models.Billing; +using Yavsc.Models.Haircut; + +namespace Yavsc.Helpers +{ + public static class PayPalHelpers + { + public static APIContext CreateAPIContext(this PayPalSettings settings) + { + Dictionary config = new Dictionary(); + config.Add("mode",settings.Mode); + config.Add("clientId",settings.ClientId); + config.Add("clientSecret",settings.Secret); + var accessToken = new OAuthTokenCredential(config).GetAccessToken(); + var apiContext = new APIContext(accessToken); + return apiContext; + } + + public static Payment CreatePaiement(this APIContext apiContext, NominativeServiceCommand query, string intent = "sale") + { + var queryType = query.GetType().Name; + var transaction = new Transaction + { + description = query.Description+"\nVotre commande du "+query.DateCreated.ToLongDateString(), + invoice_number = $"{query.ActivityCode}/{queryType}/{query.Id}" + }; + transaction.item_list.shipping_address.line1 = query.Client.PostalAddress.Address; + transaction.item_list.shipping_phone_number = query.Client.PhoneNumber; + transaction.item_list.items = new List { }; + var item = new Item(); + + return new Payment + { + intent = intent, // "sale", "order", "authorize" + payer = new Payer + { + payment_method = "paypal" + }, + transactions = new List { transaction } + }; + } + + public static Payment CreatePaiement(this APIContext apiContext, Estimate estimation) + { + var payment = Payment.Create(apiContext, + new Payment + { + intent = "order", // "sale", "order", "authorize" + payer = new Payer + { + payment_method = "paypal" + }, + transactions = new List + { + new Transaction + { + description = "Transaction description.", + invoice_number = estimation.Id.ToString(), + amount = new Amount + { + currency = "EUR", + total = "0.11", + details = new Details + { + tax = "0.01", + shipping = "0.02", + subtotal = "0.08" + } + }, + item_list = new ItemList + { + items = new List + { + new Item + { + name = "nah", + currency = "EUR", + price = "0.02", + quantity = "4", + sku = "sku" + } + } + } + } + }, + redirect_urls = new RedirectUrls + { + return_url = Startup.Audience+ "/Manage/Credit/Return", + cancel_url = Startup.Audience+ "/Manage/Credit/Cancel" + } + }); + return payment; + } + } +} diff --git a/Yavsc/Models/Bank/AccountBalance.cs b/Yavsc/Models/Bank/AccountBalance.cs index 3a4dc451..573f6589 100644 --- a/Yavsc/Models/Bank/AccountBalance.cs +++ b/Yavsc/Models/Bank/AccountBalance.cs @@ -12,7 +12,7 @@ namespace Yavsc.Models [ForeignKey("UserId")] public virtual ApplicationUser Owner { get; set; } - [Required,Display(Name="Credits in €")] + [Required,Display(Name="Credits en €")] public decimal Credits { get; set; } public long ContactCredits { get; set; } diff --git a/Yavsc/Models/Billing/CommandLine.cs b/Yavsc/Models/Billing/CommandLine.cs index 59488fb8..39be6d41 100644 --- a/Yavsc/Models/Billing/CommandLine.cs +++ b/Yavsc/Models/Billing/CommandLine.cs @@ -5,13 +5,14 @@ using Newtonsoft.Json; namespace Yavsc.Models.Billing { + using System; using YavscLib.Billing; public class CommandLine : ICommandLine { [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long Id { get; set; } - + [Required,MaxLength(512)] public string Description { get; set; } @@ -21,9 +22,16 @@ namespace Yavsc.Models.Billing public decimal UnitaryCost { get; set; } public long EstimateId { get; set; } - + [JsonIgnore,NotMapped,ForeignKey("EstimateId")] virtual public Estimate Estimate { get; set; } - } + + public string Currency + { + get; + + set; + } + } } diff --git a/Yavsc/Models/Billing/NominativeServiceCommand.cs b/Yavsc/Models/Billing/NominativeServiceCommand.cs index d0c9b591..aeb03698 100644 --- a/Yavsc/Models/Billing/NominativeServiceCommand.cs +++ b/Yavsc/Models/Billing/NominativeServiceCommand.cs @@ -8,10 +8,13 @@ namespace Yavsc.Models.Billing using Newtonsoft.Json; using Workflow; using YavscLib; + using YavscLib.Billing; using YavscLib.Models.Workflow; - public abstract class NominativeServiceCommand : IBaseTrackedEntity, IQuery + public abstract class NominativeServiceCommand : IBaseTrackedEntity, IQuery, IIdentified { + public abstract long Id { get; set; } + public abstract string Description { get; set; } public DateTime DateCreated { get; set; @@ -67,5 +70,10 @@ namespace Yavsc.Models.Billing [ForeignKey("ActivityCode"),JsonIgnore,Display(Name="Domaine d'activité")] public virtual Activity Context  { get; set ; } - } + + public System.Collections.Generic.List GetBillItems() + { + throw new NotImplementedException(); + } + } } diff --git a/Yavsc/Models/HairCut/HairCutQuery.cs b/Yavsc/Models/HairCut/HairCutQuery.cs index 6881290f..769b38a0 100644 --- a/Yavsc/Models/HairCut/HairCutQuery.cs +++ b/Yavsc/Models/HairCut/HairCutQuery.cs @@ -9,8 +9,16 @@ namespace Yavsc.Models.Haircut { public class HairCutQuery : NominativeServiceCommand { + // Bill description + public override string Description + { + get; + + set; + } = "Prestation en coiffure à domicile"; + [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long Id { get; set; } + override public long Id { get; set; } [Required] public long PrestationId { get; set; } diff --git a/Yavsc/Models/HairCut/HairMultiCutQuery.cs b/Yavsc/Models/HairCut/HairMultiCutQuery.cs index 5ab90dd8..3bed9fb0 100644 --- a/Yavsc/Models/HairCut/HairMultiCutQuery.cs +++ b/Yavsc/Models/HairCut/HairMultiCutQuery.cs @@ -23,8 +23,16 @@ namespace Yavsc.Models.Haircut public class HairMultiCutQuery : NominativeServiceCommand { + // Bill description + public override string Description + { + get; + + set; + } = "Prestation en coiffure à domicile [commande groupée]"; + [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long Id { get; set; } + override public long Id { get; set; } [InversePropertyAttribute("Query")] public virtual List Prestations { get; set; } diff --git a/Yavsc/Models/Relationship/CircleMember.cs b/Yavsc/Models/Relationship/CircleMember.cs index 7bda74df..79334148 100644 --- a/Yavsc/Models/Relationship/CircleMember.cs +++ b/Yavsc/Models/Relationship/CircleMember.cs @@ -1,7 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using YavscLib; namespace Yavsc.Models.Relationship { diff --git a/Yavsc/Models/Workflow/RdvQuery.cs b/Yavsc/Models/Workflow/RdvQuery.cs index 1bec49b6..15ccd05f 100644 --- a/Yavsc/Models/Workflow/RdvQuery.cs +++ b/Yavsc/Models/Workflow/RdvQuery.cs @@ -16,7 +16,7 @@ namespace Yavsc.Models.Workflow /// The command identifier /// [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long Id { get; set; } + override public long Id { get; set; } [Display(Name = "Event date")] public DateTime EventDate @@ -39,6 +39,13 @@ namespace Yavsc.Models.Workflow [Display(Name="GiveAnExplicitReason")] public string Reason { get; set; } + public override string Description + { + get; + + set; + } = "Rendez-vous"; + public RdvQuery() { } diff --git a/Yavsc/Settings/PayPalSettings.cs b/Yavsc/Settings/PayPalSettings.cs index 366b8cac..063bbed7 100644 --- a/Yavsc/Settings/PayPalSettings.cs +++ b/Yavsc/Settings/PayPalSettings.cs @@ -1,8 +1,10 @@ namespace Yavsc { public class PayPalSettings { + + public string Mode { get; set; } public string Secret { get; set; } - public string UserId { get; set; } - public string Signature { get; set; } + public string ClientId { get; set; } + } -} \ No newline at end of file +} diff --git a/Yavsc/Startup/Startup.cs b/Yavsc/Startup/Startup.cs index adea9ca2..f908ee2d 100755 --- a/Yavsc/Startup/Startup.cs +++ b/Yavsc/Startup/Startup.cs @@ -79,6 +79,8 @@ namespace Yavsc services.Configure(oauthLocalAppSettings); var oauthFacebookSettings = Configuration.GetSection("Authentication").GetSection("Facebook"); services.Configure(oauthFacebookSettings); + var paypalSettings = Configuration.GetSection("Authentication").GetSection("PayPal"); + services.Configure(paypalSettings); /* services.Configure(options => { @@ -143,15 +145,15 @@ namespace Yavsc ConfigureOAuthServices(services); services.AddCors( - /* + options => { options.AddPolicy("CorsPolicy", builder => { - builder.WithOrigins("http://lua.pschneider.fr"); + builder.WithOrigins("*"); }); } - */ + ); // Add memory cache services services.AddCaching(); diff --git a/Yavsc/ViewModels/Manage/DoDirectCreditViewModel.cs b/Yavsc/ViewModels/Manage/DoDirectCreditViewModel.cs index c6c601e4..7ee28f2c 100644 --- a/Yavsc/ViewModels/Manage/DoDirectCreditViewModel.cs +++ b/Yavsc/ViewModels/Manage/DoDirectCreditViewModel.cs @@ -1,24 +1,35 @@ +using System.ComponentModel.DataAnnotations; + namespace Yavsc.ViewModels.Manage { public class DoDirectCreditViewModel { + [Required] public string PaymentType  { get; set;} + [Required] public string PayerName  { get; set;} + [Required] public string FirstName  { get; set;} + [Required] public string LastName  { get; set;} + [Required] public string CreditCardNumber  { get; set;} public string CreditCardType  { get; set;} public string Cvv2Number  { get; set;} public string CardExpiryDate  { get; set;} public string IpnNotificationUrl { get; set; } + [Required] public string Street1 { get; set; } public string Street2 { get; set; } public string City { get; set; } public string State { get; set; } public string Country { get; set; } + [Required] public string PostalCode { get; set; } public string Phone { get; set; } + [Required] public string CurrencyCode { get; set; } + [Required] public string Amount { get; set; } } -} \ No newline at end of file +} diff --git a/Yavsc/ViewModels/Manage/SetAddressViewModel.cs b/Yavsc/ViewModels/Manage/SetAddressViewModel.cs new file mode 100644 index 00000000..b7998761 --- /dev/null +++ b/Yavsc/ViewModels/Manage/SetAddressViewModel.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ViewModels.Manage +{ + public class SetAddressViewModel + { + [Required] + public string Street1 { get; set; } + public string Street2 { get; set; } + public string City { get; set; } + public string State { get; set; } + public string Country { get; set; } + [Required] + public string PostalCode { get; set; } + } +} diff --git a/Yavsc/ViewModels/PayPal/Amount.cs b/Yavsc/ViewModels/PayPal/Amount.cs new file mode 100644 index 00000000..041c4753 --- /dev/null +++ b/Yavsc/ViewModels/PayPal/Amount.cs @@ -0,0 +1,26 @@ + +namespace Yavsc.ViewModels.PayPal +{ + public class Amount + { + public string total { get; set; } + public string currency { get; set; } = "EUR"; + public class Details + { + public string subtotal { get; set; } + public string shipping { get; set; } + public string tax { get; set; } + public string shipping_discount { get; set; } + + } + public Details details; + public class ItemList + { + public Item[] items; + public string description { get; set; } + public string invoice_number { get; set; } + public string custom { get; set; } + } + + } +} diff --git a/Yavsc/ViewModels/PayPal/CreatePaymentRequest.cs b/Yavsc/ViewModels/PayPal/CreatePaymentRequest.cs new file mode 100644 index 00000000..ef63fb75 --- /dev/null +++ b/Yavsc/ViewModels/PayPal/CreatePaymentRequest.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ViewModels.PayPal +{ + public class CreatePaymentRequest + { + [Required] + public string intent { get; set; } = "sale"; // sale, + public string experience_profile_id { get; set; } + public class RedirectUrls + { + public string return_url { get; set; } = ""; + public string cancel_url { get; set; } + } + public RedirectUrls redirect_urls; + public class Payer + { + public string payment_method { get; set; } = "paypal"; + } + Payer payer; + } +} diff --git a/Yavsc/ViewModels/PayPal/PayPalItem.cs b/Yavsc/ViewModels/PayPal/PayPalItem.cs new file mode 100644 index 00000000..6e949ea1 --- /dev/null +++ b/Yavsc/ViewModels/PayPal/PayPalItem.cs @@ -0,0 +1,14 @@ + +namespace Yavsc.ViewModels.PayPal +{ + public class Item + { + public string quantity { get; set; } + public string name { get; set; } + public string price { get; set; } + public string currency { get; set; } = "EUR"; + public string description { get; set; } + public string tax { get; set; } = "1"; + + } +} diff --git a/Yavsc/Views/Manage/Credit.cshtml b/Yavsc/Views/Manage/Credit.cshtml new file mode 100644 index 00000000..84f672a3 --- /dev/null +++ b/Yavsc/Views/Manage/Credit.cshtml @@ -0,0 +1,50 @@ +@{ + ViewData["Title"] = @"Créditer"; +} +

@ViewData["Title"]

+ +Gimmy da flooze + + +
+ + + + + + + + + \ No newline at end of file diff --git a/Yavsc/Views/Manage/DoDirectCredit.cshtml b/Yavsc/Views/Manage/DoDirectCredit.cshtml index e69de29b..996d8218 100644 --- a/Yavsc/Views/Manage/DoDirectCredit.cshtml +++ b/Yavsc/Views/Manage/DoDirectCredit.cshtml @@ -0,0 +1,127 @@ +@model DoDirectCreditViewModel + +
+
+ +
+ + +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+ +
diff --git a/Yavsc/Views/Manage/SetAddress.cshtml b/Yavsc/Views/Manage/SetAddress.cshtml index a17531cb..000d8531 100644 --- a/Yavsc/Views/Manage/SetAddress.cshtml +++ b/Yavsc/Views/Manage/SetAddress.cshtml @@ -1,4 +1,4 @@ -@model Location +@model SetAddressViewModel