making pay, & refactoring

This commit is contained in:
2017-05-05 23:37:07 +02:00
parent d590df1c92
commit 5bbe8bdfbd
34 changed files with 617 additions and 230 deletions

View File

@ -48,6 +48,10 @@ namespace Yavsc.ApiControllers
_localizer = localizer;
_logger = loggerFactory.CreateLogger<HairCutController>();
}
// GET: api/HairCutQueriesApi
// Get the active queries for current
// user, as a client
public IActionResult Index()
{
var uid = User.GetUserId();

View File

@ -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<IActionResult> GetHairCutQueries()
{

View File

@ -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<PayPalSettings> paypalSettingsReceiver,
IOptions<SiteSettings> siteSettingsReceiver,
ILoggerFactory loggerFactory)
{
this.dbContext = dbContext;
paymentSettings = paypalSettingsReceiver.Value;
siteSettings = siteSettingsReceiver.Value;
_logger = loggerFactory.CreateLogger<PaymentApiController>();
}
[HttpPost("execute")]
public async Task<IActionResult> 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<IActionResult> 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<Transaction>
{
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<Item>
{
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);
}
}
}

View File

@ -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,153 +636,16 @@ namespace Yavsc.Controllers
return View();
}
public Dictionary<string, string> PaypalConfig { 
get { 
var config =
new Dictionary<string, string>();
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)
if (id == "Cancel" || id == "Return")
{
// (Required) Credit card expiration month.
creditCard.ExpMonth = Convert.ToInt32(cardExpiryDetails[0]);
// (Required) Credit card expiration year.
creditCard.ExpYear = Convert.ToInt32(cardExpiryDetails[1]);
return View ("Credit"+id);
}
return View();
}
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<string, string> 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<string, string> responseParams = new Dictionary<string, string>();
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());
}
}
HttpContext.Items.Add("Response_keyResponseObject", responseParams);
return View("APIResponse");
}
#region Helpers

View File

@ -14,5 +14,6 @@ namespace Yavsc.Helpers
return (info.BankCode != null && info.WicketCode != null && info.AccountNumber != null && info.BankedKey >0);
}
}
}

View File

@ -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<string,string> config = new Dictionary<string,string>();
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<Item> { };
var item = new Item();
return new Payment
{
intent = intent, // "sale", "order", "authorize"
payer = new Payer
{
payment_method = "paypal"
},
transactions = new List<Transaction> { 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<Transaction>
{
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<Item>
{
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;
}
}
}

View File

@ -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; }

View File

@ -5,6 +5,7 @@ using Newtonsoft.Json;
namespace Yavsc.Models.Billing
{
using System;
using YavscLib.Billing;
public class CommandLine : ICommandLine {
@ -24,6 +25,13 @@ namespace Yavsc.Models.Billing
[JsonIgnore,NotMapped,ForeignKey("EstimateId")]
virtual public Estimate Estimate { get; set; }
public string Currency
{
get;
set;
}
}
}

View File

@ -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<long>
{
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<IBillItem> GetBillItems()
{
throw new NotImplementedException();
}
}
}

View File

@ -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; }

View File

@ -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<HairPrestationCollectionItem> Prestations { get; set; }

View File

@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using YavscLib;
namespace Yavsc.Models.Relationship
{

View File

@ -16,7 +16,7 @@ namespace Yavsc.Models.Workflow
/// The command identifier
/// </summary>
[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()
{
}

View File

@ -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; }
}
}

View File

