-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Interface Types #397
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
import { type Address, type Amount, type PaymentMethod } from '../../data/global'; | ||
import { type Issuer } from '../../data/Issuer'; | ||
import { type Amount, type PaymentMethod } from '../../data/global'; | ||
import { type PaymentData, type PaymentEmbed, type PaymentInclude } from '../../data/payments/data'; | ||
import type MaybeArray from '../../types/MaybeArray'; | ||
import { type IdempotencyParameter, type PaginationParameters, type ThrottlingParameter } from '../../types/parameters'; | ||
import type PickOptional from '../../types/PickOptional'; | ||
|
||
export type CreateParameters = Pick<PaymentData, 'amount' | 'description' | 'redirectUrl' | 'cancelUrl' | 'webhookUrl' | 'customerId' | 'mandateId'> & | ||
export type CreateParameters = Pick< | ||
PaymentData, | ||
| 'amount' | ||
| 'description' | ||
| 'redirectUrl' | ||
| 'cancelUrl' | ||
| 'webhookUrl' | ||
| 'customerId' | ||
| 'mandateId' | ||
| 'lines' | ||
| 'shippingAddress' | ||
| 'billingAddress' | ||
| 'routing' | ||
| 'issuer' | ||
| 'restrictPaymentMethodsToCountry' | ||
> & | ||
PickOptional<PaymentData, 'locale' | 'metadata' | 'sequenceType' | 'captureMode' | 'captureDelay'> & { | ||
/** | ||
* Normally, a payment method screen is shown. However, when using this parameter, you can choose a specific payment method and your customer will skip the selection screen and is sent directly to | ||
|
@@ -45,6 +59,9 @@ export type CreateParameters = Pick<PaymentData, 'amount' | 'description' | 'red | |
* @see https://docs.mollie.com/reference/v2/payments-api/create-payment?path=applePayPaymentToken#apple-pay | ||
*/ | ||
applePayPaymentToken?: string; | ||
/** | ||
* @deprecated use billingAddress.email instead | ||
*/ | ||
billingEmail?: string; | ||
/** | ||
* The date the payment should expire, in `YYYY-MM-DD` format. **Note:** the minimum date is tomorrow and the maximum date is 100 days after tomorrow. | ||
|
@@ -54,27 +71,12 @@ export type CreateParameters = Pick<PaymentData, 'amount' | 'description' | 'red | |
* @see https://docs.mollie.com/reference/v2/payments-api/create-payment?path=dueDate#bank-transfer | ||
*/ | ||
dueDate?: string; | ||
/** | ||
* The card holder's address details. We advise to provide these details to improve the credit card fraud protection, and thus improve conversion. | ||
* | ||
* If an address is provided, then the address has to be in a valid format. See the address object documentation for more information on which formats are accepted. | ||
* | ||
* @see https://docs.mollie.com/reference/v2/payments-api/create-payment?path=billingAddress#credit-card | ||
*/ | ||
billingAddress?: Address; | ||
/** | ||
* The card token you got from Mollie Components. The token contains the card information (such as card holder, card number, and expiry date) needed to complete the payment. | ||
* | ||
* @see https://docs.mollie.com/reference/v2/payments-api/create-payment?path=cardToken#credit-card | ||
*/ | ||
cardToken?: string; | ||
shippingAddress?: Address & { | ||
// Note that this field is required for PayPal payments; but is disregarded for credit card payments. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not actually removed, but picked from data (see above) |
||
givenName?: string; | ||
// Note that this field is required for PayPal payments; but is disregarded for credit card payments. | ||
familyName?: string; | ||
}; | ||
issuer?: Issuer; | ||
/** | ||
* The card number on the gift card. You can supply this to prefill the card number. | ||
* | ||
|
@@ -133,7 +135,13 @@ export type CreateParameters = Pick<PaymentData, 'amount' | 'description' | 'red | |
* @see https://docs.mollie.com/reference/v2/payments-api/create-payment?path=consumerAccount#sepa-direct-debit | ||
*/ | ||
consumerAccount?: string; | ||
include?: MaybeArray<PaymentInclude>; | ||
/** | ||
* This endpoint allows you to include additional information via the `include` query string parameter. | ||
* * `details.qrCode`: Include a QR code object. Only available for iDEAL, Bancontact and bank transfer payments. | ||
* | ||
* __Note:__ In the REST API, this is not part of the request body, but a query Parameter. It is included here for consistency. | ||
*/ | ||
include?: MaybeArray<PaymentInclude.qrCode>; // currently only one valid value, but making 'MaybeArray' for consistency | ||
profileId?: string; | ||
testmode?: boolean; | ||
/** | ||
|
@@ -163,13 +171,12 @@ export type CreateParameters = Pick<PaymentData, 'amount' | 'description' | 'red | |
} & IdempotencyParameter; | ||
|
||
export interface GetParameters { | ||
include?: PaymentInclude; | ||
include?: MaybeArray<PaymentInclude>; | ||
embed?: MaybeArray<PaymentEmbed>; | ||
testmode?: boolean; | ||
} | ||
|
||
export type PageParameters = PaginationParameters & { | ||
profileId?: string; | ||
testmode?: boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fjbender This param was not in the DOCS, which is why I assumed it does not exist and removed it. Can you confirm this Query Param is not available for list payments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've just tried out listing my payments with this param set, and got this response: {
"status": 422,
"title": "Unprocessable Entity",
"detail": "Non-existent query parameter \"profileId\" for this API call. Did you mean: \"previous\"?",
"field": "profileId",
"_links": {
"documentation": {
"href": "https://docs.mollie.com/overview/handling-errors",
"type": "text/html"
}
}
} So yes, if it was ever possible to filter by profile ID, it's not possible anymore. |
||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,24 @@ export interface Amount { | |
} | ||
|
||
export interface Address { | ||
/** | ||
* The title of the person, for example _Mr._ or _Mrs._. | ||
* | ||
* @see https://docs.mollie.com/overview/common-data-types?path=title#address-object | ||
*/ | ||
title?: string; | ||
/** | ||
* The given name (first name) of the person should be more than 1 character and cannot contain only numbers. | ||
* | ||
* @see https://docs.mollie.com/overview/common-data-types?path=givenName#address-object | ||
*/ | ||
givenName?: string; | ||
/** | ||
* The family name (surname) of the person should be more than 1 character and cannot contain only numbers. | ||
* | ||
* @see https://docs.mollie.com/overview/common-data-types?path=familyName#address-object | ||
*/ | ||
familyName?: string; | ||
/** | ||
* The street and street number of the address. | ||
* | ||
|
@@ -102,7 +120,13 @@ export interface Address { | |
* | ||
* @see https://docs.mollie.com/overview/common-data-types?path=postalCode#address-object | ||
*/ | ||
postalCode: string; | ||
postalCode?: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the only potentially breaking change, as for this was used for orders and is actually optional. |
||
/** | ||
* The customer's email address. | ||
* | ||
* @see https://docs.mollie.com/overview/common-data-types?path=email#address-object | ||
*/ | ||
email?: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fjbender |
||
/** | ||
* The city of the address. | ||
* | ||
|
@@ -112,6 +136,8 @@ export interface Address { | |
/** | ||
* The region of the address. | ||
* | ||
* For certain PayPal payments the `region` field is required. | ||
* | ||
* @see https://docs.mollie.com/overview/common-data-types?path=region#address-object | ||
*/ | ||
region?: string; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not actually removed, but picked from data (see above)