Skip to content
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

feat(composables): add onlyAvailable parameter #1378

Merged

Conversation

mkucmus
Copy link
Collaborator

@mkucmus mkucmus commented Feb 22, 2021

closes #1375

Checklist

@vercel
Copy link

vercel bot commented Feb 22, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/shopware-pwa/shopware-pwa-docs/3rnrhnkgTcJrsYiv5UGZ48wQMSHy
✅ Preview: https://shopware-pwa-d-git-feat-list-only-available-shipping-and-c64e35.vercel.app

@vercel vercel bot temporarily deployed to preview February 24, 2021 09:30 Inactive
…1375' of github.com:vuestorefront/shopware-pwa into feat/list-only-available-shipping-and-payment-methods-#1375
@vercel vercel bot temporarily deployed to preview February 24, 2021 09:40 Inactive
@github-actions
Copy link

github-actions bot commented Feb 24, 2021

💙 shopware-pwa-canary successfully deployed at https://ba2b5814ff99852a1aaaa1e84d9b260069df999f.shopware-pwa-canary.preview.storefrontcloud.io

Copy link
Collaborator

@patzick patzick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, we should add more specific typing though :)

@@ -159,10 +159,14 @@ export async function getAvailableSalutations(
* @beta
*/
export async function getAvailablePaymentMethods(
contextInstance: ShopwareApiInstance = defaultInstance
contextInstance: ShopwareApiInstance = defaultInstance,
params: any = {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
params: any = {}
params: { onlyAvailable?: boolean } = {}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

getContextPaymentMethodEndpoint()
getContextPaymentMethodEndpoint(),
{
params, // passing it as a last parameter won't cause a BC - to consider
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this comment necessary? There shouldn't be any BC here :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, removed

@@ -202,10 +206,14 @@ export async function setCurrentPaymentMethod(
* @beta
*/
export async function getAvailableShippingMethods(
contextInstance: ShopwareApiInstance = defaultInstance
contextInstance: ShopwareApiInstance = defaultInstance,
params: any = {} // passing it as a last parameter won't cause a BC - to consider
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
params: any = {} // passing it as a last parameter won't cause a BC - to consider
params: { onlyAvailable?: boolean } = {}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, thanks! added a more detailed type

@@ -165,13 +165,13 @@ export function getAvailableCurrencies(contextInstance?: ShopwareApiInstance): P
export function getAvailableLanguages(contextInstance?: ShopwareApiInstance): Promise<Language[]>;

// @beta (undocumented)
export function getAvailablePaymentMethods(contextInstance?: ShopwareApiInstance): Promise<PaymentMethod[]>;
export function getAvailablePaymentMethods(contextInstance?: ShopwareApiInstance, params?: any): Promise<PaymentMethod[]>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

types should change here, after local rebuild

@vercel vercel bot temporarily deployed to preview March 4, 2021 14:03 Inactive
@mkucmus mkucmus requested a review from patzick March 4, 2021 14:04
@vercel vercel bot temporarily deployed to preview March 4, 2021 22:24 Inactive
Copy link
Collaborator

@patzick patzick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 excellent

@patzick patzick merged commit f0b8016 into master Mar 5, 2021
@patzick patzick deleted the feat/list-only-available-shipping-and-payment-methods-#1375 branch March 5, 2021 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Only show available payment and shipping methods
2 participants