-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: recheck concardis credit card cvc if necessary (#359)
If the user pays with a saved Concardis credit card the cvc code is requested on checkout payment page if necessary.
- Loading branch information
1 parent
dee2bba
commit c82b493
Showing
23 changed files
with
615 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ccount-payment-concardis-directdebit/account-payment-concardis-directdebit.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<ish-modal-dialog-link | ||
*ngIf="paymentInstrument.paymentMethod === 'Concardis_DirectDebit'" | ||
(click)="showSepaMandateText()" | ||
linkText="account.payment.view_sepa_mandate.link" | ||
[options]="{ titleText: 'account.payment.view_sepa_mandate_text.link' | translate }" | ||
> | ||
<div class="col-md-12"> | ||
<dl class="row dl-horizontal dl-separator"> | ||
<dt class="col-md-4">{{ 'account.payment.sepa_mandate_Reference' | translate }}</dt> | ||
<dd class="col-md-8">{{ mandateReference }}</dd> | ||
</dl> | ||
<dl data-testing-id="mandate-text"> | ||
<dd>{{ mandateText }}</dd> | ||
</dl> | ||
<dl class="row dl-horizontal dl-separator"> | ||
<dt class="col-md-4">{{ 'account.payment.sepa_accepted_on' | translate }}</dt> | ||
<dd class="col-md-8">{{ mandateCreatedDateTime | ishDate }}</dd> | ||
</dl> | ||
</div> | ||
</ish-modal-dialog-link> |
67 changes: 67 additions & 0 deletions
67
...unt-payment-concardis-directdebit/account-payment-concardis-directdebit.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { MockComponent, MockPipe } from 'ng-mocks'; | ||
|
||
import { DatePipe } from 'ish-core/pipes/date.pipe'; | ||
import { ModalDialogLinkComponent } from 'ish-shared/components/common/modal-dialog-link/modal-dialog-link.component'; | ||
|
||
import { AccountPaymentConcardisDirectdebitComponent } from './account-payment-concardis-directdebit.component'; | ||
|
||
describe('Account Payment Concardis Directdebit Component', () => { | ||
let component: AccountPaymentConcardisDirectdebitComponent; | ||
let fixture: ComponentFixture<AccountPaymentConcardisDirectdebitComponent>; | ||
let element: HTMLElement; | ||
|
||
const mandateTextValue = 'mandate_text'; | ||
const mandateCreatedDateTimeValue = '1597644563000'; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [TranslateModule.forRoot()], | ||
declarations: [ | ||
AccountPaymentConcardisDirectdebitComponent, | ||
MockComponent(ModalDialogLinkComponent), | ||
MockPipe(DatePipe), | ||
], | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AccountPaymentConcardisDirectdebitComponent); | ||
component = fixture.componentInstance; | ||
element = fixture.nativeElement; | ||
|
||
component.paymentInstrument = { | ||
id: '4321', | ||
paymentMethod: 'Concardis_DirectDebit', | ||
parameters: [ | ||
{ | ||
name: 'mandateReference', | ||
value: 'mandate_reference', | ||
}, | ||
{ | ||
name: 'mandateText', | ||
value: mandateTextValue, | ||
}, | ||
{ | ||
name: 'mandateCreatedDateTime', | ||
value: mandateCreatedDateTimeValue, | ||
}, | ||
], | ||
}; | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(component).toBeTruthy(); | ||
expect(element).toBeTruthy(); | ||
expect(() => fixture.detectChanges()).not.toThrow(); | ||
}); | ||
|
||
it('should show sepa mandate text on executing showSepaMandateText()', () => { | ||
fixture.detectChanges(); | ||
component.showSepaMandateText(); | ||
expect(element.querySelector('[data-testing-id="mandate-text"]')).toBeTruthy(); | ||
expect(component.mandateText).toEqual(mandateTextValue); | ||
expect(component.mandateCreatedDateTime.toString()).toEqual(mandateCreatedDateTimeValue); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
.../account-payment-concardis-directdebit/account-payment-concardis-directdebit.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
|
||
import { PaymentInstrument } from 'ish-core/models/payment-instrument/payment-instrument.model'; | ||
|
||
@Component({ | ||
selector: 'ish-account-payment-concardis-directdebit', | ||
templateUrl: './account-payment-concardis-directdebit.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class AccountPaymentConcardisDirectdebitComponent { | ||
@Input() paymentInstrument: PaymentInstrument; | ||
|
||
mandateReference: string; | ||
mandateText: string; | ||
mandateCreatedDateTime: number; | ||
|
||
/** | ||
* Show SEPA mandate information | ||
*/ | ||
showSepaMandateText() { | ||
this.mandateReference = this.paymentInstrument.parameters | ||
.find(param => param.name === 'mandateReference') | ||
.value.toString(); | ||
this.mandateText = this.paymentInstrument.parameters.find(param => param.name === 'mandateText').value.toString(); | ||
const mandateCreatedDatetimeStr = this.paymentInstrument.parameters | ||
.find(param => param.name === 'mandateCreatedDateTime') | ||
.value.toString(); | ||
this.mandateCreatedDateTime = Number(mandateCreatedDatetimeStr) || 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.