client/state/purchases/reducer.js
function overwriteExistingPurchases( existingPurchases, newPurchases ) {
	let purchases = newPurchases;

	existingPurchases.forEach( purchase => {
		if ( ! find( purchases, { ID: purchase.ID } ) ) {
			purchases = purchases.concat( purchase );
		}
	} );

	return purchases;
}
function overwriteExistingPurchases( existingPurchases, newPurchases ) {
	let purchases = newPurchases;

	existingPurchases.forEach( purchase => {
		if ( ! find( purchases, { ID: purchase.ID } ) ) {
			purchases = purchases.concat( purchase );
		}
	} );

	return purchases;
}
Overwrites the purchases in the store with the purchases from the new purchases array
that share the same `id` value.

@param {array} existingPurchases - an array of purchases in the store
@param {array} newPurchases - an array of purchases fetched from the API
@return {array} An array of purchases