https://pastein.ru/t/Vd

  скопируйте уникальную ссылку для отправки


// ==UserScript==
// @name         Aliexpress automatic payment
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Andronio
// @match        https://trade.aliexpress.ru/orderList.htm*
// @match        https://trade.aliexpress.com/orderList.htm*
// @match        https://trade.aliexpress.ru/order_list.htm*
// @match        https://trade.aliexpress.com/order_list.htm*
// @match        https://shoppingcart.aliexpress.ru/order/secondPayment.htm*
// @match        https://shoppingcart.aliexpress.com/order/secondPayment.htm*
// @grant        none
// ==/UserScript==

let mymoney = 'WebMoney';
//let mymoney = 'Яндекс.Деньги';

(async function() {
    'use strict';
    let href = location.href;
    if (href.search("trade.aliexpress.ru/orderList.htm") >= 0 ||
        href.search("trade.aliexpress.ru/order_list.htm") >= 0) {
        let buttonPay = document.querySelectorAll(".button-pay");
        if (buttonPay.length > 0) {
            location.href = "https://trade.aliexpress.com/orderList.htm";
            return;
        }
    }
    if (href.search("shoppingcart.aliexpress.ru/order/secondPayment.htm") >= 0 ||
        href.search("shoppingcart.aliexpress.com/order/secondPayment.htm") >= 0)
           wmPaySelect();
    else {
// currentMode - хранит текущий шаг последовательности оплаты
        let currentMode = sessionStorage.getItem('currentMode');
        if (!currentMode) {

// Первый проход
            let buttonPay = document.querySelectorAll(".button-pay");
            if (buttonPay.length > 0) {
                let combinPay = document.getElementById("TP_CombinPay");
                if (!combinPay) {
    // Кнопка оплатить все
                    let button = document.createElement("button");
                    button.id = "allPay";
                    button.className = "ui-button ui-button-primary combine-pay-button";
                    button.innerText = "Оплатить все";
                    document.getElementById("simple-pager").before(button);
                    button.addEventListener("click", function(){
                        sessionStorage.setItem('currentMode', 'payAll_step1');
                        document.getElementById("remiandTips_waitBuyerPayment").click();
                    });
                }
            }
        } else {
            document.getElementById("cb").click();   // Выбрать все заказы
            await sleep(100);
            document.getElementById("TP_CombinPay").click();          // Нажать кнопку оплатить
            sessionStorage.removeItem('currentMode');
        }
    }

})();


async function wmPaySelect() {
    // Ждем выбор эл. денег
{
            setTimeout(repeat, 500);
        } 
    try {
        await waitForElement(".title-to-detail", 150);
    } catch {
        return alert("Не найден элемент 1");
    }
    document.querySelector(".title-to-detail").click();
// Ждем появления вебманей
{
            setTimeout(repeat, 500);
        } 
    try {
        await waitForElement(".payment-opt", 150);
    } catch {
        return alert("Не найден элемент 2");
    }
// Выбираем вебмани
    let money = document.querySelectorAll(".opt-title");
    let found = false;
    for (let el of money) {
        if (el.innerText == mymoney) {
            money = el;
            found = true;
            break;
        }
    }
    if (found)
        money.click();
{
            setTimeout(repeat, 500);
        } 
    else return alert("Не нашел " + mymoney + " 3");
// Только для ЯД нажать кошелек
if (mymoney == 'Яндекс.Деньги') {
        try {
            await waitForElement(".sub-payment-opt-item", 150);
        } catch {
            return alert("Не найден элемент 4");
        }
        let wallet = document.querySelectorAll(".sub-payment-opt-item");
        if (wallet) wallet[0].click();
        else return alert("Не нашел " + mymoney + " 5");
    }
    try {
        await waitForDisableElement(".spinner-container", 150);
    } catch {
        return alert("Не прошел ожидание 7");
    }
    document.querySelector(".next-btn-primary").click();
}

function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

// Функция ждет элемент elem, таймаут timeout
async function waitForElement(elem, timeout) {
    while(!document.querySelector(elem) && --timeout > 0) {
        await sleep(100);
    }
    let el = document.querySelector(elem);
    if (el) return Promise.resolve(el);
        else return Promise.reject();
}

async function waitInnerText(elem, text, timeout)
{
    let el;
    do {
        el = document.querySelector(elem);
        if (el.innerText == text) break;
    } while(--timeout > 0);
    if (el.innerText == text) Promise.resolve(el);
        else return Promise.reject();
}

// Функция для фрейма ждет элемент elem, таймаут timeout
async function waitForDisableElement(elem, timeout) {
    while(document.querySelector(elem) && --timeout > 0) {
        await sleep(100);
    }
    let el = document.querySelector(elem);
    if (!el) return Promise.resolve(true);
        else return Promise.reject();
}