From a08eed7c676907a763a0a5cb08e90f1d7651198c Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Wed, 13 Jan 2021 16:40:35 +0100 Subject: [PATCH] AW-1805 Update mollie service (client) --- .../src/fm/models/mollie.payment.request.ts | 16 ++++++++++++++++ .../src/fm/models/mollie.payment.response.ts | 4 ++++ .../common/src/fm/services/mollie.service.ts | 17 +++++------------ 3 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 projects/common/src/fm/models/mollie.payment.request.ts 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