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

[Marketplace] Orders line items refund #2590

Merged
merged 174 commits into from
Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from 145 commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
b9a5237
Allow customer to move past validation after one pass
brent-hoover Apr 17, 2017
6917f5c
Silencing needless warning
brent-hoover Apr 17, 2017
cca678a
Add missing imports
brent-hoover Apr 17, 2017
433bef6
When we get a "GetTax" error, revert to addressbook
brent-hoover Apr 17, 2017
5b64575
Capture and parse errors
brent-hoover Apr 17, 2017
564dfdf
Creating a "review and fix" address review screen
brent-hoover Apr 20, 2017
7f7a02a
Show highlited diff. Copy over values on click.
brent-hoover Apr 21, 2017
9a56646
Removing "debug" HTML
brent-hoover Apr 21, 2017
28db441
Add "review address" translation
brent-hoover Apr 21, 2017
f5c7c9e
Basic "review address" flow working
brent-hoover Apr 21, 2017
c5c79a4
Remove console.log
brent-hoover Apr 21, 2017
540c24e
Merge branch 'development' into brent-fix-issue-2104
brent-hoover Apr 25, 2017
9393e16
Fix missing import
brent-hoover Apr 25, 2017
9218f31
Fix import error
brent-hoover Apr 25, 2017
4ac11b2
Return to edit and refresh address when you cancel out of review
brent-hoover Apr 25, 2017
9f8da99
Make edit behave the same as add
brent-hoover Apr 25, 2017
3d972d0
Tweak styling
brent-hoover Apr 25, 2017
5ce8394
Merge branch 'development' into brent-fix-issue-2104
brent-hoover May 14, 2017
de48f0b
Merge branch 'development' into brent-fix-issue-2104
brent-hoover May 24, 2017
7e330d9
More and more style changes
brent-hoover May 24, 2017
4729320
Use proper color variables
brent-hoover May 25, 2017
31c0349
Create proper behaviors
brent-hoover May 25, 2017
62b9c45
Merge branch 'development' into brent-fix-issue-2104
brent-hoover May 25, 2017
1de63a3
Fix bad evaluation
brent-hoover May 25, 2017
e263769
Fix import order
brent-hoover May 25, 2017
239680d
Add i18n
brent-hoover May 25, 2017
c72247a
Don't throwback a step if tax fails
brent-hoover May 25, 2017
0d069d7
Make this more of an "exception" flag
brent-hoover May 26, 2017
c1c4b3f
Adding the license description with link on README (#2365)
rafaelstz May 30, 2017
df6739d
added Nigerian Naira to currency list in (#2366)
casoetan May 31, 2017
5b446c7
CollectionFS cfs:tempstore and cfs:worker to fix concurrency issues …
lcampanis Jun 4, 2017
eef7f18
Correct the way we record tax overrides
brent-hoover Jun 5, 2017
9cfe6e8
[WIP] Meteor 1.5 (#2371)
Jun 7, 2017
6d88f3c
Declare variable (#2401)
brent-hoover Jun 8, 2017
133e764
Implement missing router functions (#2393)
mikemurray Jun 8, 2017
ea5aa34
2332 Fix Improper Cart Merge (#2387)
abdulsemiu-atanda Jun 8, 2017
278756a
Change line width to match GH PR review width (#2407)
brent-hoover Jun 8, 2017
bcd7d1d
Orders updates (#2400)
kieckhafer Jun 8, 2017
f3ca0d4
use route permissions in register.js files (#2388)
Jun 8, 2017
1e4d7fc
Milestone 54 / Convert Navbar to React (#2306)
brent-hoover Jun 8, 2017
6e45ad6
Merge branch 'development' into brent-fix-issue-2104
brent-hoover Jun 8, 2017
a0b44da
import order
kieckhafer Jun 8, 2017
d202a0a
Merge pull request #2162 from reactioncommerce/brent-fix-issue-2104
kieckhafer Jun 8, 2017
18d45a2
remove duplicate babel preset packages
jshimko Jun 9, 2017
42ffc56
Merge pull request #2415 from reactioncommerce/fix-duplicate-packages
kieckhafer Jun 9, 2017
73274c9
Updated yarn.lock and removed npm-shrinkwrap.json
Jun 9, 2017
da41bc0
Admin should be able to invite a user with the same name (#2386)
Jun 12, 2017
754e66b
Merge branch 'master' into development
Jun 12, 2017
c8409ff
Update version
Jun 13, 2017
9858361
switch to Reaction’s new fork of Nodemailer (#2427)
jshimko Jun 13, 2017
4512d75
Added module aliases (#2436)
mikemurray Jun 15, 2017
352c98d
LingoHub Update :rocket: (#2420)
Jun 16, 2017
43e0a60
Add css style to differentiate read from unread notifications (#2442)
Jun 16, 2017
b2b8e7f
Remove acceptance tests (#2430)
brent-hoover Jun 16, 2017
5d0fc79
Fixed console error when dragging product images (#2443)
rhenshaw56 Jun 16, 2017
9a623be
finished up the popover
Jun 16, 2017
e4bade3
Add closeOnClick option to DropDownMenu component (#2418)
spencern Jun 16, 2017
6d50cea
add missing "orders not found" text (#2424)
kieckhafer Jun 17, 2017
c5ee98a
Merge branch 'development' into Release-1.3.0
Jun 17, 2017
f7aa04b
Updated chai package
Jun 17, 2017
4efb14e
Merge branch 'Release-1.3.0' into development
Jun 17, 2017
dd0a77b
Bunyan and Loggly updates (#2425)
jshimko Jun 19, 2017
b64ee84
refactor default admin user creation (#2453)
jshimko Jun 19, 2017
72d1ad3
update memory usage in CircleCI build (#2462)
jshimko Jun 19, 2017
18778df
finished implementing design
Jun 19, 2017
25e8942
Navbar hover issue (#2451)
rhenshaw56 Jun 20, 2017
cea9557
set css property overflow on horizontal to hidden (#2458)
rhenshaw56 Jun 20, 2017
1d0fd64
[WIP] 2452 fix on UI icon toolbar (#2460)
rhenshaw56 Jun 20, 2017
1a6a8f3
[WIP] 2356 fix on tag menu-sidebar glitch (#2472)
rhenshaw56 Jun 20, 2017
d3e7da5
format price string for invoice details
Jun 20, 2017
b59263b
update media gallery new / deleted image indicators (#2469)
kieckhafer Jun 20, 2017
c9a0b28
Remove random regex checks on names. Fixes #2461 (#2471)
brent-hoover Jun 20, 2017
670ee6b
remove older Blaze based launchdock plugin (#2467)
jshimko Jun 20, 2017
e87ea72
2459 router range error fix (#2476)
prosf Jun 20, 2017
c737ac9
2422 Fix on email invite link leading to blank screen (#2437)
rhenshaw56 Jun 21, 2017
c27f70e
Update current user's name on Navbar and profile page when address is…
Jun 21, 2017
0b97a00
add invoice actions
Jun 21, 2017
3144dc3
Updated dependencies (#2463)
Jun 21, 2017
3f252fe
Revert minifier to abernix fork (#2486)
jshimko Jun 22, 2017
543ddc0
Fix error when inviting already invited user (#2433)
Jun 22, 2017
6c60ea1
Merge branch 'development' of github.com:reactioncommerce/reaction in…
Jun 22, 2017
1e11e68
Merge branch 'marketplace' of github.com:reactioncommerce/reaction in…
Jun 22, 2017
bef35d9
finish order line item popover functionality
Jun 27, 2017
a6c941b
Merge branch 'marketplace' of github.com:reactioncommerce/reaction in…
Jun 27, 2017
50c75f1
allow only users with the orders and dashboard/orders permission to v…
Jun 29, 2017
9ba4187
New branch for orders refund
joykare Jul 21, 2017
8555f11
Add checkbox functionality
joykare Jul 21, 2017
62b040c
Checkbox changes
joykare Jul 21, 2017
5b5b38a
Prgress on UI
joykare Jul 24, 2017
a69f152
Add in permissions
joykare Jul 24, 2017
58fee6d
Refactor and remove redundant code
joykare Jul 24, 2017
3ad51f4
Add line invoice
joykare Jul 24, 2017
9d68fe6
Actual invoice summary passed in
joykare Jul 24, 2017
eef7b45
Refactor code
joykare Jul 24, 2017
8dd458b
Design iteration
joykare Jul 25, 2017
1df9c09
Rewrite numberTypeComponent
joykare Jul 28, 2017
aa97091
Fix numeric Component
joykare Jul 31, 2017
b1daa00
Refactor number component
joykare Jul 31, 2017
bcccf44
Fix refunds
joykare Aug 1, 2017
9b0f9d9
Modify refund/createMethod
joykare Aug 1, 2017
fcbafdd
Use /refunds/returnItems
joykare Aug 2, 2017
f36edc8
Add background color
joykare Aug 3, 2017
c097696
Styling iteration
joykare Aug 3, 2017
e5e69fa
Pixels right
joykare Aug 3, 2017
c2af01f
Move everything to inherit from invoice container
joykare Aug 3, 2017
b86d9c8
Fix approve button
joykare Aug 3, 2017
9a13ffb
Convert invoice form to react
joykare Aug 3, 2017
02ae4f4
Completely functioningon the orders workflow
joykare Aug 4, 2017
4511fe7
Add disabling buttons
joykare Aug 6, 2017
e92bcc9
Capture transactions when returning line item
joykare Aug 7, 2017
4f3ffdf
Add refunds lists on return items
joykare Aug 7, 2017
ff74ac9
Change canMakeAdjustments to include status partial refuns
joykare Aug 7, 2017
0ccc35a
Massive refactor
joykare Aug 7, 2017
11f6a8a
Add all line items on select
joykare Aug 7, 2017
7daaa98
Add all items in all rows when selectAll is true
joykare Aug 7, 2017
035d268
Select process change
joykare Aug 10, 2017
4b49dfe
Refund/return name change
joykare Aug 14, 2017
321591e
Merge Marketplace
joykare Aug 14, 2017
b039f87
Fix lint error
joykare Aug 14, 2017
b9b125c
Code updates
joykare Aug 14, 2017
4ef6aa5
i18n keys addition
joykare Aug 14, 2017
9c0e11d
Merge branch 'marketplace' into joykare-orders-line-items-refund
joykare Aug 15, 2017
e2af30a
Use alerts to stagger calls instead of having several meteor calls in…
joykare Aug 17, 2017
e42637e
Add tests for orders method
joykare Aug 17, 2017
6871a61
Remove describe.only in tests
joykare Aug 17, 2017
cf8bf8c
Checkbox changes on select/deselect
joykare Aug 17, 2017
3a6acea
Fix spacing and checking capability
joykare Aug 17, 2017
5c365c0
Row resize
joykare Aug 17, 2017
fd0ab82
Correct subTotal display
joykare Aug 17, 2017
3e38ac9
Compare against an array of values
joykare Aug 18, 2017
5f9207e
Fix tax display
joykare Aug 18, 2017
e409f40
Add 118n translations for alerts
joykare Aug 18, 2017
d282b4a
Merge branch 'marketplace' into joykare-orders-line-items-refund
joykare Aug 18, 2017
b7c27d5
Remove file accidentally added
joykare Aug 18, 2017
0c16338
Merge branch 'marketplace' into joykare-orders-line-items-refund
joykare Aug 29, 2017
2c1bdf5
Color change during merge
joykare Aug 29, 2017
463531f
Static columns
joykare Aug 29, 2017
bc1f6bb
Fix Braintree refund message issue
joykare Aug 29, 2017
f4abdde
Clear refunds on cancel or close
joykare Aug 29, 2017
cb7d31c
Remove [0]th billing indices on files changed
joykare Aug 29, 2017
2ce6218
Refunds working correctly
joykare Aug 30, 2017
5f4f063
Clean up code remove logs
joykare Aug 30, 2017
a037809
Add price format on modals
joykare Aug 30, 2017
9caee44
Code refactor
joykare Aug 30, 2017
adcfcd0
Merge branch 'marketplace' into joykare-orders-line-items-refund
joykare Aug 30, 2017
b95b7c3
Have for refund screen not show when no returns
joykare Aug 31, 2017
64f2db4
Remove checkmark from ui for the meantime
joykare Aug 31, 2017
58c1079
Center quantity in relation to items
joykare Aug 31, 2017
753fd6d
Fix authnet issue
joykare Aug 31, 2017
a86de17
Fix scrollable issue
joykare Aug 31, 2017
ab1038d
Tax display
joykare Sep 1, 2017
7ce7322
Add proptypes for orders object
joykare Sep 1, 2017
7f1cf7d
Merge branch 'marketplace' into joykare-orders-line-items-refund
joykare Sep 1, 2017
df312d3
Fix lint error
joykare Sep 1, 2017
8619af4
Add comment
joykare Sep 1, 2017
194a7a8
Remove include shipping capabilty
joykare Sep 1, 2017
182d896
Remove Shipping info on line item invoice
joykare Sep 1, 2017
86fa03b
Have long list of refunds not overflow
joykare Sep 5, 2017
744d2bc
Add missing i18next
joykare Sep 5, 2017
94457d8
Add jsdoc
joykare Sep 5, 2017
6911414
Fixes around code comments
joykare Sep 5, 2017
e40afb0
Replace old component calls to use reactioncommerce/reaction-components
joykare Sep 5, 2017
90aa8a4
Add i18n translation for order wait
joykare Sep 5, 2017
296d218
add error.error incase error.reason is empty
joykare Sep 6, 2017
c887b7d
fix linting
joykare Sep 6, 2017
f2d60c9
Rename from refunds to returns
joykare Sep 6, 2017
ab007ef
Add TODOs around email
joykare Sep 6, 2017
835ecc2
Change return terminology to refund
joykare Sep 6, 2017
6a01e84
Refund email revamp
joykare Sep 6, 2017
229f82d
Remove email todo
joykare Sep 6, 2017
bb9cacb
Rename test methods to refunds
joykare Sep 6, 2017
272c70b
Merge branch 'marketplace' into joykare-orders-line-items-refund
Sep 6, 2017
89fa5b1
Merge branch 'marketplace' into joykare-orders-line-items-refund
joykare Sep 6, 2017
6494f1c
Change terms from "return" to "refund" where they still exist
spencern Sep 6, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 41 additions & 12 deletions imports/plugins/core/orders/client/components/invoice.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import moment from "moment";
import { formatPriceString } from "/client/api";
import { Translation } from "/imports/plugins/core/ui/client/components";
import DiscountList from "/imports/plugins/core/discounts/client/components/list";
import { Translation, CardGroup, Card, CardBody, CardHeader, DiscountList } from "@reactioncommerce/reaction-ui";
import LineItems from "./lineItems";
import InvoiceActions from "./invoiceActions";

class Invoice extends Component {
Copy link
Collaborator

Choose a reason for hiding this comment

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

static propTypes = {
canMakeAdjustments: PropTypes.bool,
collection: PropTypes.string,
dateFormat: PropTypes.func,
discounts: PropTypes.bool,
handleClick: PropTypes.func,
hasRefundingEnabled: PropTypes.bool,
invoice: PropTypes.object,
isFetching: PropTypes.bool,
isOpen: PropTypes.bool,
orderId: PropTypes.string,
order: PropTypes.object,
paymentCaptured: PropTypes.bool,
refunds: PropTypes.array
}

dateFormat(context, block) {
const f = block || "MMM DD, YYYY hh:mm:ss A";
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's not use single letter variables ever

return moment(context).format(f);
}

renderDiscountForm() {
const { isOpen, orderId, collection } = this.props;
const { isOpen, order } = this.props;

return (
<div>
{isOpen &&
<div>
<hr/>
<DiscountList
id={orderId}
collection={collection}
id={order._id}
collection="Orders"
validatedInput={true}
/>
<hr/>
Expand All @@ -41,7 +46,7 @@ class Invoice extends Component {
}

renderRefundsInfo() {
const { hasRefundingEnabled, isFetching, refunds, dateFormat } = this.props;
const { hasRefundingEnabled, isFetching, refunds } = this.props;

return (
<div>
Expand All @@ -56,7 +61,7 @@ class Invoice extends Component {

{refunds && refunds.map((refund) => (
<div className="order-summary-form-group text-danger" key={refund.created} style={{ marginBottom: 15 }}>
<strong>Refunded on: {dateFormat(refund.created, "MM/D/YYYY")}</strong>
<strong>Refunded on: {this.dateFormat(refund.created, "MM/D/YYYY")}</strong>
<div className="invoice-details"><strong>{formatPriceString(refund.amount)}</strong></div>
</div>
))}
Expand All @@ -80,7 +85,6 @@ class Invoice extends Component {

renderConditionalDisplay() {
const { canMakeAdjustments, paymentCaptured } = this.props;

return (
<div>
{canMakeAdjustments ?
Expand All @@ -99,7 +103,7 @@ class Invoice extends Component {
);
}

render() {
renderInvoice() {
const { invoice, discounts, handleClick } = this.props;

return (
Expand Down Expand Up @@ -148,6 +152,31 @@ class Invoice extends Component {
</div>
);
}

render() {
return (
<CardGroup>
<Card
expanded={true}
>
<CardHeader
actAsExpander={false}
i18nKeyTitle="admin.orderWorkflow.invoice.cardTitle"
title="Invoice"
/>
<CardBody expandable={false}>
<LineItems {...this.props} />

<div className="invoice-container">
{this.renderInvoice()}
</div>

<InvoiceActions {...this.props}/>
</CardBody>
</Card>
</CardGroup>
);
}
}

export default Invoice;
193 changes: 161 additions & 32 deletions imports/plugins/core/orders/client/components/invoiceActions.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import { formatPriceString } from "/client/api";
import { IconButton, NumericInput, Translation } from "/imports/plugins/core/ui/client/components";
import { Button, NumericInput, Translation, ButtonSelect } from "@reactioncommerce/reaction-ui";

class InvoiceActions extends Component {
static propTypes = {
adjustedTotal: PropTypes.number,
handleActionViewBack: PropTypes.func,
currency: PropTypes.object,
handleApprove: PropTypes.func,
handleCapturePayment: PropTypes.func,
handleRefund: PropTypes.func,
hasRefundingEnabled: PropTypes.bool,
invoice: PropTypes.object,
isAdjusted: PropTypes.func
isCapturing: PropTypes.bool,
isRefunding: PropTypes.bool,
paymentApproved: PropTypes.bool,
paymentCaptured: PropTypes.bool,
paymentPendingApproval: PropTypes.bool,
printOrder: PropTypes.string,
showAfterPaymentCaptured: PropTypes.bool
}

state = {
value: 0
}

renderCapturedTotal() {
Expand Down Expand Up @@ -42,46 +56,161 @@ class InvoiceActions extends Component {
</div>
);
}

renderRefundForm() {
const { adjustedTotal } = this.props;

return (
<div className="invoice-summary">
<span className="invoice-label refund">
<strong><Translation defaultValue="Refund" i18nKey="admin.invoice.refund"/></strong>
</span>
<div>
{this.props.hasRefundingEnabled &&
<div className="flex refund-container">
<div className="form-group order-summary-form-group">
<div className="invoice-details">
<NumericInput
numericType="currency"
value={this.state.value}
maxValue={adjustedTotal}
format={this.props.currency}
classNames={{
input: {
amount: true
}
}}
onChange={(event, data)=>{
this.setState({
value: data.numberValue
});
}}
/>
</div>

<div className="invoice-details">
<span className="refundAmount">
<NumericInput
numericType="currency"
value="0"
maxValue={adjustedTotal}
classNames="amount"
/>
</span>
<span className="refundSubmit">
<IconButton
bezelStyle={"flat"}
icon="fa fa-arrow-circle-o-right"
onClick={this.props.handleActionViewBack}
/>
<span id="btn-refund-payment">-></span>
</span>
</div>
</div>

<Button
className="flex-item-fill refund-button"
type="button"
status="primary"
bezelStyle="solid"
disabled={this.props.isRefunding || this.state.value === 0}
onClick={(event) => {
this.props.handleRefund(event, this.state.value);
this.setState({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason to do this here rather than in the handleRefund function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, coz the value on the refund input box is being set by the onChange function on this component instead of having the value change propagated from the parent component I have the value set in the same component.

In short yes there is a reason.
--> Easier
--> Have a central point where changes occur

value: 0
});
}}
>
{this.props.isRefunding ?
<span id="btn-refund-payment" data-i18n="order.applyRefund">Refunding <i className="fa fa-spinner fa-spin" /></span> :
<span id="btn-refund-payment" data-i18n="order.applyRefund">Apply Refund</span>
}
</Button>
</div>
}

{this.props.showAfterPaymentCaptured &&
<Button
className="btn btn-danger"
bezelStyle="solid"
type="button"
data-event-action="cancelOrder"
style={{ marginBottom: 10 }}
data-i18n="order.cancelOrderLabel"
>
Cancel Order
</Button>
}

<a
className="btn btn-default btn-block"
href={this.props.printOrder}
target="_blank"
data-i18n="app.printInvoice"
>
Print Invoice
</a>
</div>
);
}

render() {
const { isAdjusted } = this.props;
renderApproval() {
if (this.props.paymentPendingApproval) {
return (
<div className="btn-block">
<div>
<ButtonSelect
buttons= {[
{
name: "Approve",
i18nKeyLabel: "order.approveInvoice",
active: true,
status: "success",
eventAction: "approveInvoice",
bgColor: "bg-success",
buttonType: "submit"
}, {
name: "Cancel",
i18nKeyLabel: "order.cancelInvoice",
active: false,
status: "danger",
eventAction: "cancelOrder",
bgColor: "bg-danger",
buttonType: "button"
}
]}
/>
</div>
</div>
);
}

if (this.props.paymentApproved) {
return (
<div className="flex">
<a
className="btn btn-link"
href={this.props.printOrder}
target="_blank"
data-i18n="app.print"
>
Print
</a>

<button
className="btn btn-success flex-item-fill"
type="button"
data-event-action="capturePayment"
disabled={this.props.isCapturing}
onClick = {this.props.handleCapturePayment}
>

{this.props.isCapturing ?
<span id="btn-capture-payment">
Capturing <i className="fa fa-spinner fa-spin" id="btn-processing" />
</span> :
<span id="btn-capture-payment" data-i18n="order.capturePayment">Capture Payment</span>
}
</button>
</div>
);
}
}

render() {
return (
<div>
{this.renderCapturedTotal()}
{isAdjusted() && this.renderAdjustedTotal()}
{/* {this.renderRefundForm()} */}
</div>
<form onSubmit={this.props.handleApprove}>

<div style={{ marginBottom: 15, marginTop: 15 }}>
{this.renderApproval()}
{this.props.paymentCaptured &&
<div className="total-container">
{this.renderCapturedTotal()}
{this.props.invoice.total !== this.props.adjustedTotal && this.renderAdjustedTotal()}
{this.renderRefundForm()}
</div>
}
</div>
</form>

);
}
}
Expand Down
Loading