diff --git a/projects/common/src/fm/models/mollie.payment.request.ts b/projects/common/src/fm/models/mollie.payment.request.ts new file mode 100644 index 0000000..7e7761c --- /dev/null +++ b/projects/common/src/fm/models/mollie.payment.request.ts @@ -0,0 +1,16 @@ +import { IItem } from "./item"; + +export interface IMolliePaymentRequest { + templatePackageItem?: IItem, + redirectUrl?: string, + locale?: string, + } + + export class MolliePaymentRequest implements IMolliePaymentRequest { + public templatePackageItem?: IItem; + public redirectUrl?: string; + public locale?: string; + + constructor() { + } + } \ No newline at end of file diff --git a/projects/common/src/fm/models/mollie.payment.response.ts b/projects/common/src/fm/models/mollie.payment.response.ts index e9865e0..7db9dfc 100644 --- a/projects/common/src/fm/models/mollie.payment.response.ts +++ b/projects/common/src/fm/models/mollie.payment.response.ts @@ -2,12 +2,16 @@ export interface IMolliePaymentResponse { createdAt?: Date, expiresAt?: Date, + currency?: string, + amount?: string, checkoutUrl?: string, } export class MolliePaymentResponse implements IMolliePaymentResponse { public createdAt?: Date; public expiresAt?: Date; + public currency?: string; + public amount?: string; public checkoutUrl?: string; constructor() { diff --git a/projects/common/src/fm/services/mollie.service.ts b/projects/common/src/fm/services/mollie.service.ts index 8d44245..5b38b21 100644 --- a/projects/common/src/fm/services/mollie.service.ts +++ b/projects/common/src/fm/services/mollie.service.ts @@ -1,10 +1,9 @@ import { Injectable } from '@angular/core'; -import { IItem } from '../models/item'; -import { IItemTask } from '../models/itemTask'; import { HttpClient } from "@angular/common/http"; import { AppConfig } from "../shared/app.config"; import { Observable } from 'rxjs'; import { IMolliePaymentResponse } from '../models/mollie.payment.response'; +import { IMolliePaymentRequest } from '../models/mollie.payment.request'; @Injectable({ providedIn: 'root', @@ -20,15 +19,9 @@ export class MollieService { return this.appConfig.getConfig("apiEndPoint"); } - createMolliePayment(templatePackage: IItem, redirectUrl: string): Observable { - let payload = { - "currency": "EUR", - "amount": "100.00", - "redirectUrl": redirectUrl, - "itemCode": templatePackage.code, - "locale": "nl_NL", - "validity": templatePackage.data?.validity - }; - return this.httpClient.post(`${this.ApiEndpoint()}/api/v1/payments/create`, payload); + createMolliePayment(paymentRequest: IMolliePaymentRequest): Observable { + return this.httpClient.post( + `${this.ApiEndpoint()}/api/v1/payments/create`, + paymentRequest); } } \ No newline at end of file