-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Seller Quotes] feat: verify if seller accepts quotes to process splitting and notify #59
base: master
Are you sure you want to change the base?
Changes from 23 commits
344c77f
a9ece27
d40f705
58ff10b
3cae023
df48022
85622cb
b3a2c6c
b3450d2
ffeadeb
1d8b309
3613262
f81db01
9af7ee0
caccc46
5c5771f
34901e0
70d1c4d
e2730f8
69d2076
92ef22e
fbb6529
021b359
f6a1117
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 |
---|---|---|
|
@@ -59,6 +59,10 @@ type Quote { | |
viewedBySales: Boolean | ||
viewedByCustomer: Boolean | ||
salesChannel: String | ||
seller: String | ||
approvedBySeller: Boolean | ||
parentQuote: 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. After the split, all quotes are independent. So there is no need to keep a parent quote or children data. 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. Without a link between the sellers quotes and the "parent" quote, it would not be possible to create this screen, for example: https://www.figma.com/design/SDETDCU5obc4Kg4WtmG6FH/RedCloud-%C2%B7-Seller-Quotes-%5BCubos%5D?node-id=263-24328&t=daYlrwPapSKRVfZN-4. 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. The where assembly that brings the quotes at marketplace side was changed because of this, always adding 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. The "link" between the quotes should be just a name or label and not a parent quote. It's name displayed in this screen 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. a relationship based on a string that is input by the user? |
||
hasChildren: Boolean | ||
} | ||
|
||
type QuoteUpdate { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import type { InstanceOptions, IOContext } from '@vtex/api' | ||
import { ExternalClient } from '@vtex/api' | ||
|
||
const SELLER_CLIENT_OPTIONS: InstanceOptions = { | ||
retries: 5, | ||
timeout: 5000, | ||
exponentialTimeoutCoefficient: 2, | ||
exponentialBackoffCoefficient: 2, | ||
initialBackoffDelay: 100, | ||
} | ||
|
||
const BASE_PATH = 'b2b-seller-quotes/_v/0' | ||
|
||
const ROUTES = { | ||
verifyQuoteSettings: 'verify-quote-settings', | ||
notifyNewQuote: 'notify-new-quote', | ||
} | ||
|
||
export default class SellerQuotesClient extends ExternalClient { | ||
constructor(ctx: IOContext, options?: InstanceOptions) { | ||
super('', ctx, { | ||
...options, | ||
...SELLER_CLIENT_OPTIONS, | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
VtexIdclientAutCookie: ctx.authToken, | ||
}, | ||
}) | ||
} | ||
|
||
private getRoute(sellerAccount: string, path: string) { | ||
const subdomain = this.context.production | ||
? sellerAccount | ||
: `${this.context.workspace}--${sellerAccount}` | ||
|
||
return `http://${subdomain}.myvtex.com/${BASE_PATH}/${path}` | ||
} | ||
|
||
public async verifyQuoteSettings(sellerAccount: string) { | ||
return this.http.get<VerifyQuoteSettingsResponse>( | ||
this.getRoute(sellerAccount, ROUTES.verifyQuoteSettings) | ||
) | ||
} | ||
|
||
public async notifyNewQuote( | ||
sellerAccount: string, | ||
quoteId: string, | ||
creationDate: string | ||
) { | ||
const payload: SellerQuoteNotifyInput = { | ||
quoteId, | ||
creationDate, | ||
marketplaceAccount: this.context.account, | ||
} | ||
|
||
return this.http.postRaw( | ||
this.getRoute(sellerAccount, ROUTES.notifyNewQuote), | ||
payload | ||
) | ||
} | ||
} |
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.
There is no need to have a field only for the seller's approval. A seller quote should use the same status as a regular quote. The only additional information is the seller's name, so you can query this information later.
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.
We understand that once the seller accepts the quote, there is no need to make the request to the seller again.
approvedBySeller
starts withfalse
when the seller is notified and can becometrue
depending on their approval. The first time the marketplace requests this data, it can save it so that it does not need to be requested again if the seller has approved the quote.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.
On second thought, i think you are right. We can just use the status for seller approval control.
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.
Done at f6a1117