diff --git a/CollAction/CollAction.csproj b/CollAction/CollAction.csproj
index becdde4ba..7f2a88719 100644
--- a/CollAction/CollAction.csproj
+++ b/CollAction/CollAction.csproj
@@ -8,8 +8,8 @@
-
-
+
+
@@ -17,7 +17,7 @@
-
+
@@ -37,13 +37,13 @@
-
+
-
+
diff --git a/CollAction/Services/Donation/DonationService.cs b/CollAction/Services/Donation/DonationService.cs
index 3410db9a5..0a9ee9320 100644
--- a/CollAction/Services/Donation/DonationService.cs
+++ b/CollAction/Services/Donation/DonationService.cs
@@ -66,6 +66,7 @@ public sealed class DonationService : IDonationService
private readonly IEmailSender emailSender;
private readonly ILogger logger;
private readonly IServiceProvider serviceProvider;
+ private readonly StripeClient stripeClient;
private readonly StripeSignatures stripeSignatures;
private readonly ApplicationDbContext context;
private readonly UserManager userManager;
@@ -89,13 +90,14 @@ public DonationService(
this.emailSender = emailSender;
this.logger = logger;
this.serviceProvider = serviceProvider;
- customerService = new CustomerService(this.requestOptions.ApiKey);
- sourceService = new SourceService(this.requestOptions.ApiKey);
- chargeService = new ChargeService(this.requestOptions.ApiKey);
- sessionService = new SessionService(this.requestOptions.ApiKey);
- subscriptionService = new SubscriptionService(this.requestOptions.ApiKey);
- planService = new PlanService(this.requestOptions.ApiKey);
- productService = new ProductService(this.requestOptions.ApiKey);
+ this.stripeClient = new StripeClient(this.requestOptions.ApiKey);
+ customerService = new CustomerService(stripeClient);
+ sourceService = new SourceService(stripeClient);
+ chargeService = new ChargeService(stripeClient);
+ sessionService = new SessionService(stripeClient);
+ subscriptionService = new SubscriptionService(stripeClient);
+ planService = new PlanService(stripeClient);
+ productService = new ProductService(stripeClient);
}
public async Task HasIDealPaymentSucceeded(string sourceId, string clientSecret, CancellationToken token)
@@ -117,6 +119,7 @@ public async Task InitializeCreditCardCheckout(CreditCardCheckout checko
}
ApplicationUser user = await userManager.FindByEmailAsync(checkout.Email).ConfigureAwait(false);
+ Customer customer = await GetOrCreateCustomer(checkout.Name, checkout.Email, token).ConfigureAwait(false);
var sessionOptions = new SessionCreateOptions()
{
@@ -125,20 +128,20 @@ public async Task InitializeCreditCardCheckout(CreditCardCheckout checko
PaymentMethodTypes = new List
{
"card",
- }
+ },
+ Customer = customer.Id
};
if (checkout.Recurring)
{
logger.LogInformation("Initializing recurring credit card checkout session");
- sessionOptions.CustomerEmail = checkout.Email; // TODO: sessionOptions.CustomerId = customer.Id; // Once supported
sessionOptions.SubscriptionData = new SessionSubscriptionDataOptions()
{
Items = new List()
{
new SessionSubscriptionDataItemOptions()
{
- PlanId = (await CreateRecurringPlan(checkout.Amount, checkout.Currency, token).ConfigureAwait(false)).Id,
+ Plan = (await CreateRecurringPlan(checkout.Amount, checkout.Currency, token).ConfigureAwait(false)).Id,
Quantity = 1
}
}
@@ -147,8 +150,6 @@ public async Task InitializeCreditCardCheckout(CreditCardCheckout checko
else
{
logger.LogInformation("Initializing credit card checkout session");
- Customer customer = await GetOrCreateCustomer(checkout.Name, checkout.Email, token).ConfigureAwait(false);
- sessionOptions.CustomerId = customer.Id;
sessionOptions.LineItems = new List()
{
new SessionLineItemOptions()
@@ -197,13 +198,13 @@ public async Task InitializeSepaDirect(SepaDirectCheckout checkout, Cancellation
new SubscriptionCreateOptions()
{
DefaultSource = source.Id,
- Billing = Billing.ChargeAutomatically,
- CustomerId = customer.Id,
- Items = new List()
+ CollectionMethod = "charge_automatically",
+ Customer = customer.Id,
+ Items = new List()
{
- new SubscriptionItemOption()
+ new SubscriptionItemOptions()
{
- PlanId = plan.Id,
+ Plan = plan.Id,
Quantity = 1
}
}
@@ -279,7 +280,7 @@ public async Task LogPaymentEvent(string json, string signature, CancellationTok
var subscriptions = await subscriptionService.ListAsync(
new SubscriptionListOptions()
{
- CustomerId = charge.CustomerId
+ Customer = charge.CustomerId
},
cancellationToken: token).ConfigureAwait(false);
Customer customer = await customerService.GetAsync(charge.CustomerId, cancellationToken: token).ConfigureAwait(false);
@@ -303,8 +304,8 @@ public async Task Charge(string sourceId)
{
Amount = source.Amount,
Currency = source.Currency,
- SourceId = sourceId,
- CustomerId = source.Customer,
+ Source = sourceId,
+ Customer = source.Customer,
Description = "A donation to Stichting CollAction"
}).ConfigureAwait(false);
}
@@ -340,7 +341,7 @@ public async Task> GetSubscriptionsFor(ApplicationUser
subscriptionService.ListAsync(
new SubscriptionListOptions()
{
- CustomerId = c.Id
+ Customer = c.Id
},
cancellationToken: token))).ConfigureAwait(false);
@@ -370,7 +371,7 @@ private async Task CreateRecurringPlan(int amount, string currency, Cancel
return await planService.CreateAsync(
new PlanCreateOptions()
{
- ProductId = product.Id,
+ Product = product.Id,
Active = true,
Amount = amount * 100,
Currency = currency,
@@ -410,7 +411,7 @@ private async Task GetOrCreateRecurringDonationProduct(CancellationToke
private async Task GetOrCreateCustomer(string name, string email, CancellationToken token)
{
- Customer? customer = (await customerService.ListAsync(new CustomerListOptions() { Email = email, Limit = 1 }, requestOptions, token).ConfigureAwait(false)).FirstOrDefault();
+ Customer? customer = (await customerService.ListAsync(new CustomerListOptions() { Email = email, Limit = 1 }, cancellationToken: token).ConfigureAwait(false)).FirstOrDefault();
string? metadataName = null;
customer?.Metadata?.TryGetValue(NameKey, out metadataName);
var metadata = new Dictionary() { { NameKey, name } };
diff --git a/Frontend/package.json b/Frontend/package.json
index 17ea067f3..1d8726433 100644
--- a/Frontend/package.json
+++ b/Frontend/package.json
@@ -1,6 +1,5 @@
{
"name": "collaction-frontend",
- "version": "0.1.0",
"private": true,
"dependencies": {
"@apollo/client": "^3.0.0-beta.50",
diff --git a/Frontend/src/components/Admin/Crowdactions/AdminEditCrowdaction.tsx b/Frontend/src/components/Admin/Crowdactions/AdminEditCrowdaction.tsx
index 8a096eafa..163583b03 100644
--- a/Frontend/src/components/Admin/Crowdactions/AdminEditCrowdaction.tsx
+++ b/Frontend/src/components/Admin/Crowdactions/AdminEditCrowdaction.tsx
@@ -212,7 +212,6 @@ export default ({ crowdactionId } : IEditCrowdactionProps): any => {
{
{
{
{
{
{
{
{
{
{
{
{
{
First Category
-
Second Category
-
+
{ categories.map(c => ) }
@@ -355,21 +342,20 @@ export default ({ crowdactionId } : IEditCrowdactionProps): any => {
Status
-
+
{ crowdactionStatusses.map(s => ) }
Display Priority
-
+
{ displayPriorities.map(d => ) }
{
{
{
{
{
}
diff --git a/Frontend/src/components/Profile/CrowdactionCreated.tsx b/Frontend/src/components/Profile/CrowdactionCreated.tsx
index 4c722cf5a..26a49cfd8 100644
--- a/Frontend/src/components/Profile/CrowdactionCreated.tsx
+++ b/Frontend/src/components/Profile/CrowdactionCreated.tsx
@@ -94,11 +94,11 @@ export default ({ user, crowdaction }: ICrowdactionParticipatingProps) => {
To personalize the message, you can add {'{firstname}'} and {'{lastname}'} to your message (including the brackets) - these will be substituted with the user's first and last name.
- 0 && formik.errors.subject !== undefined} name="subject" label="Subject" {...formik.getFieldProps('subject')} />
+ 0 && formik.errors.subject !== undefined} label="Subject" {...formik.getFieldProps('subject')} />
{ formik.submitCount > 0 ? : null }
- 0 && formik.errors.message !== undefined} multiline={true} name="message" rows={40} label="E-Mail Message" {...formik.getFieldProps('message')} />
+ 0 && formik.errors.message !== undefined} multiline={true} rows={40} label="E-Mail Message" {...formik.getFieldProps('message')} />
{ formik.submitCount > 0 ? : null }
diff --git a/Frontend/src/pages/account/FinishRegistration/FinishRegistration.tsx b/Frontend/src/pages/account/FinishRegistration/FinishRegistration.tsx
index 2690ebbfd..076b438c3 100644
--- a/Frontend/src/pages/account/FinishRegistration/FinishRegistration.tsx
+++ b/Frontend/src/pages/account/FinishRegistration/FinishRegistration.tsx
@@ -110,18 +110,18 @@ const FinishRegistrationPage = () => {