1(function (d) { 2 const shop2YaPay = window.shop2YaPay = { 3 extend: function (a, b) { 4 for (var key in b) 5 if (b.hasOwnProperty(key)) { 6 a[key] = b[key]; 7 } 8 9 return a; 10 }, 11 init: function (settings) { 12 this.extend(this, settings); 13 14 if (this.merchantId && this.pluginUrl) { 15 const plugin = d.createElement('script'); 16 plugin.async = true; 17 plugin.src = settings.pluginUrl; 18 plugin.onload = this.onYaPayLoad.bind(this); 19 20 document.body.append(plugin); 21 } 22 }, 23 onYaPayLoad: function () { 24 const YaPay = window.YaPay; 25 26 const paymentData = { 27 env: YaPay.PaymentEnv.Production, 28 version: 4, 29 currencyCode: YaPay.CurrencyCode.Rub, 30 merchantId: this.merchantId, 31 totalAmount: this.totalAmount, 32 availablePaymentMethods: this.availablePaymentMethods, 33 }; 34 35 YaPay.createSession(paymentData, { 36 onPayButtonClick: async function () { 37 const response = await fetch(shop2YaPay.apiUrl); 38 if (response.ok) { 39 const data = await response.json(); 40 return data.result.payment_link; 41 } 42 }, 43 }) 44 .then(function (paymentSession) { 45 paymentSession.mountButton( 46 d.querySelector(shop2YaPay.buttonSelector), 47 { 48 type: YaPay.ButtonType.Pay, 49 theme: YaPay.ButtonTheme[shop2YaPay.buttonTheme], 50 width: YaPay.ButtonWidth.Auto, 51 } 52 ); 53 54 paymentSession.mountWidget( 55 d.querySelector(shop2YaPay.widgetSelector), 56 { 57 widgetType: YaPay.WidgetType[shop2YaPay.widgetTheme] ?? YaPay.WidgetType.Ultimate, 58 widgetTheme: YaPay.WidgetTheme[shop2YaPay.widgetVariant] ?? YaPay.WidgetTheme.Light, 59 buttonTheme: YaPay.ButtonTheme[shop2YaPay.buttonTheme], 60 widgetSize: YaPay.WidgetSize[shop2YaPay.widgetSize], 61 widgetBackground: YaPay.WidgetBackgroundType[shop2YaPay.widgetBackgroundType], 62 padding: YaPay.WidgetPaddingType[shop2YaPay.padding], 63 withOutline: shop2YaPay.withOutline, 64 borderRadius: shop2YaPay.borderRadius, 65 } 66 ); 67 }); 68 } 69 } 70})(document)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.