Refined pre-validation of members import

no issues.
- removes email and Stripe duplicate customer ID check to focus validation that might affect the whole dataset
- applies visual style and refines copy
This commit is contained in:
Peter Zimon 2020-06-18 10:30:15 +02:00
parent 131fd8fe2c
commit 2dfff367b9
3 changed files with 11 additions and 19 deletions

View File

@ -42,13 +42,9 @@
<div class="failed flex items-start gh-members-upload-errorcontainer gh-members-upload-warningmessage"> <div class="failed flex items-start gh-members-upload-errorcontainer gh-members-upload-warningmessage">
<div class="mr2">{{svg-jar "warning" class="nudge-top--2 w5 h5 fill-yellow-d1"}}</div> <div class="mr2">{{svg-jar "warning" class="nudge-top--2 w5 h5 fill-yellow-d1"}}</div>
<div> <div>
<p class="ma0 pa0 gh-members-import-errorheading"><span class="fw6">Warning!</span> There are some problems with the CSV data. You can still import it but data loss might occur.</p>
<button type="button" class="gh-btn gh-btn-text gh-btn-warningdetails regular" {{action (toggle "errorDetailsOpen" this)}}><span>Details</span></button>
{{#liquid-if this.errorDetailsOpen}}
{{#each validationErrors as |error|}} {{#each validationErrors as |error|}}
<p class="ma0 pa0 gh-members-import-errordetailtext">{{error.message}}</p> <p class="ma0 pa0 gh-members-import-errorheading">{{{error.message}}}</p>
{{/each}} {{/each}}
{{/liquid-if}}
</div> </div>
</div> </div>
{{/if}} {{/if}}

View File

@ -37,28 +37,18 @@ export default Service.extend({
} }
// check can be done on whole set as it won't be too slow // check can be done on whole set as it won't be too slow
let emailValidation = this._checkEmails(data);
if (emailValidation !== true) {
validationResults.push(new MemberImportError('Emails in provided data don\'t appear to be valid email addresses.'));
}
const hasStripeId = this._containsRecordsWithStripeId(validatedSet); const hasStripeId = this._containsRecordsWithStripeId(validatedSet);
if (hasStripeId) { if (hasStripeId) {
// check can be done on whole set as it won't be too slow // check can be done on whole set as it won't be too slow
if (!this.membersUtils.isStripeEnabled) { if (!this.membersUtils.isStripeEnabled) {
validationResults.push(new MemberImportError(`You need to connect to Stripe first to import Stripe data.`)); validationResults.push(new MemberImportError(`You need to <a href="#/settings/labs">connect to Stripe</a> to import Stripe customers.`));
} else { } else {
let stripeSeverValidation = await this._checkStripeServer(validatedSet); let stripeSeverValidation = await this._checkStripeServer(validatedSet);
if (stripeSeverValidation !== true) { if (stripeSeverValidation !== true) {
validationResults.push(new MemberImportError('Stripe customer IDs exist in the data, but we could not find such customer in connected Stripe account')); validationResults.push(new MemberImportError(`The CSV contains Stripe customers from a different Stripe account. Make sure you're connected to the correct <a href="#/settings/labs">Stripe account</a>.`));
} }
} }
let hasDuplicateStripeIds = this._hasDuplicateStripeIds(data);
if (hasDuplicateStripeIds === true) {
validationResults.push(new MemberImportError('Members with same Stripe customer IDs will not be imported.'));
}
} }
if (validationResults.length) { if (validationResults.length) {

View File

@ -423,12 +423,18 @@ textarea.gh-member-details-textarea {
border-radius: 4px; border-radius: 4px;
padding: 8px; padding: 8px;
margin-bottom: 20px; margin-bottom: 20px;
color: var(--middarkgrey);
} }
.gh-members-upload-warningmessage { .gh-members-upload-warningmessage {
border-left: 4px solid var(--yellow); border-left: 4px solid var(--yellow);
} }
.gh-members-upload-warningmessage p a {
color: color-mod(var(--yellow) l(-12%));
text-decoration: underline;
}
.gh-members-upload-errormessage { .gh-members-upload-errormessage {
border-left: 4px solid var(--red); border-left: 4px solid var(--red);
} }