@ -79,6 +79,8 @@ namespace Yavsc
services.Configure<OAuth2AppSettings>(oauthLocalAppSettings);
var oauthFacebookSettings = Configuration.GetSection("Authentication").GetSection("Facebook");
services.Configure<FacebookOAuth2AppSettings>(oauthFacebookSettings);
var paypalSettings = Configuration.GetSection("Authentication").GetSection("PayPal");
services.Configure<PayPalSettings>(paypalSettings);
/* services.Configure<MvcOptions>(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();

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}
}

View File

@ -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;
}
}

View File

@ -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";
}
}

View File

@ -0,0 +1,50 @@
@{
ViewData["Title"] = @"Créditer";
}
<h1>@ViewData["Title"]</h1>
<environement names="Development">
<em>Gimmy da flooze</em>
</environement>
<div id="paypal-button"></div>
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<environement names="lua,coiffure,zicmoove,yavsc,yavscpre">
<script>
var CREATE_PAYMENT_URL = 'https://lua.pschneider.fr/api/payment/create';
var EXECUTE_PAYMENT_URL = 'https://lua.pschneider.fr/api/payment/execute';
var PAYPAL_ENV = 'sandbox';
</script>
</environement>
<environement names="Development">
<script>
var CREATE_PAYMENT_URL = 'https://dev.pschneider.fr/api/payment/create';
var EXECUTE_PAYMENT_URL = 'https://dev.pschneider.fr/api/payment/execute';
var PAYPAL_ENV = 'sandbox';
</script>
</environement>
<script>
paypal.Button.render({
env: PAYPAL_ENV, // 'production', Optional: specify 'sandbox' environment
payment: function(resolve, reject) {
return paypal.request.post(CREATE_PAYMENT_URL)
.then(function(data) { resolve(data.id); })
.catch(function(err) { reject(err); });
},
onAuthorize: function(data) {
// Note: you can display a confirmation page before executing
return paypal.request.post(EXECUTE_PAYMENT_URL,
{ paymentID: data.paymentID, payerID: data.payerID })
.then(function(data) { /* Go to a success page */ })
.catch(function(err) { /* Go to an error page */ });
}
}, '#paypal-button');
</script>

View File

@ -0,0 +1,127 @@
@model DoDirectCreditViewModel
<form asp-action="DoDirectCredit">
<div asp-validation-summary="ValidationSummary.All" class="text-danger" id="ValidationSummary"></div>
<div class="form-group">
<label asp-for="PaymentType" class="col-md-2 control-label">Type de paiement</label>
<div class="col-md-10">
<input asp-for="PaymentType" class="form-control" type="text" />
<span asp-validation-for="PaymentType" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="PayerName" class="col-md-2 control-label">Votre nom complet</label>
<div class="col-md-10">
<input asp-for="PayerName" class="form-control" type="text" />
<span asp-validation-for="PayerName" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="FirstName" class="col-md-2 control-label">Prénom</label>
<div class="col-md-10">
<input asp-for="FirstName" class="form-control" type="text" />
<span asp-validation-for="FirstName" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="LastName" class="col-md-2 control-label">Nom de fammille</label>
<div class="col-md-10">
<input asp-for="LastName" class="form-control" type="text" />
<span asp-validation-for="LastName" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="CreditCardNumber" class="col-md-2 control-label">Numéro de carte de crédit</label>
<div class="col-md-10">
<input asp-for="CreditCardNumber" class="form-control" type="text" />
<span asp-validation-for="CreditCardNumber" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="CreditCardType" class="col-md-2 control-label">Type de carte</label>
<div class="col-md-10">
<input asp-for="CreditCardType" class="form-control" type="text" />
<span asp-validation-for="CreditCardType" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Cvv2Number" class="col-md-2 control-label">Code de vérification visuelle</label>
<div class="col-md-10">
<input asp-for="Cvv2Number" class="form-control" type="text" />
<span asp-validation-for="Cvv2Number" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="CardExpiryDate" class="col-md-2 control-label">Date d'expritation</label>
<div class="col-md-10">
<input asp-for="CardExpiryDate" class="form-control" type="text" />
<span asp-validation-for="CardExpiryDate" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Street1" class="col-md-2 control-label">Adresse</label>
<div class="col-md-10">
<input asp-for="Street1" class="form-control" type="text" />
<span asp-validation-for="Street1" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Street2" class="col-md-2 control-label">Adresse (2ième ligne)</label>
<div class="col-md-10">
<input asp-for="Street2" class="form-control" type="text" />
<span asp-validation-for="Street2" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="City" class="col-md-2 control-label">Ville</label>
<div class="col-md-10">
<input asp-for="City" class="form-control" type="text" />
<span asp-validation-for="City" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="State" class="col-md-2 control-label">&Eacute;tat</label>
<div class="col-md-10">
<input asp-for="State" class="form-control" type="text" />
<span asp-validation-for="State" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Country" class="col-md-2 control-label">Pays</label>
<div class="col-md-10">
<input asp-for="Country" class="form-control" type="text" />
<span asp-validation-for="Country" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="PostalCode" class="col-md-2 control-label">Code postal</label>
<div class="col-md-10">
<input asp-for="PostalCode" class="form-control" type="text" />
<span asp-validation-for="PostalCode" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Phone" class="col-md-2 control-label">Téléphone</label>
<div class="col-md-10">
<input asp-for="Phone" class="form-control" type="text" />
<span asp-validation-for="Phone" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="CurrencyCode" class="col-md-2 control-label">Monaie</label>
<div class="col-md-10">
<input asp-for="CurrencyCode" class="form-control" type="text" />
<span asp-validation-for="CurrencyCode" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Amount" class="col-md-2 control-label">Montant</label>
<div class="col-md-10">
<input asp-for="Amount" class="form-control" type="text" />
<span asp-validation-for="Amount" class="text-danger"></span>
</div>
</div>
</div><input asp-for="IpnNotificationUrl" type="hidden" />
</form>

