GIVING A NOCHRI WORK TO DO CLOSE TO SHABBOS [Shabbos : Meleches Nochri]
Gemara
(Mishnah - Beis Shamai): One may not give hides to a [Nochri] tanner, or garments to a launderer unless there is enough time [to tan or launder them] before Shabbos;
Beis Hillel permit anytime before the sun [sets].
R. Shimon ben Gamliel: My father's house used to give white garments (which are hard to launder) to a Nochri launderer three days before Shabbos.
Similarly, one may not send letters with a Nochri on Erev Shabbos. On Wednesday or Thursday, it is permitted.
Nothing written by R. Yosi ha'Kohen was ever given to a Nochri.
19a (Beraisa): One may not send letters with a Nochri on Erev Shabbos unless they agreed on the price.
Beis Shamai permit only if he can reach the destination before Shabbos;
Beis Hillel permit if he can reach the first house in the city of the receiver.
Question: Since they agreed on the price, they should permit in any case!
Answer (Rav Sheshes): It means that if they did not agree on the price, Beis Shamai permit only if he can reach the destination, and Beis Hillel permit if he can reach the first house in the city.
Rishonim
Rambam (Hilchos Shabbos 6:12): One may stipulate with a Nochri about Melachah and fix a price, and the Nochri works for himself. Even though he works on Shabbos, it is permitted.
Magid Mishneh: Even Beis Shamai forbid only when time does not remain in the day to finish the task before Shabbos. It is as if he tells him to do it on Shabbos. The Rambam learns from letters that it is permitted only if he fixed a price.
Rosh (1:36): Beis Hillel permit giving hides to a tanner just before dark, because the Nochri works for himself, since they fixed a price. That is when the Yisrael does not profit through the Nochri's work on Shabbos. If a Nochri will rent a Yisrael's Kelim to others on Shabbos, the Yisrael profits, and the Nochri looks like the Yisrael's Shali'ach. This is why one may not send letters with a Nochri on Erev Shabbos, for he looks like his Shali'ach. Only on Erev Shabbos, it looks like he sends him to take it tomorrow. If he sends him earlier, he does not look like his Shali'ach to work on Shabbos. It is permitted on Wednesday or Thursday even if he did not fix a price, and similarly regarding giving hides to a tanner and garments to a launderer.
Ran (7a DH uv'Kulan): Tosfos says that Beis Hillel permit only when he fixed a price, like the Gemara says regarding letters. The Gemara asked "since they agreed on the price, they should permit in any case!" Rashi explains that we ask according to Beis Hillel. Fixed a price permits only when the Nochri works on Kelim in his own house. It is not recognized that they are the Yisrael's. Fixed a price does not help for building on the Yisrael's land inside the Techum, like it says in Mo'ed Katan (12a). I say that whenever he fixed a price, it is permitted even if the Nochri works on Shabbos, and the Yisrael may wear the garment that same Shabbos. This is unlike a Nochri who lit a lamp for a Yisrael. Then, one may not benefit from it (122a). There, he did so for the sake of a Yisrael. Whenever they fixed a price, the Nochri works for himself, so the Yisrael may benefit on Shabbos.
Poskim
Shulchan Aruch (OC 252:2): One may give garments to a Nochri launderer, or skins to a tanner close to dark [on Erev Shabbos] if they agreed on the price or he does it for Tovas Hana'ah. This is only if he does not tell him to work on Shabbos, and the Nochri works in his house.
Beis Yosef (DH u'Mah): Tosfos, the Rosh, Ran and Rambam permit only when they fixed a price. This is unlike the Mordechai, who wrote in the name of Tosfos that presumably, giving a garment to a launderer or a hide to a tanner is like a fixed price, for he does not work for free. Fixing a price is needed, for when he did not fix a price, he looks like the Yisrael's Shali'ach. When they fixed a price, the Nochri works for himself, in order to get his wage. Even fixing a price helps only when the Nochri works by himself, but one may not tell him to work on Shabbos. Many say like this.
Magen Avraham (6): It seems that nowadays, Stam giving garments to a launderer is like a fixed price, because the price is known. They do not fix a price each time! Therefore, the custom is to give close to dark.
Magen Avraham (7): If he expects to be paid but they did not stipulate, it is forbidden, for he works for the sake of the Yisrael.
Mishnah Berurah (12): Since he fixed a price and he is not adamant to finish immediately, the Nochri works for himself in order to finish his work.
Mishnah Berurah (13): Also, the Nochri must leave the Yisrael's house during the day.
Mishnah Berurah (14): In 247:2, we say that if he stipulated to compromise with him afterwards about the price, even though he did not specify how much, it is as if he fixed a price.
Mishnah Berurah (15): If the Nochri agreed to do it for free, presumably it is due to some favor that the Yisrael did for him, therefore he works for himself.
Rema: If he did not fix a price, it is forbidden on Erev Shabbos. See above 247:4, that some disagree if he works for free, i.e. Tovas Hana'ah.
Magen Avraham (8): This connotes that on Wednesday and Thursday, it is permitted even if it he could not finish before Shabbos. The Beis Yosef (Siman 247) forbids even on Wednesday and Thursday. The Rema is stringent there if there is not a need, i.e. regarding sending letters. It is as if the one who sends commands "go every day, even on Shabbos." If a worker takes Kelim to his house, for Kablanus (a fixed a price for the job), even Beis Shamai permit if not for Shelichus, lest he not find the owner in his house and he will pursue him.
Gra (DH Asur): This is like the Rema holds that (247:1), that even if he did not fix a price, it is forbidden only on Erev Shabbos. The Mechaber always forbids when he did not fix a price.
Mishnah Berurah (18): This is when he did not explicitly promise to pay him, and the Nochri expects to be paid. Then we do not say that he works for himself.
Mishnah Berurah (19): All permit even on Erev Shabbos if there is time to finish before Shabbos, even if did not fix a price. The Rema permits on Wednesday or Thursday even if there is not time to finish before Shabbos, since he did not command to work on Shabbos.
Mishnah Berurah (20): The Rema (in Darchei Moshe) agrees with this opinion.
Mishnah Berurah (21): If the Nochri initially offered to do it for free, surely it is due to a favor that he received, so it is as if he fixed a price.
Shulchan Aruch (ibid.): If he sees him doing the work on Shabbos, if it was b'Tovas Hana'ah, he must tell him not to do it on Shabbos.
Beis Yosef (DH v'Chasuv): The Roke'ach brings from the Yerushalmi that if one gave garments to a launderer and saw him working on them on Shabbos, he must protest, unless they fixed a price. The Yerushalmi says "if one gave garments to a launderer and saw him working on them on Shabbos, it is forbidden. R. Yudan says, he should tell him not to work. R. Yudan the father of R. Matanyah says, this applies to Tovas Hana'ah. If he was hired, he works for himself." The Mordechai brought this. However, why did the Roke'ach say "unless he fixed a price"? This implies that even if he works for pay, he must protest! Perhaps he means "unless he works for wages and fixed a price."
Magen Avraham (9): The Beis Yosef and Bach say that if he was doing so for wages, even if they did not fix a price, he need not protest. This requires investigation. When he works for pay and they did not fix a price, this is worse than for free, for he may not give to him [so all the more so he must protest]!
Kaf ha'Chayim (28): Tosefes Shabbos says that the Beis Yosef and Bach mean that he stipulated to pay the Nochri, but did not specify how much.
Machatzis ha'Shekel: The Magen Avraham rejected this, for if so, about what does the Beis Yosef disagree with the Roke'ach?!
Eshel Avraham: The text of the Beis Yosef should say "he works for pay and they did fixed a price."
Magen Avraham (9): I say that the Roke'ach is correct. Only if they fixed a price, we need not protest. Also the Yerushalmi discusses when they fixed a price. If not, one may not give to him at all. All the more so one must protest [if he sees him working on Shabbos]! This is when he gave garments to a launderer or similar cases. If one commands a Nochri to make shoes, and he sees him working on Shabbos, he need not protest, for it is not yet called on the Yisrael's name. The Nochri can sell it to someone else if he wants and make others for the Yisrael. The Mordechai says that he works for himself applies to only when the Nochri works b'Shelo (with(in) his property). If he must take trees of a Yisrael, he needs the owner's permission. If the owner sees and is silent, he does for the sake of the owner, so one must protest.
Gra (DH v'Im, according to Damesek Eliezer): The Beis Yosef learned from the Yerushalmi that Tovas Hana'ah is permitted [just like when he fixed a price] unless he sees him working on Shabbos. (Only then it is worse than a fixed price, and he must protest.) This proof is according to the Beis Yosef, who always forbids without fixed a price. According to the Rema (who permits on Wednesday or Thursday even without fixed a price), we can say that [Tovas Hana'ah is like without a fixed price, and] he gave it on Wednesday or Thursday. The Rema said "even if he gave..." to explain how the Mechaber's law applies to those who argue about Tovas Hana'ah [for even they forbid only on Erev Shabbos].
Mishnah Berurah (22): If he promised a wage, even if he did not set an amount, he need not protest, for the Nochri works for himself.
Kaf ha'Chayim (27): If the Nochri is a Kablan, one need not protest. If he is paid by the day, one must protest even if the Nochri works in private in his house on Shabbos.
Rema: This is even if he gave it several days before Shabbos.