-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8d6e38
commit cdb0045
Showing
12 changed files
with
591 additions
and
35 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/app/core/models/payment-method/hosted-payment-page-parameters.mapper.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,20 @@ | ||
export class HostedPaymentPageParametersMapper { | ||
static fromData(body: { name: string; value: string }[]): { name: string; value: string }[] { | ||
const hostedPaymentPageParameters: { name: string; value: string }[] = new Array(); | ||
|
||
if (body !== undefined) { | ||
for (const entry of body) { | ||
if (typeof entry.value !== 'string') { | ||
const sepaMandateArray = entry.value as { name: string; value: string }[]; | ||
hostedPaymentPageParameters.push({ name: 'mandateId', value: sepaMandateArray['mandateId'] }); | ||
hostedPaymentPageParameters.push({ name: 'mandateText', value: sepaMandateArray['mandateText'] }); | ||
hostedPaymentPageParameters.push({ name: 'directDebitType', value: sepaMandateArray['directDebitType'] }); | ||
} else { | ||
hostedPaymentPageParameters.push(entry); | ||
} | ||
} | ||
} | ||
|
||
return hostedPaymentPageParameters; | ||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
...eckout-payment/payment-concardis-directdebit/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,19 @@ | ||
<formly-form [form]="parameterForm" [options]="options" [model]="model" [fields]="getFieldConfig()"> | ||
<div class="offset-md-4 col-md-8"> | ||
<ish-checkbox | ||
*ngIf="paymentMethod && paymentMethod.saveAllowed" | ||
[form]="parameterForm" | ||
controlName="saveForLater" | ||
label="checkout.save_edit.checkbox.label" | ||
data-testing-id="save-for-later-input" | ||
></ish-checkbox> | ||
<div class="form-group"> | ||
<button type="submit" class="btn btn-primary" (click)="submitNewPaymentInstrument()"> | ||
{{ 'checkout.account.submit.button.label' | translate }} | ||
</button> | ||
<button type="button" class="btn btn-secondary" (click)="cancelNewPaymentInstrument()"> | ||
{{ 'checkout.cancel.button.label' | translate }} | ||
</button> | ||
</div> | ||
</div> | ||
</formly-form> |
49 changes: 49 additions & 0 deletions
49
...out-payment/payment-concardis-directdebit/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,49 @@ | ||
import { ComponentFixture, TestBed, async } from '@angular/core/testing'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
import { FaIconComponent } from '@fortawesome/angular-fontawesome'; | ||
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'; | ||
import { FormlyForm } from '@ngx-formly/core'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { MockComponent } from 'ng-mocks'; | ||
|
||
import { PaymentMethod } from 'ish-core/models/payment-method/payment-method.model'; | ||
import { CheckboxComponent } from 'ish-shared/forms/components/checkbox/checkbox.component'; | ||
|
||
import { PaymentConcardisDirectdebitComponent } from './payment-concardis-directdebit.component'; | ||
|
||
describe('Payment Concardis Directdebit Component', () => { | ||
let component: PaymentConcardisDirectdebitComponent; | ||
let fixture: ComponentFixture<PaymentConcardisDirectdebitComponent>; | ||
let element: HTMLElement; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
MockComponent(CheckboxComponent), | ||
MockComponent(FaIconComponent), | ||
MockComponent(FormlyForm), | ||
MockComponent(NgbPopover), | ||
PaymentConcardisDirectdebitComponent, | ||
], | ||
imports: [ReactiveFormsModule, TranslateModule.forRoot()], | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(PaymentConcardisDirectdebitComponent); | ||
component = fixture.componentInstance; | ||
element = fixture.nativeElement; | ||
|
||
component.paymentMethod = { | ||
id: 'Concardis_DirectDebit', | ||
saveAllowed: false, | ||
parameters: [{ key: 'key1', name: 'name', templateOptions: { label: 'input' } }], | ||
} as PaymentMethod; | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(component).toBeTruthy(); | ||
expect(element).toBeTruthy(); | ||
expect(() => fixture.detectChanges()).not.toThrow(); | ||
}); | ||
}); |
Oops, something went wrong.