View File

@ -1,4 +1,4 @@
@model Location
@model SetAddressViewModel
<style>
#map {
@ -13,11 +13,11 @@
<div class="form-group">
<label asp-for="Address" class="col-md-2 control-label">@SR["Address"]</label>
<label asp-for="Street1" class="col-md-2 control-label">@SR["Address"]</label>
<div class="col-md-10">
<input asp-for="Address" class="form-control" type="text" />
<input asp-for="Street1" class="form-control" type="text" />
<span id="AddressError" asp-validation-for="Address" class="text-danger"></span>
<span id="AddressError" asp-validation-for="Street1" class="text-danger"></span>
<ul id="LocationCombo" >
</ul>
<div id="map"></div>
@ -25,8 +25,6 @@
</div>
<input type="submit" class="btn btn-success" value="Enregistrer" />
@Html.HiddenFor(model=>model.Latitude)
@Html.HiddenFor(model=>model.Longitude)
</form>
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }

View File

@ -2,7 +2,7 @@
@{
string[] HairLen = new string[] {SR["HalfLong"],SR["Long"],SR["Short"]};
}
<div style="display:block">
<div class="prestation">
<dl class="dl-horizontal">
<dd>
</dd>

View File

@ -117,9 +117,9 @@
"version": "1.0.0"
},
"Extensions.AspNet.Authentication.Instagram": "1.0.0-t150809211713",
"PayPalMerchantSDK": "2.16.204",
"Microsoft.AspNet.Http.Extensions": "1.0.0-rc1-final",
"Microsoft.DiaSymReader.Native": "1.5.0"
"Microsoft.DiaSymReader.Native": "1.5.0",
"PayPal": "1.8.0"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",

View File

