Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

feat(composables): add onlyAvailable parameter #1378

Merged

Conversation

mkucmus
Copy link
Collaborator

@mkucmus mkucmus commented Feb 22, 2021

closes #1375

Checklist

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
branchvincent Branch Vincent
…nd shipping methods
@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

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…ent-methods-#1375
@vercel vercel bot temporarily deployed to preview February 24, 2021 09:30 Inactive

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…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

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@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

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…ent-methods-#1375
@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 subscribe to this conversation on GitHub. Already have an account? Sign in.
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