@ -2547,6 +2547,18 @@
"lib/net40/Owin.dll": {}
}
},
"PayPal/1.8.0": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "7.0.1"
},
"compile": {
"lib/net451/PayPal.dll": {}
},
"runtime": {
"lib/net451/PayPal.dll": {}
}
},
"PayPalCoreSDK/1.7.1": {
"type": "package",
"dependencies": {
@ -2559,18 +2571,6 @@
"lib/net451/PayPalCoreSDK.dll": {}
}
},
"PayPalMerchantSDK/2.16.204": {
"type": "package",
"dependencies": {
"PayPalCoreSDK": "1.7.1"
},
"compile": {
"lib/net20/PayPalMerchantSDK.dll": {}
},
"runtime": {
"lib/net20/PayPalMerchantSDK.dll": {}
}
},
"Remotion.Linq/2.0.1": {
"type": "package",
"compile": {
@ -5416,6 +5416,18 @@
"lib/net40/Owin.dll": {}
}
},
"PayPal/1.8.0": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "7.0.1"
},
"compile": {
"lib/net451/PayPal.dll": {}
},
"runtime": {
"lib/net451/PayPal.dll": {}
}
},
"PayPalCoreSDK/1.7.1": {
"type": "package",
"dependencies": {
@ -5428,18 +5440,6 @@
"lib/net451/PayPalCoreSDK.dll": {}
}
},
"PayPalMerchantSDK/2.16.204": {
"type": "package",
"dependencies": {
"PayPalCoreSDK": "1.7.1"
},
"compile": {
"lib/net20/PayPalMerchantSDK.dll": {}
},
"runtime": {
"lib/net20/PayPalMerchantSDK.dll": {}
}
},
"Remotion.Linq/2.0.1": {
"type": "package",
"compile": {
@ -8285,6 +8285,18 @@
"lib/net40/Owin.dll": {}
}
},
"PayPal/1.8.0": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "7.0.1"
},
"compile": {
"lib/net451/PayPal.dll": {}
},
"runtime": {
"lib/net451/PayPal.dll": {}
}
},
"PayPalCoreSDK/1.7.1": {
"type": "package",
"dependencies": {
@ -8297,18 +8309,6 @@
"lib/net451/PayPalCoreSDK.dll": {}
}
},
"PayPalMerchantSDK/2.16.204": {
"type": "package",
"dependencies": {
"PayPalCoreSDK": "1.7.1"
},
"compile": {
"lib/net20/PayPalMerchantSDK.dll": {}
},
"runtime": {
"lib/net20/PayPalMerchantSDK.dll": {}
}
},
"Remotion.Linq/2.0.1": {
"type": "package",
"compile": {
@ -10689,6 +10689,21 @@
"Owin.nuspec"
]
},
"PayPal/1.8.0": {
"type": "package",
"sha512": "r59EIEePqy0yLRbGgJ1Ul86rXGtogC/8ofn9qTdKozN/CsTsotxGZMCzzDIFgnZRAm3zO6xz8tZGAWmKxDFX/Q==",
"files": [
"lib/net40/PayPal.dll",
"lib/net40/PayPal.xml",
"lib/net45/PayPal.dll",
"lib/net45/PayPal.xml",
"lib/net451/PayPal.dll",
"lib/net451/PayPal.xml",
"PayPal.1.8.0.nupkg",
"PayPal.1.8.0.nupkg.sha512",
"PayPal.nuspec"
]
},
"PayPalCoreSDK/1.7.1": {
"type": "package",
"sha512": "hGOLo3X2vgOpOWJI91+vlBgr/Dchk3xZAF0bdIpKiAwjlRKMjzSC4zuT1eGwmQ8uVL1IaGBZwNGklyRHDniYlQ==",
@ -10703,17 +10718,6 @@
"PayPalCoreSDK.nuspec"
]
},
"PayPalMerchantSDK/2.16.204": {
"type": "package",
"sha512": "uqn99kb71EYWbdYz3dIXTeTzbh5buhfa7uvSemZXDFW1BRnDi8CGAdbK2AX7ZT1JsH3GuQZqxqC0/KpWKML9Wg==",
"files": [
"lib/net20/PayPalMerchantSDK.dll",
"lib/net20/PayPalMerchantSDK.xml",
"PayPalMerchantSDK.2.16.204.nupkg",
"PayPalMerchantSDK.2.16.204.nupkg.sha512",
"PayPalMerchantSDK.nuspec"
]
},
"Remotion.Linq/2.0.1": {
"type": "package",
"sha512": "SIO6HDH6CU9GC2IZGBrc6q5X5vRhfatXrg9cVavCEG9W6v5e88b+vXjmLGQEorch4sYEIImRr+ODyUMyrmrqAg==",
@ -11626,9 +11630,9 @@
"System.Json >= 4.0.20126.16343",
"YavscLib >= 1.0.0",
"Extensions.AspNet.Authentication.Instagram >= 1.0.0-t150809211713",
"PayPalMerchantSDK >= 2.16.204",
"Microsoft.AspNet.Http.Extensions >= 1.0.0-rc1-final",
"Microsoft.DiaSymReader.Native >= 1.5.0"
"Microsoft.DiaSymReader.Native >= 1.5.0",
"PayPal >= 1.8.0"
],
"DNX,Version=v4.5.1": [
"fx/System.Drawing >= 4.0.0"

View File

@ -19,8 +19,6 @@
.price {
font-weight: bold;
font-size: x-large;
border: solid black 2px;
border-radius: 1em;
padding: .2em;
margin: .2em;
}

View File

@ -1,11 +1,18 @@
namespace YavscLib.Billing
{
public interface ICommandLine
{
long Id { get; set; }
public interface IBillItem {
string Description { get; set; }
int Count { get; set; }
decimal UnitaryCost { get; set; }
string Currency { get; set; }
}
public interface ICommandLine : IBillItem
{
// FIXME too hard: no such generic name in any interface
long Id { get; set; }
// FIXME too far: perhaps no existing estimate
long EstimateId { get; set; }
}

View File

@ -1,10 +1,16 @@
namespace YavscLib.Models.Workflow
{
using System.Collections.Generic;
using YavscLib;
using YavscLib.Billing;
public interface IQuery: IBaseTrackedEntity
public interface IQuery: IBaseTrackedEntity, IBillable
{
QueryStatus Status { get; set; }
}
public interface IBillable {
string Description { get; set; }
List<IBillItem> GetBillItems();
}
}