Changeset 3298867
- Timestamp:
- 05/22/2025 02:40:26 PM (11 months ago)
- Location:
- audienceplayer
- Files:
-
- 32 edited
- 1 copied
-
tags/6.0.0 (copied) (copied from audienceplayer/trunk)
-
tags/6.0.0/audienceplayer.php (modified) (1 diff)
-
tags/6.0.0/composer.lock (modified) (3 diffs)
-
tags/6.0.0/languages/audienceplayer-wordpress-plugin.pot (modified) (1 diff)
-
tags/6.0.0/readme.txt (modified) (2 diffs)
-
tags/6.0.0/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php (modified) (1 diff)
-
tags/6.0.0/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Config/Constants.php (modified) (1 diff)
-
tags/6.0.0/static/html/admin_help_release_notes.html (modified) (1 diff)
-
tags/6.0.0/templates/audienceplayer-shortcode-purchase-product-button.php (modified) (2 diffs)
-
tags/6.0.0/templates/audienceplayer-shortcode-purchase-subscriptions.php (modified) (1 diff)
-
tags/6.0.0/templates/audienceplayer-shortcode-user-account.php (modified) (4 diffs)
-
tags/6.0.0/templates/js/audienceplayer-core.js (modified) (17 diffs)
-
tags/6.0.0/vendor/autoload.php (modified) (1 diff)
-
tags/6.0.0/vendor/composer/InstalledVersions.php (modified) (5 diffs)
-
tags/6.0.0/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/6.0.0/vendor/composer/autoload_static.php (modified) (2 diffs)
-
tags/6.0.0/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/audienceplayer.php (modified) (1 diff)
-
trunk/composer.lock (modified) (3 diffs)
-
trunk/languages/audienceplayer-wordpress-plugin.pot (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php (modified) (1 diff)
-
trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Config/Constants.php (modified) (1 diff)
-
trunk/static/html/admin_help_release_notes.html (modified) (1 diff)
-
trunk/templates/audienceplayer-shortcode-purchase-product-button.php (modified) (2 diffs)
-
trunk/templates/audienceplayer-shortcode-purchase-subscriptions.php (modified) (1 diff)
-
trunk/templates/audienceplayer-shortcode-user-account.php (modified) (4 diffs)
-
trunk/templates/js/audienceplayer-core.js (modified) (17 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/InstalledVersions.php (modified) (5 diffs)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
audienceplayer/tags/6.0.0/audienceplayer.php
r3093691 r3298867 9 9 Description: AudiencePlayer integration 10 10 Author: AudiencePlayer 11 Version: 5.0.211 Version: 6.0.0 12 12 Author URI: https://www.audienceplayer.com 13 13 Text Domain: audienceplayer -
audienceplayer/tags/6.0.0/composer.lock
r3093691 r3298867 67 67 { 68 68 "name": "phpstan/phpstan", 69 "version": "1.1 1.2",69 "version": "1.12.27", 70 70 "source": { 71 71 "type": "git", 72 72 "url": "https://github.com/phpstan/phpstan.git", 73 "reference": " 0d5d4294a70deb7547db655c47685d680e39cfec"73 "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162" 74 74 }, 75 75 "dist": { 76 76 "type": "zip", 77 "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ 0d5d4294a70deb7547db655c47685d680e39cfec",78 "reference": " 0d5d4294a70deb7547db655c47685d680e39cfec",77 "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a6e423c076ab39dfedc307e2ac627ef579db162", 78 "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162", 79 79 "shasum": "" 80 80 }, … … 121 121 } 122 122 ], 123 "time": "202 4-05-24T13:23:04+00:00"123 "time": "2025-05-21T20:51:45+00:00" 124 124 } 125 125 ], 126 126 "aliases": [], 127 127 "minimum-stability": "stable", 128 "stability-flags": [],128 "stability-flags": {}, 129 129 "prefer-stable": false, 130 130 "prefer-lowest": false, … … 134 134 "ext-json": "*" 135 135 }, 136 "platform-dev": [],136 "platform-dev": {}, 137 137 "plugin-api-version": "2.6.0" 138 138 } -
audienceplayer/tags/6.0.0/languages/audienceplayer-wordpress-plugin.pot
r3093691 r3298867 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: 5.0.2\n"5 "Project-Id-Version: 6.0.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/audienceplayer\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -
audienceplayer/tags/6.0.0/readme.txt
r3093691 r3298867 1 1 === AudiencePlayer === 2 2 Contributors: audienceplayer 3 Stable tag: 5.0.24 Tested up to: 6. 53 Stable tag: 6.0.0 4 Tested up to: 6.8 5 5 Requires at least: 5.5 6 6 Requires PHP: 7.1 … … 22 22 This plugin relies on the following external AudiencePlayer libraries, via which user profile data is exchanged with the AudiencePlayer Backend: 23 23 24 1. **AudiencePlayer A pwrapper library for PHP**24 1. **AudiencePlayer API wrapper library for PHP** 25 25 * link: [https://github.com/AudiencePlayer/audienceplayer-api-client-php](https://github.com/AudiencePlayer/audienceplayer-api-client-php) 26 26 * license: [https://github.com/AudiencePlayer/audienceplayer-api-client-php/blob/master/LICENSE](https://github.com/AudiencePlayer/audienceplayer-api-client-php/blob/master/LICENSE) -
audienceplayer/tags/6.0.0/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php
r3068993 r3298867 664 664 'dialogue_user_subscription_will_switch_at_renewal' => '→ At the next renewal date, your subscription will switch to "{{ subscription_title }}"', 665 665 'dialogue_video_not_available_in_region' => 'The content is not available in your current country or region.', 666 'dialogue_voucher_code_invalid' => 'Voucher code is not valid.', 667 'dialogue_voucher_code_not_applicable' => 'Voucher code is not valid or cannot be applied on current subscription.', 668 'dialogue_voucher_code_applicable_subscription_unknown' => 'This voucher can only be applied to an already existing subscription or when purchasing a new subscription.', 666 'dialogue_voucher_code_applicable_subscription_unknown' => 'This voucher code can only be applied to an already existing subscription or when purchasing a new subscription.', 667 'dialogue_voucher_code_claim_limit_overflow' => 'The voucher code cannot not be claimed, the allowed maximum number of claims has been exceeded.', 668 'dialogue_voucher_code_invalid' => 'The voucher code is invalid.', 669 'dialogue_voucher_code_not_applicable' => 'The voucher code can only be redeemed on a new subscription or product.', 670 'dialogue_voucher_code_not_claimed' => 'The voucher code cannot not be claimed, likely it has already been used.', 671 'dialogue_voucher_code_product_intersect_not_allowed' => 'The voucher code cannot be applied to all of the selected products.', 672 'dialogue_voucher_code_product_not_allowed' => 'The voucher code cannot be claimed in combination with selected products.', 673 'dialogue_voucher_code_product_type_not_allowed' => 'The voucher code cannot be applied to the type of one or more selected products.', 674 'dialogue_voucher_code_subscription_not_allowed' => 'The voucher code cannot be claimed in combination with selected subscription.', 675 'dialogue_voucher_code_usage_not_allowed' => 'Usage of this voucher code is not allowed', 676 'dialogue_voucher_code_user_email_not_allowed' => 'The voucher code cannot be claimed in combination with your current e-mail address.', 677 'dialogue_voucher_code_user_subscription_not_allowed' => 'The voucher code cannot be claimed in combination with your already existing subscription.', 678 669 679 'form_toggle_off' => 'Off', 670 680 'form_toggle_on' => 'On', -
audienceplayer/tags/6.0.0/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Config/Constants.php
r3093691 r3298867 39 39 40 40 // Main plugin version number here and in main plugin file header are automatically overwritten in gulp-build script 41 PLUGIN_VERSION = ' 5.0.2',41 PLUGIN_VERSION = '6.0.0', 42 42 43 43 // DB migration version number is maintained here -
audienceplayer/tags/6.0.0/static/html/admin_help_release_notes.html
r3093691 r3298867 2 2 3 3 <h3>Release notes</h3> 4 5 <div class="audienceplayer-release-note"> 6 <h5>v6.0.0</h5> 7 <p class="date">2025-05-22</p> 8 <p class="content"> 9 <br/> 10 <u>☞ WARNING: major version update, observe possible breaking changes and as always, test thoroughly!</u> 11 <ul> 12 <li> 13 Refactored all the deprecated AudiencePlayer API mutations and queries related to voucher validation and 14 Product/Subscription acquisition (single new mutation: "UserPurchaseStackAcquire"). 15 </li> 16 <li> 17 Affected functions (argument changes): 18 <ul> 19 <li>audienceplayer-core.js::openModalPurchase()</li> 20 <li>audienceplayer-core.js::validateVoucherCode()</li> 21 <li>audienceplayer-core.js::redeemUserAccountVoucherCode()</li> 22 </ul> 23 </li> 24 <li> 25 Affected shortcodes (which trigger the functions mentioned above): 26 <ul> 27 <li>[audienceplayer_article_detail]</li> 28 <li>[audienceplayer_purchase_product_button]</li> 29 <li>[audienceplayer_purchase_subscriptions]</li> 30 <li>[audienceplayer_user_account]</li> 31 </ul> 32 </li> 33 <li> 34 New default translations were added to cover all known voucher error codes. 35 If you overwrite translations in your own template (e.g. using 36 "$AudiencePlayerWordpressPlugin->setTranslations([...])"), you might want to add the translations keys 37 as well if necessary: 38 <ul> 39 <li>'dialogue_voucher_code_claim_limit_overflow' : 'The voucher code cannot not be claimed, the 40 allowed maximum number of claims has been exceeded.' 41 </li> 42 <li>'dialogue_voucher_code_not_claimed' => 'The voucher code cannot not be claimed, likely it has 43 already been used.' 44 </li> 45 <li>'dialogue_voucher_code_product_intersect_not_allowed' => 'The voucher code cannot be applied to 46 all of the selected products.' 47 </li> 48 <li>'dialogue_voucher_code_product_not_allowed' => 'The voucher code cannot be claimed in 49 combination with selected products.' 50 </li> 51 <li>'dialogue_voucher_code_product_type_not_allowed' => 'The voucher code cannot be applied to the 52 type of one or more selected products.' 53 </li> 54 <li>'dialogue_voucher_code_subscription_not_allowed' => 'The voucher code cannot be claimed in 55 combination with selected subscription.' 56 </li> 57 <li>'dialogue_voucher_code_usage_not_allowed' => 'Usage of this voucher code is not allowed'</li> 58 <li>'dialogue_voucher_code_user_email_not_allowed' => 'The voucher code cannot be claimed in 59 combination with your current e-mail address.' 60 </li> 61 <li>'dialogue_voucher_code_user_subscription_not_allowed' => 'The voucher code cannot be claimed in 62 combination with your already existing subscription.' 63 </li> 64 </ul> 65 </li> 66 </ul> 67 </p> 68 </div> 4 69 5 70 <div class="audienceplayer-release-note"> -
audienceplayer/tags/6.0.0/templates/audienceplayer-shortcode-purchase-product-button.php
r2875369 r3298867 15 15 'call_to_action_tag', 16 16 'price', 17 'currency', 17 18 'currency_symbol', 18 19 'articles {id}' … … 45 46 $args['product_id'] . ',' . 46 47 "'" . $productDescription . "'," . 48 "'" . ($product->currency ?: 'EUR') . "'," . 47 49 "'" . $productPrice . "'," . 50 "1," . 48 51 (($args['show_voucher_validation'] ?? false) ? 'true' : 'false') . ',' . 49 52 $actionAuthentication . ',' . -
audienceplayer/tags/6.0.0/templates/audienceplayer-shortcode-purchase-subscriptions.php
r2916756 r3298867 52 52 $subscription->id . ',' . 53 53 "'" . $AudiencePlayerWordpressPlugin->helper->sanitiseJsString($subscription->description_short ?: $subscription->description) . "'," . 54 "'" . ($subscription->currency ?: 'EUR') . "'," . 54 55 "'" . $price . "'," . 56 "1," . 55 57 (($args['show_voucher_validation'] ?? false) ? 'true' : 'false') . ',' . 56 58 $actionAuthentication . ',' . -
audienceplayer/tags/6.0.0/templates/audienceplayer-shortcode-user-account.php
r3048935 r3298867 24 24 is_account_method_changeable 25 25 is_switchable 26 subscription {id title description_short }26 subscription {id title description_short currency currency_symbol} 27 27 account {id method method_details} 28 28 } … … 235 235 $content .= '<script>jQuery(function($){' . 236 236 '$("#audienceplayer-user-account-validate-voucher-button").click(function(){' . 237 'window.AudiencePlayerCore.redeemUserAccountVoucherCode(' . 238 'this,' . 239 '$("#audienceplayer-user-account-validate-voucher-input").val(),' . 240 $AudiencePlayerWordpressPlugin->fetchPaymentProviderId() . ',' . 241 ($validUserSubscription ? $validUserSubscription->subscription->id : 0) . ',' . 242 ($validUserSubscription ? $validUserSubscription->id : 0) . 243 ');' . 237 'window.AudiencePlayerCore.redeemUserAccountVoucherCode(this, $("#audienceplayer-user-account-validate-voucher-input").val());' . 244 238 '});' . 245 239 '});</script>'; … … 315 309 '<div><a href="javascript:void(0);" onclick="window.AudiencePlayerCore.openModalPurchase(this, \'payment_method\',' . 316 310 $validUserSubscription->account->id . ',' . 317 'window.AudiencePlayerCore.CONFIG.translations.dialogue_payment_method_change_cost_explanation,' . 318 'false' . 311 'window.AudiencePlayerCore.CONFIG.translations.dialogue_payment_method_change_cost_explanation' . 319 312 ');">' . $AudiencePlayerWordpressPlugin->fetchTranslations('dialogue_payment_method_change') . '</a></div>'; 320 313 … … 325 318 '<div><a href="javascript:void(0);" onclick="window.AudiencePlayerCore.openModalPurchase(this, \'payment_method\',' . 326 319 $validUserSubscription->account->id . ',' . 327 'window.AudiencePlayerCore.CONFIG.translations.dialogue_payment_method_change_cost_explanation,' . 328 'false' . 320 'window.AudiencePlayerCore.CONFIG.translations.dialogue_payment_method_change_cost_explanation' . 329 321 ');">' . $AudiencePlayerWordpressPlugin->fetchTranslations('dialogue_payment_method_add') . '</a></div>'; 330 322 } -
audienceplayer/tags/6.0.0/templates/js/audienceplayer-core.js
r3068993 r3298867 22 22 operation: 'query{UserDetails{id,nomadic_articles{id,appr},history_articles{id,appr},entitled_articles{id},user_subscriptions{id,subscription_id,is_valid}}}' 23 23 }, 24 }, 25 26 ERROR_CODE_TRANSLATIONS: { 27 3600: 'dialogue_voucher_code_invalid', 28 3601: 'dialogue_general_payment_error', 29 3602: 'dialogue_voucher_code_not_applicable', 30 3603: 'dialogue_voucher_code_applicable_subscription_unknown', 31 3604: 'dialogue_voucher_code_not_applicable', 32 3605: 'dialogue_voucher_code_usage_not_allowed', 33 3606: 'dialogue_amount_balance_usage_not_allowed', 34 3607: 'dialogue_voucher_code_claim_limit_overflow', 35 3608: 'dialogue_voucher_code_user_email_not_allowed', 36 3609: 'dialogue_voucher_code_subscription_not_allowed', 37 3610: 'dialogue_voucher_code_user_subscription_not_allowed', 38 3611: 'dialogue_voucher_code_product_not_allowed', 39 3612: 'dialogue_voucher_code_product_intersect_not_allowed', 40 3613: 'dialogue_voucher_code_product_type_not_allowed' 24 41 }, 25 42 … … 375 392 * @param resourceId 376 393 * @param message 394 * @param currency 377 395 * @param price 396 * @param purchaseNum 378 397 * @param isVoucherValidation 379 */ 380 openModalPurchase: function (event, type, resourceId, message, price, isVoucherValidation) { 381 382 let self = this; 398 * @returns {boolean} 399 */ 400 openModalPurchase: function (event, type, resourceId, message, currency, price, purchaseNum, isVoucherValidation) { 401 402 let self = this; 403 purchaseNum = parseInt(purchaseNum) ? parseInt(purchaseNum) : 1; 383 404 384 405 // Check browser support before opening modal … … 419 440 420 441 let onSuccessCallback = function (response) { 421 if (response.data. PaymentArgumentsValidate) {442 if (response.data.UserPurchaseIntentAcquire) { 422 443 $validationResult.removeClass('error'); 423 $validationResult.html(response.data .PaymentArgumentsValidate.voucher_description);424 $price.html(response.data .PaymentArgumentsValidate.currency_symbol + ' ' + response.data.PaymentArgumentsValidate.total_price_after);444 $validationResult.html(response.data['UserPurchaseIntentAcquire'].description); 445 $price.html(response.data['UserPurchaseIntentAcquire'].currency_symbol + ' ' + response.data['UserPurchaseIntentAcquire'].printable_price); 425 446 } 426 447 }; 427 448 428 449 let onFailureCallback = function (response) { 429 let error Msg = response.responseJSON.errors[0].message;430 let error Code = response.responseJSON.errors[0].code;431 if (errorCode === 400) {432 error Msg = self.parseTranslationKey('dialogue_voucher_code_invalid');433 } 450 let errorResponse = self.parseGraphqlErrorResponse(response); 451 let errorMsg = self.parseErrorCodeTranslationKey(errorResponse.code, 'dialogue_voucher_code_invalid') ? 452 self.parseTranslationKey(self.parseErrorCodeTranslationKey(errorResponse.code, 'dialogue_voucher_code_invalid')) : 453 errorResponse.message; 454 434 455 // show validation result inline 435 456 $validationResult.addClass('error'); … … 437 458 }; 438 459 439 let argsString = 'product_stack:[{purchase_num:1,id:' + resourceId + '}]';440 441 if (type === 'subscription') {442 argsString = 'subscription_id:' + resourceId;443 }444 445 460 $validateButton.click(function () { 446 461 self.validateVoucherCode( 447 462 $validateButton, 448 463 $voucherCodeInput.val(), 449 argsString, 450 false, 464 '[{id:' + resourceId + ',currency:' + currency + ',resource_type:' + type + ',purchase_num:' + purchaseNum + '}]', 451 465 onSuccessCallback, 452 466 onFailureCallback … … 467 481 } 468 482 469 let voucherCodeOperation = $voucherCodeInput.val() ?470 ',voucher_code:"' + $voucherCodeInput.val() + '"' :471 '';472 473 483 let operation = ''; 474 484 let responseProperty = ''; 485 let voucherCodeOperation = $voucherCodeInput.val() ? 486 'voucher_code:"' + $voucherCodeInput.val() + '"' : 487 ''; 475 488 476 489 switch (type) { 477 490 478 491 case 'product': 479 operation = 'mutation{UserProductAcquire(' + 480 'payment_provider_id:' + self.CONFIG.paymentProviderId + 481 ',product_stack:[{purchase_num:1,id:' + resourceId + '}]' + 492 case 'subscription': 493 operation = 'mutation{UserPurchaseIntentAcquire(' + 482 494 voucherCodeOperation + 495 ',is_execute_dry_run:false' + 496 ',operator_context:web' + 497 ',purchase_intent_stack:' + '[{id:' + resourceId + ',currency:' + currency + ',resource_type:' + type + ',purchase_num:' + purchaseNum + '}]' + 483 498 ',redirect_url_path:"' + self.fetchCurrentUrl({product_id: resourceId}, afterPurchaseRedirectAction, ['purchase_product_id', 'purchase_subscription_id']) + '"' + 484 499 '){payment_url}}'; 485 responseProperty = 'UserProductAcquire'; 486 break; 487 488 case 'subscription': 489 operation = 'mutation{UserSubscriptionAcquire(' + 490 'payment_provider_id:' + self.CONFIG.paymentProviderId + 491 ',subscription_id:' + resourceId + 492 voucherCodeOperation + 493 ',redirect_url_path:"' + self.fetchCurrentUrl({subscription_id: resourceId}, afterPurchaseRedirectAction, ['purchase_product_id', 'purchase_subscription_id']) + '"' + 494 '){payment_url}}'; 495 responseProperty = 'UserSubscriptionAcquire'; 500 responseProperty = 'UserPurchaseIntentAcquire'; 496 501 break; 497 502 … … 519 524 if (response.data[responseProperty].payment_url) { 520 525 // redirect to payment provider 526 self.closeModal(); 521 527 window.location.replace(response.data[responseProperty].payment_url); 522 528 } else { … … 536 542 self.toggleElementIsWorking([$acceptButton], false); 537 543 538 let errorMsg = response.responseJSON.errors[0].message; 539 let errorCode = response.responseJSON.errors[0].code; 540 if (errorCode === 3600) { 541 errorMsg = self.parseTranslationKey('dialogue_voucher_code_invalid'); 542 } 544 let errorResponse = self.parseGraphqlErrorResponse(response); 545 let errorMsg = self.parseErrorCodeTranslationKey(errorResponse.code) ? 546 self.parseTranslationKey(self.parseErrorCodeTranslationKey(errorResponse.code)) : 547 errorResponse.message; 543 548 544 549 self.handleApiErrorCallback( 545 550 event, 546 551 errorMsg, 547 error Code,552 errorResponse.code, 548 553 callbackNonAuthenticated, 549 554 callbackNonAuthorised, … … 808 813 * @param $validateButton 809 814 * @param voucherCode 810 * @param argsString 811 * @param isSoloValidation 815 * @param purchaseIntentStack 812 816 * @param onSuccessCallback 813 817 * @param onFailureCallback 814 818 */ 815 validateVoucherCode: function ($validateButton, voucherCode, argsString, isSoloValidation, onSuccessCallback, onFailureCallback) {819 validateVoucherCode: function ($validateButton, voucherCode, purchaseIntentStack, onSuccessCallback, onFailureCallback) { 816 820 817 821 let self = this; … … 823 827 } 824 828 825 if (isSoloValidation) { 826 argsString = argsString ? argsString + ',is_solo_validation:true' : 'is_solo_validation:true'; 827 } else { 828 argsString = argsString ? argsString + ',is_solo_validation:false' : 'is_solo_validation:false'; 829 } 829 voucherCode = voucherCode ? voucherCode.trim() : ''; 830 830 831 831 if (voucherCode) { 832 832 833 let operation = 'query{PaymentArgumentsValidate(' + 834 'voucher_code:"' + voucherCode + '",' + argsString + 835 '){voucher_validity,voucher_description,total_price_after,currency,currency_symbol}}'; 833 let operation = 'mutation{UserPurchaseIntentAcquire(' + 834 'is_execute_dry_run:true' + 835 ',operator_context:web' + 836 ',purchase_intent_stack:' + (purchaseIntentStack ? purchaseIntentStack : '[]') + 837 ',voucher_code:"' + voucherCode + '"' + 838 '){' + 839 'validation_messages{message,code}' + 840 ',description,price,printable_price,price_before,price_voucher_diff,validation_status,currency,currency_symbol}' + 841 '}'; 836 842 837 843 self.callApi( … … 841 847 function (response) { 842 848 self.toggleElementIsWorking([$validateButton], false); 843 // Acquisition was successful 844 onSuccessCallback(response); 849 if (response.data['UserPurchaseIntentAcquire'].validation_messages.length) { 850 // Validation messages detected on dry-run, mark as failure 851 onFailureCallback(response); 852 } else { 853 // Acquisition was successful 854 onSuccessCallback(response); 855 } 845 856 }, 846 857 function (response) { … … 1318 1329 * @param event 1319 1330 * @param voucherCode 1320 * @param paymentProviderId 1321 * @param subscriptionId 1322 * @param userSubscriptionId 1323 */ 1324 redeemUserAccountVoucherCode: function (event, voucherCode, paymentProviderId, subscriptionId, userSubscriptionId) { 1331 */ 1332 redeemUserAccountVoucherCode: function (event, voucherCode) { 1325 1333 1326 1334 let self = this; 1327 1335 let $validateButton = $(event); 1328 1329 voucherCode = voucherCode.trim(); 1336 voucherCode = voucherCode ? voucherCode.trim() : ''; 1337 1338 let onFailureCallback = function (response) { 1339 1340 let errorResponse = self.parseGraphqlErrorResponse(response); 1341 if (self.parseErrorCodeTranslationKey(errorResponse.code)) { 1342 self.openModalErrorMessage(self.parseTranslationKey(self.parseErrorCodeTranslationKey(errorResponse.code, 'dialogue_voucher_code_invalid')), errorResponse.code); 1343 } else if (errorResponse.code === 422) { 1344 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_applicable_subscription_unknown'), errorResponse.code); 1345 } else { 1346 self.handleApiErrorCallback(event, errorResponse.message, errorResponse.code); 1347 } 1348 1349 }; 1330 1350 1331 1351 let onSuccessCallback = function (response) { … … 1333 1353 self.openModalAlert( 1334 1354 null, 1335 response.data[' PaymentArgumentsValidate'].voucher_description,1355 response.data['UserPurchaseIntentAcquire'].description, 1336 1356 self.parseTranslationKey('button_payment_accept_complete'), 1337 1357 function (event, $modalButton) { … … 1343 1363 } 1344 1364 1345 let operation = 'mutation{UserP aymentVoucherRedeem(' +1346 ' code:"' + voucherCode + '",' +1347 ' payment_provider_id:' + paymentProviderId + ',' +1348 ' subscription_id:' + subscriptionId + ',' +1349 ' user_subscription_id:' + userSubscriptionId + ',' +1350 ' redirect_url_path:"' + self.fetchCurrentUrl() + '"' +1365 let operation = 'mutation{UserPurchaseIntentAcquire(' + 1366 'is_execute_dry_run:false' + 1367 ',operator_context:web' + 1368 ',purchase_intent_stack:[]' + 1369 ',voucher_code:"' + voucherCode + '"' + 1370 ',redirect_url_path:"' + self.fetchCurrentUrl() + '"' + 1351 1371 '){payment_url}}'; 1352 1372 … … 1362 1382 1363 1383 // Acquisition was successful 1364 if (response.data['UserP aymentVoucherRedeem'].payment_url) {1384 if (response.data['UserPurchaseIntentAcquire'].payment_url) { 1365 1385 // redirect to payment provider 1366 window.location.replace(response.data['UserP aymentVoucherRedeem'].payment_url);1386 window.location.replace(response.data['UserPurchaseIntentAcquire'].payment_url); 1367 1387 } else { 1368 1388 // payment is not necessary … … 1379 1399 function (response) { 1380 1400 self.toggleElementIsWorking([$modalButton], false); 1381 1382 let errorMsg = response.responseJSON.errors[0].message; 1383 let errorCode = response.responseJSON.errors[0].code; 1384 if (errorCode === 422) { 1385 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_applicable_subscription_unknown'), errorCode); 1386 } else if (errorCode === 3600) { 1387 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_invalid'), errorCode); 1388 } else if (errorCode >= 400) { 1389 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_not_applicable'), errorCode); 1390 } else { 1391 self.handleApiErrorCallback(event, errorMsg, errorCode); 1392 } 1401 onFailureCallback(response); 1393 1402 } 1394 1403 ); … … 1397 1406 }; 1398 1407 1399 let onFailureCallback = function (response) { 1400 1401 let errorMsg = response.responseJSON.errors[0].message; 1402 let errorCode = response.responseJSON.errors[0].code; 1403 if (errorCode === 422) { 1404 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_applicable_subscription_unknown'), errorCode); 1405 } else if (errorCode === 3600) { 1406 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_invalid'), errorCode); 1407 } else if (errorCode >= 400) { 1408 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_not_applicable'), errorCode); 1409 } else { 1410 self.handleApiErrorCallback(event, errorMsg, errorCode); 1411 } 1412 1413 }; 1414 1415 self.validateVoucherCode($validateButton, voucherCode, 'subscription_id:' + subscriptionId, true, onSuccessCallback, onFailureCallback); 1408 self.validateVoucherCode($validateButton, voucherCode, '[]', onSuccessCallback, onFailureCallback); 1416 1409 }, 1417 1410 … … 1707 1700 parseTranslationKey: function (key, vars) { 1708 1701 return this.parseTranslation(this.CONFIG.translations[key], vars); 1702 }, 1703 1704 parseErrorCodeTranslationKey: function (errorCode, fallbackTranslation) { 1705 return this.ERROR_CODE_TRANSLATIONS[errorCode] ? 1706 this.ERROR_CODE_TRANSLATIONS[errorCode] : 1707 (fallbackTranslation = fallbackTranslation ? fallbackTranslation.trim() : ''); 1708 }, 1709 1710 parseGraphqlErrorResponse: function (response) { 1711 1712 let errorMessage = response.statusText; 1713 let errorCode = response.status; 1714 1715 if (response.responseJSON && response.responseJSON.errors) { 1716 errorMessage = response.responseJSON.errors[0].message; 1717 errorCode = response.responseJSON.errors[0].code; 1718 } else if (response.data['UserPurchaseIntentAcquire'] && response.data['UserPurchaseIntentAcquire'].validation_messages.length) { 1719 errorMessage = response.data['UserPurchaseIntentAcquire'].validation_messages[0].message; 1720 errorCode = response.data['UserPurchaseIntentAcquire'].validation_messages[0].code; 1721 } 1722 1723 return { 1724 message: errorMessage, 1725 code: errorCode, 1726 }; 1709 1727 } 1710 1728 -
audienceplayer/tags/6.0.0/vendor/autoload.php
r3048935 r3298867 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 5cfc594734f281b302e98f3d5dfebf3e::getLoader();25 return ComposerAutoloaderInita6d20a7c9bc887ce3cb59346b319f6dd::getLoader(); -
audienceplayer/tags/6.0.0/vendor/composer/InstalledVersions.php
r2945999 r3298867 32 32 */ 33 33 private static $installed; 34 35 /** 36 * @var bool 37 */ 38 private static $installedIsLocalDir; 34 39 35 40 /** … … 310 315 self::$installed = $data; 311 316 self::$installedByVendor = array(); 317 318 // when using reload, we disable the duplicate protection to ensure that self::$installed data is 319 // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, 320 // so we have to assume it does not, and that may result in duplicate data being returned when listing 321 // all installed packages for example 322 self::$installedIsLocalDir = false; 312 323 } 313 324 … … 323 334 324 335 $installed = array(); 336 $copiedLocalDir = false; 325 337 326 338 if (self::$canGetVendors) { 339 $selfDir = strtr(__DIR__, '\\', '/'); 327 340 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 341 $vendorDir = strtr($vendorDir, '\\', '/'); 328 342 if (isset(self::$installedByVendor[$vendorDir])) { 329 343 $installed[] = self::$installedByVendor[$vendorDir]; … … 331 345 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 332 346 $required = require $vendorDir.'/composer/installed.php'; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 335 self::$installed = $installed[count($installed) - 1]; 347 self::$installedByVendor[$vendorDir] = $required; 348 $installed[] = $required; 349 if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { 350 self::$installed = $required; 351 self::$installedIsLocalDir = true; 336 352 } 353 } 354 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { 355 $copiedLocalDir = true; 337 356 } 338 357 } … … 351 370 } 352 371 353 if (self::$installed !== array() ) {372 if (self::$installed !== array() && !$copiedLocalDir) { 354 373 $installed[] = self::$installed; 355 374 } -
audienceplayer/tags/6.0.0/vendor/composer/autoload_real.php
r3048935 r3298867 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 5cfc594734f281b302e98f3d5dfebf3e5 class ComposerAutoloaderInita6d20a7c9bc887ce3cb59346b319f6dd 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 5cfc594734f281b302e98f3d5dfebf3e', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInita6d20a7c9bc887ce3cb59346b319f6dd', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 5cfc594734f281b302e98f3d5dfebf3e', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInita6d20a7c9bc887ce3cb59346b319f6dd', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
audienceplayer/tags/6.0.0/vendor/composer/autoload_static.php
r3048935 r3298867 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e7 class ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 38 38 { 39 39 return \Closure::bind(function () use ($loader) { 40 $loader->prefixLengthsPsr4 = ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e::$prefixLengthsPsr4;41 $loader->prefixDirsPsr4 = ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e::$prefixDirsPsr4;42 $loader->classMap = ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e::$classMap;40 $loader->prefixLengthsPsr4 = ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd::$prefixLengthsPsr4; 41 $loader->prefixDirsPsr4 = ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd::$prefixDirsPsr4; 42 $loader->classMap = ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd::$classMap; 43 43 44 44 }, null, ClassLoader::class); -
audienceplayer/tags/6.0.0/vendor/composer/installed.php
r3093691 r3298867 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' 29f460d6d43eb9169464315fc26de985a96e91dd',6 'reference' => '3374afa17e8b39c6498b92b0a5aa363da5ac162b', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 23 23 'pretty_version' => 'dev-master', 24 24 'version' => 'dev-master', 25 'reference' => ' 29f460d6d43eb9169464315fc26de985a96e91dd',25 'reference' => '3374afa17e8b39c6498b92b0a5aa363da5ac162b', 26 26 'type' => 'wordpress-plugin', 27 27 'install_path' => __DIR__ . '/../../', -
audienceplayer/trunk/audienceplayer.php
r3093691 r3298867 9 9 Description: AudiencePlayer integration 10 10 Author: AudiencePlayer 11 Version: 5.0.211 Version: 6.0.0 12 12 Author URI: https://www.audienceplayer.com 13 13 Text Domain: audienceplayer -
audienceplayer/trunk/composer.lock
r3093691 r3298867 67 67 { 68 68 "name": "phpstan/phpstan", 69 "version": "1.1 1.2",69 "version": "1.12.27", 70 70 "source": { 71 71 "type": "git", 72 72 "url": "https://github.com/phpstan/phpstan.git", 73 "reference": " 0d5d4294a70deb7547db655c47685d680e39cfec"73 "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162" 74 74 }, 75 75 "dist": { 76 76 "type": "zip", 77 "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ 0d5d4294a70deb7547db655c47685d680e39cfec",78 "reference": " 0d5d4294a70deb7547db655c47685d680e39cfec",77 "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a6e423c076ab39dfedc307e2ac627ef579db162", 78 "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162", 79 79 "shasum": "" 80 80 }, … … 121 121 } 122 122 ], 123 "time": "202 4-05-24T13:23:04+00:00"123 "time": "2025-05-21T20:51:45+00:00" 124 124 } 125 125 ], 126 126 "aliases": [], 127 127 "minimum-stability": "stable", 128 "stability-flags": [],128 "stability-flags": {}, 129 129 "prefer-stable": false, 130 130 "prefer-lowest": false, … … 134 134 "ext-json": "*" 135 135 }, 136 "platform-dev": [],136 "platform-dev": {}, 137 137 "plugin-api-version": "2.6.0" 138 138 } -
audienceplayer/trunk/languages/audienceplayer-wordpress-plugin.pot
r3093691 r3298867 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: 5.0.2\n"5 "Project-Id-Version: 6.0.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/audienceplayer\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -
audienceplayer/trunk/readme.txt
r3093691 r3298867 1 1 === AudiencePlayer === 2 2 Contributors: audienceplayer 3 Stable tag: 5.0.24 Tested up to: 6. 53 Stable tag: 6.0.0 4 Tested up to: 6.8 5 5 Requires at least: 5.5 6 6 Requires PHP: 7.1 … … 22 22 This plugin relies on the following external AudiencePlayer libraries, via which user profile data is exchanged with the AudiencePlayer Backend: 23 23 24 1. **AudiencePlayer A pwrapper library for PHP**24 1. **AudiencePlayer API wrapper library for PHP** 25 25 * link: [https://github.com/AudiencePlayer/audienceplayer-api-client-php](https://github.com/AudiencePlayer/audienceplayer-api-client-php) 26 26 * license: [https://github.com/AudiencePlayer/audienceplayer-api-client-php/blob/master/LICENSE](https://github.com/AudiencePlayer/audienceplayer-api-client-php/blob/master/LICENSE) -
audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php
r3068993 r3298867 664 664 'dialogue_user_subscription_will_switch_at_renewal' => '→ At the next renewal date, your subscription will switch to "{{ subscription_title }}"', 665 665 'dialogue_video_not_available_in_region' => 'The content is not available in your current country or region.', 666 'dialogue_voucher_code_invalid' => 'Voucher code is not valid.', 667 'dialogue_voucher_code_not_applicable' => 'Voucher code is not valid or cannot be applied on current subscription.', 668 'dialogue_voucher_code_applicable_subscription_unknown' => 'This voucher can only be applied to an already existing subscription or when purchasing a new subscription.', 666 'dialogue_voucher_code_applicable_subscription_unknown' => 'This voucher code can only be applied to an already existing subscription or when purchasing a new subscription.', 667 'dialogue_voucher_code_claim_limit_overflow' => 'The voucher code cannot not be claimed, the allowed maximum number of claims has been exceeded.', 668 'dialogue_voucher_code_invalid' => 'The voucher code is invalid.', 669 'dialogue_voucher_code_not_applicable' => 'The voucher code can only be redeemed on a new subscription or product.', 670 'dialogue_voucher_code_not_claimed' => 'The voucher code cannot not be claimed, likely it has already been used.', 671 'dialogue_voucher_code_product_intersect_not_allowed' => 'The voucher code cannot be applied to all of the selected products.', 672 'dialogue_voucher_code_product_not_allowed' => 'The voucher code cannot be claimed in combination with selected products.', 673 'dialogue_voucher_code_product_type_not_allowed' => 'The voucher code cannot be applied to the type of one or more selected products.', 674 'dialogue_voucher_code_subscription_not_allowed' => 'The voucher code cannot be claimed in combination with selected subscription.', 675 'dialogue_voucher_code_usage_not_allowed' => 'Usage of this voucher code is not allowed', 676 'dialogue_voucher_code_user_email_not_allowed' => 'The voucher code cannot be claimed in combination with your current e-mail address.', 677 'dialogue_voucher_code_user_subscription_not_allowed' => 'The voucher code cannot be claimed in combination with your already existing subscription.', 678 669 679 'form_toggle_off' => 'Off', 670 680 'form_toggle_on' => 'On', -
audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Config/Constants.php
r3093691 r3298867 39 39 40 40 // Main plugin version number here and in main plugin file header are automatically overwritten in gulp-build script 41 PLUGIN_VERSION = ' 5.0.2',41 PLUGIN_VERSION = '6.0.0', 42 42 43 43 // DB migration version number is maintained here -
audienceplayer/trunk/static/html/admin_help_release_notes.html
r3093691 r3298867 2 2 3 3 <h3>Release notes</h3> 4 5 <div class="audienceplayer-release-note"> 6 <h5>v6.0.0</h5> 7 <p class="date">2025-05-22</p> 8 <p class="content"> 9 <br/> 10 <u>☞ WARNING: major version update, observe possible breaking changes and as always, test thoroughly!</u> 11 <ul> 12 <li> 13 Refactored all the deprecated AudiencePlayer API mutations and queries related to voucher validation and 14 Product/Subscription acquisition (single new mutation: "UserPurchaseStackAcquire"). 15 </li> 16 <li> 17 Affected functions (argument changes): 18 <ul> 19 <li>audienceplayer-core.js::openModalPurchase()</li> 20 <li>audienceplayer-core.js::validateVoucherCode()</li> 21 <li>audienceplayer-core.js::redeemUserAccountVoucherCode()</li> 22 </ul> 23 </li> 24 <li> 25 Affected shortcodes (which trigger the functions mentioned above): 26 <ul> 27 <li>[audienceplayer_article_detail]</li> 28 <li>[audienceplayer_purchase_product_button]</li> 29 <li>[audienceplayer_purchase_subscriptions]</li> 30 <li>[audienceplayer_user_account]</li> 31 </ul> 32 </li> 33 <li> 34 New default translations were added to cover all known voucher error codes. 35 If you overwrite translations in your own template (e.g. using 36 "$AudiencePlayerWordpressPlugin->setTranslations([...])"), you might want to add the translations keys 37 as well if necessary: 38 <ul> 39 <li>'dialogue_voucher_code_claim_limit_overflow' : 'The voucher code cannot not be claimed, the 40 allowed maximum number of claims has been exceeded.' 41 </li> 42 <li>'dialogue_voucher_code_not_claimed' => 'The voucher code cannot not be claimed, likely it has 43 already been used.' 44 </li> 45 <li>'dialogue_voucher_code_product_intersect_not_allowed' => 'The voucher code cannot be applied to 46 all of the selected products.' 47 </li> 48 <li>'dialogue_voucher_code_product_not_allowed' => 'The voucher code cannot be claimed in 49 combination with selected products.' 50 </li> 51 <li>'dialogue_voucher_code_product_type_not_allowed' => 'The voucher code cannot be applied to the 52 type of one or more selected products.' 53 </li> 54 <li>'dialogue_voucher_code_subscription_not_allowed' => 'The voucher code cannot be claimed in 55 combination with selected subscription.' 56 </li> 57 <li>'dialogue_voucher_code_usage_not_allowed' => 'Usage of this voucher code is not allowed'</li> 58 <li>'dialogue_voucher_code_user_email_not_allowed' => 'The voucher code cannot be claimed in 59 combination with your current e-mail address.' 60 </li> 61 <li>'dialogue_voucher_code_user_subscription_not_allowed' => 'The voucher code cannot be claimed in 62 combination with your already existing subscription.' 63 </li> 64 </ul> 65 </li> 66 </ul> 67 </p> 68 </div> 4 69 5 70 <div class="audienceplayer-release-note"> -
audienceplayer/trunk/templates/audienceplayer-shortcode-purchase-product-button.php
r2875369 r3298867 15 15 'call_to_action_tag', 16 16 'price', 17 'currency', 17 18 'currency_symbol', 18 19 'articles {id}' … … 45 46 $args['product_id'] . ',' . 46 47 "'" . $productDescription . "'," . 48 "'" . ($product->currency ?: 'EUR') . "'," . 47 49 "'" . $productPrice . "'," . 50 "1," . 48 51 (($args['show_voucher_validation'] ?? false) ? 'true' : 'false') . ',' . 49 52 $actionAuthentication . ',' . -
audienceplayer/trunk/templates/audienceplayer-shortcode-purchase-subscriptions.php
r2916756 r3298867 52 52 $subscription->id . ',' . 53 53 "'" . $AudiencePlayerWordpressPlugin->helper->sanitiseJsString($subscription->description_short ?: $subscription->description) . "'," . 54 "'" . ($subscription->currency ?: 'EUR') . "'," . 54 55 "'" . $price . "'," . 56 "1," . 55 57 (($args['show_voucher_validation'] ?? false) ? 'true' : 'false') . ',' . 56 58 $actionAuthentication . ',' . -
audienceplayer/trunk/templates/audienceplayer-shortcode-user-account.php
r3048935 r3298867 24 24 is_account_method_changeable 25 25 is_switchable 26 subscription {id title description_short }26 subscription {id title description_short currency currency_symbol} 27 27 account {id method method_details} 28 28 } … … 235 235 $content .= '<script>jQuery(function($){' . 236 236 '$("#audienceplayer-user-account-validate-voucher-button").click(function(){' . 237 'window.AudiencePlayerCore.redeemUserAccountVoucherCode(' . 238 'this,' . 239 '$("#audienceplayer-user-account-validate-voucher-input").val(),' . 240 $AudiencePlayerWordpressPlugin->fetchPaymentProviderId() . ',' . 241 ($validUserSubscription ? $validUserSubscription->subscription->id : 0) . ',' . 242 ($validUserSubscription ? $validUserSubscription->id : 0) . 243 ');' . 237 'window.AudiencePlayerCore.redeemUserAccountVoucherCode(this, $("#audienceplayer-user-account-validate-voucher-input").val());' . 244 238 '});' . 245 239 '});</script>'; … … 315 309 '<div><a href="javascript:void(0);" onclick="window.AudiencePlayerCore.openModalPurchase(this, \'payment_method\',' . 316 310 $validUserSubscription->account->id . ',' . 317 'window.AudiencePlayerCore.CONFIG.translations.dialogue_payment_method_change_cost_explanation,' . 318 'false' . 311 'window.AudiencePlayerCore.CONFIG.translations.dialogue_payment_method_change_cost_explanation' . 319 312 ');">' . $AudiencePlayerWordpressPlugin->fetchTranslations('dialogue_payment_method_change') . '</a></div>'; 320 313 … … 325 318 '<div><a href="javascript:void(0);" onclick="window.AudiencePlayerCore.openModalPurchase(this, \'payment_method\',' . 326 319 $validUserSubscription->account->id . ',' . 327 'window.AudiencePlayerCore.CONFIG.translations.dialogue_payment_method_change_cost_explanation,' . 328 'false' . 320 'window.AudiencePlayerCore.CONFIG.translations.dialogue_payment_method_change_cost_explanation' . 329 321 ');">' . $AudiencePlayerWordpressPlugin->fetchTranslations('dialogue_payment_method_add') . '</a></div>'; 330 322 } -
audienceplayer/trunk/templates/js/audienceplayer-core.js
r3068993 r3298867 22 22 operation: 'query{UserDetails{id,nomadic_articles{id,appr},history_articles{id,appr},entitled_articles{id},user_subscriptions{id,subscription_id,is_valid}}}' 23 23 }, 24 }, 25 26 ERROR_CODE_TRANSLATIONS: { 27 3600: 'dialogue_voucher_code_invalid', 28 3601: 'dialogue_general_payment_error', 29 3602: 'dialogue_voucher_code_not_applicable', 30 3603: 'dialogue_voucher_code_applicable_subscription_unknown', 31 3604: 'dialogue_voucher_code_not_applicable', 32 3605: 'dialogue_voucher_code_usage_not_allowed', 33 3606: 'dialogue_amount_balance_usage_not_allowed', 34 3607: 'dialogue_voucher_code_claim_limit_overflow', 35 3608: 'dialogue_voucher_code_user_email_not_allowed', 36 3609: 'dialogue_voucher_code_subscription_not_allowed', 37 3610: 'dialogue_voucher_code_user_subscription_not_allowed', 38 3611: 'dialogue_voucher_code_product_not_allowed', 39 3612: 'dialogue_voucher_code_product_intersect_not_allowed', 40 3613: 'dialogue_voucher_code_product_type_not_allowed' 24 41 }, 25 42 … … 375 392 * @param resourceId 376 393 * @param message 394 * @param currency 377 395 * @param price 396 * @param purchaseNum 378 397 * @param isVoucherValidation 379 */ 380 openModalPurchase: function (event, type, resourceId, message, price, isVoucherValidation) { 381 382 let self = this; 398 * @returns {boolean} 399 */ 400 openModalPurchase: function (event, type, resourceId, message, currency, price, purchaseNum, isVoucherValidation) { 401 402 let self = this; 403 purchaseNum = parseInt(purchaseNum) ? parseInt(purchaseNum) : 1; 383 404 384 405 // Check browser support before opening modal … … 419 440 420 441 let onSuccessCallback = function (response) { 421 if (response.data. PaymentArgumentsValidate) {442 if (response.data.UserPurchaseIntentAcquire) { 422 443 $validationResult.removeClass('error'); 423 $validationResult.html(response.data .PaymentArgumentsValidate.voucher_description);424 $price.html(response.data .PaymentArgumentsValidate.currency_symbol + ' ' + response.data.PaymentArgumentsValidate.total_price_after);444 $validationResult.html(response.data['UserPurchaseIntentAcquire'].description); 445 $price.html(response.data['UserPurchaseIntentAcquire'].currency_symbol + ' ' + response.data['UserPurchaseIntentAcquire'].printable_price); 425 446 } 426 447 }; 427 448 428 449 let onFailureCallback = function (response) { 429 let error Msg = response.responseJSON.errors[0].message;430 let error Code = response.responseJSON.errors[0].code;431 if (errorCode === 400) {432 error Msg = self.parseTranslationKey('dialogue_voucher_code_invalid');433 } 450 let errorResponse = self.parseGraphqlErrorResponse(response); 451 let errorMsg = self.parseErrorCodeTranslationKey(errorResponse.code, 'dialogue_voucher_code_invalid') ? 452 self.parseTranslationKey(self.parseErrorCodeTranslationKey(errorResponse.code, 'dialogue_voucher_code_invalid')) : 453 errorResponse.message; 454 434 455 // show validation result inline 435 456 $validationResult.addClass('error'); … … 437 458 }; 438 459 439 let argsString = 'product_stack:[{purchase_num:1,id:' + resourceId + '}]';440 441 if (type === 'subscription') {442 argsString = 'subscription_id:' + resourceId;443 }444 445 460 $validateButton.click(function () { 446 461 self.validateVoucherCode( 447 462 $validateButton, 448 463 $voucherCodeInput.val(), 449 argsString, 450 false, 464 '[{id:' + resourceId + ',currency:' + currency + ',resource_type:' + type + ',purchase_num:' + purchaseNum + '}]', 451 465 onSuccessCallback, 452 466 onFailureCallback … … 467 481 } 468 482 469 let voucherCodeOperation = $voucherCodeInput.val() ?470 ',voucher_code:"' + $voucherCodeInput.val() + '"' :471 '';472 473 483 let operation = ''; 474 484 let responseProperty = ''; 485 let voucherCodeOperation = $voucherCodeInput.val() ? 486 'voucher_code:"' + $voucherCodeInput.val() + '"' : 487 ''; 475 488 476 489 switch (type) { 477 490 478 491 case 'product': 479 operation = 'mutation{UserProductAcquire(' + 480 'payment_provider_id:' + self.CONFIG.paymentProviderId + 481 ',product_stack:[{purchase_num:1,id:' + resourceId + '}]' + 492 case 'subscription': 493 operation = 'mutation{UserPurchaseIntentAcquire(' + 482 494 voucherCodeOperation + 495 ',is_execute_dry_run:false' + 496 ',operator_context:web' + 497 ',purchase_intent_stack:' + '[{id:' + resourceId + ',currency:' + currency + ',resource_type:' + type + ',purchase_num:' + purchaseNum + '}]' + 483 498 ',redirect_url_path:"' + self.fetchCurrentUrl({product_id: resourceId}, afterPurchaseRedirectAction, ['purchase_product_id', 'purchase_subscription_id']) + '"' + 484 499 '){payment_url}}'; 485 responseProperty = 'UserProductAcquire'; 486 break; 487 488 case 'subscription': 489 operation = 'mutation{UserSubscriptionAcquire(' + 490 'payment_provider_id:' + self.CONFIG.paymentProviderId + 491 ',subscription_id:' + resourceId + 492 voucherCodeOperation + 493 ',redirect_url_path:"' + self.fetchCurrentUrl({subscription_id: resourceId}, afterPurchaseRedirectAction, ['purchase_product_id', 'purchase_subscription_id']) + '"' + 494 '){payment_url}}'; 495 responseProperty = 'UserSubscriptionAcquire'; 500 responseProperty = 'UserPurchaseIntentAcquire'; 496 501 break; 497 502 … … 519 524 if (response.data[responseProperty].payment_url) { 520 525 // redirect to payment provider 526 self.closeModal(); 521 527 window.location.replace(response.data[responseProperty].payment_url); 522 528 } else { … … 536 542 self.toggleElementIsWorking([$acceptButton], false); 537 543 538 let errorMsg = response.responseJSON.errors[0].message; 539 let errorCode = response.responseJSON.errors[0].code; 540 if (errorCode === 3600) { 541 errorMsg = self.parseTranslationKey('dialogue_voucher_code_invalid'); 542 } 544 let errorResponse = self.parseGraphqlErrorResponse(response); 545 let errorMsg = self.parseErrorCodeTranslationKey(errorResponse.code) ? 546 self.parseTranslationKey(self.parseErrorCodeTranslationKey(errorResponse.code)) : 547 errorResponse.message; 543 548 544 549 self.handleApiErrorCallback( 545 550 event, 546 551 errorMsg, 547 error Code,552 errorResponse.code, 548 553 callbackNonAuthenticated, 549 554 callbackNonAuthorised, … … 808 813 * @param $validateButton 809 814 * @param voucherCode 810 * @param argsString 811 * @param isSoloValidation 815 * @param purchaseIntentStack 812 816 * @param onSuccessCallback 813 817 * @param onFailureCallback 814 818 */ 815 validateVoucherCode: function ($validateButton, voucherCode, argsString, isSoloValidation, onSuccessCallback, onFailureCallback) {819 validateVoucherCode: function ($validateButton, voucherCode, purchaseIntentStack, onSuccessCallback, onFailureCallback) { 816 820 817 821 let self = this; … … 823 827 } 824 828 825 if (isSoloValidation) { 826 argsString = argsString ? argsString + ',is_solo_validation:true' : 'is_solo_validation:true'; 827 } else { 828 argsString = argsString ? argsString + ',is_solo_validation:false' : 'is_solo_validation:false'; 829 } 829 voucherCode = voucherCode ? voucherCode.trim() : ''; 830 830 831 831 if (voucherCode) { 832 832 833 let operation = 'query{PaymentArgumentsValidate(' + 834 'voucher_code:"' + voucherCode + '",' + argsString + 835 '){voucher_validity,voucher_description,total_price_after,currency,currency_symbol}}'; 833 let operation = 'mutation{UserPurchaseIntentAcquire(' + 834 'is_execute_dry_run:true' + 835 ',operator_context:web' + 836 ',purchase_intent_stack:' + (purchaseIntentStack ? purchaseIntentStack : '[]') + 837 ',voucher_code:"' + voucherCode + '"' + 838 '){' + 839 'validation_messages{message,code}' + 840 ',description,price,printable_price,price_before,price_voucher_diff,validation_status,currency,currency_symbol}' + 841 '}'; 836 842 837 843 self.callApi( … … 841 847 function (response) { 842 848 self.toggleElementIsWorking([$validateButton], false); 843 // Acquisition was successful 844 onSuccessCallback(response); 849 if (response.data['UserPurchaseIntentAcquire'].validation_messages.length) { 850 // Validation messages detected on dry-run, mark as failure 851 onFailureCallback(response); 852 } else { 853 // Acquisition was successful 854 onSuccessCallback(response); 855 } 845 856 }, 846 857 function (response) { … … 1318 1329 * @param event 1319 1330 * @param voucherCode 1320 * @param paymentProviderId 1321 * @param subscriptionId 1322 * @param userSubscriptionId 1323 */ 1324 redeemUserAccountVoucherCode: function (event, voucherCode, paymentProviderId, subscriptionId, userSubscriptionId) { 1331 */ 1332 redeemUserAccountVoucherCode: function (event, voucherCode) { 1325 1333 1326 1334 let self = this; 1327 1335 let $validateButton = $(event); 1328 1329 voucherCode = voucherCode.trim(); 1336 voucherCode = voucherCode ? voucherCode.trim() : ''; 1337 1338 let onFailureCallback = function (response) { 1339 1340 let errorResponse = self.parseGraphqlErrorResponse(response); 1341 if (self.parseErrorCodeTranslationKey(errorResponse.code)) { 1342 self.openModalErrorMessage(self.parseTranslationKey(self.parseErrorCodeTranslationKey(errorResponse.code, 'dialogue_voucher_code_invalid')), errorResponse.code); 1343 } else if (errorResponse.code === 422) { 1344 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_applicable_subscription_unknown'), errorResponse.code); 1345 } else { 1346 self.handleApiErrorCallback(event, errorResponse.message, errorResponse.code); 1347 } 1348 1349 }; 1330 1350 1331 1351 let onSuccessCallback = function (response) { … … 1333 1353 self.openModalAlert( 1334 1354 null, 1335 response.data[' PaymentArgumentsValidate'].voucher_description,1355 response.data['UserPurchaseIntentAcquire'].description, 1336 1356 self.parseTranslationKey('button_payment_accept_complete'), 1337 1357 function (event, $modalButton) { … … 1343 1363 } 1344 1364 1345 let operation = 'mutation{UserP aymentVoucherRedeem(' +1346 ' code:"' + voucherCode + '",' +1347 ' payment_provider_id:' + paymentProviderId + ',' +1348 ' subscription_id:' + subscriptionId + ',' +1349 ' user_subscription_id:' + userSubscriptionId + ',' +1350 ' redirect_url_path:"' + self.fetchCurrentUrl() + '"' +1365 let operation = 'mutation{UserPurchaseIntentAcquire(' + 1366 'is_execute_dry_run:false' + 1367 ',operator_context:web' + 1368 ',purchase_intent_stack:[]' + 1369 ',voucher_code:"' + voucherCode + '"' + 1370 ',redirect_url_path:"' + self.fetchCurrentUrl() + '"' + 1351 1371 '){payment_url}}'; 1352 1372 … … 1362 1382 1363 1383 // Acquisition was successful 1364 if (response.data['UserP aymentVoucherRedeem'].payment_url) {1384 if (response.data['UserPurchaseIntentAcquire'].payment_url) { 1365 1385 // redirect to payment provider 1366 window.location.replace(response.data['UserP aymentVoucherRedeem'].payment_url);1386 window.location.replace(response.data['UserPurchaseIntentAcquire'].payment_url); 1367 1387 } else { 1368 1388 // payment is not necessary … … 1379 1399 function (response) { 1380 1400 self.toggleElementIsWorking([$modalButton], false); 1381 1382 let errorMsg = response.responseJSON.errors[0].message; 1383 let errorCode = response.responseJSON.errors[0].code; 1384 if (errorCode === 422) { 1385 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_applicable_subscription_unknown'), errorCode); 1386 } else if (errorCode === 3600) { 1387 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_invalid'), errorCode); 1388 } else if (errorCode >= 400) { 1389 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_not_applicable'), errorCode); 1390 } else { 1391 self.handleApiErrorCallback(event, errorMsg, errorCode); 1392 } 1401 onFailureCallback(response); 1393 1402 } 1394 1403 ); … … 1397 1406 }; 1398 1407 1399 let onFailureCallback = function (response) { 1400 1401 let errorMsg = response.responseJSON.errors[0].message; 1402 let errorCode = response.responseJSON.errors[0].code; 1403 if (errorCode === 422) { 1404 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_applicable_subscription_unknown'), errorCode); 1405 } else if (errorCode === 3600) { 1406 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_invalid'), errorCode); 1407 } else if (errorCode >= 400) { 1408 self.openModalErrorMessage(self.parseTranslationKey('dialogue_voucher_code_not_applicable'), errorCode); 1409 } else { 1410 self.handleApiErrorCallback(event, errorMsg, errorCode); 1411 } 1412 1413 }; 1414 1415 self.validateVoucherCode($validateButton, voucherCode, 'subscription_id:' + subscriptionId, true, onSuccessCallback, onFailureCallback); 1408 self.validateVoucherCode($validateButton, voucherCode, '[]', onSuccessCallback, onFailureCallback); 1416 1409 }, 1417 1410 … … 1707 1700 parseTranslationKey: function (key, vars) { 1708 1701 return this.parseTranslation(this.CONFIG.translations[key], vars); 1702 }, 1703 1704 parseErrorCodeTranslationKey: function (errorCode, fallbackTranslation) { 1705 return this.ERROR_CODE_TRANSLATIONS[errorCode] ? 1706 this.ERROR_CODE_TRANSLATIONS[errorCode] : 1707 (fallbackTranslation = fallbackTranslation ? fallbackTranslation.trim() : ''); 1708 }, 1709 1710 parseGraphqlErrorResponse: function (response) { 1711 1712 let errorMessage = response.statusText; 1713 let errorCode = response.status; 1714 1715 if (response.responseJSON && response.responseJSON.errors) { 1716 errorMessage = response.responseJSON.errors[0].message; 1717 errorCode = response.responseJSON.errors[0].code; 1718 } else if (response.data['UserPurchaseIntentAcquire'] && response.data['UserPurchaseIntentAcquire'].validation_messages.length) { 1719 errorMessage = response.data['UserPurchaseIntentAcquire'].validation_messages[0].message; 1720 errorCode = response.data['UserPurchaseIntentAcquire'].validation_messages[0].code; 1721 } 1722 1723 return { 1724 message: errorMessage, 1725 code: errorCode, 1726 }; 1709 1727 } 1710 1728 -
audienceplayer/trunk/vendor/autoload.php
r3048935 r3298867 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 5cfc594734f281b302e98f3d5dfebf3e::getLoader();25 return ComposerAutoloaderInita6d20a7c9bc887ce3cb59346b319f6dd::getLoader(); -
audienceplayer/trunk/vendor/composer/InstalledVersions.php
r2945999 r3298867 32 32 */ 33 33 private static $installed; 34 35 /** 36 * @var bool 37 */ 38 private static $installedIsLocalDir; 34 39 35 40 /** … … 310 315 self::$installed = $data; 311 316 self::$installedByVendor = array(); 317 318 // when using reload, we disable the duplicate protection to ensure that self::$installed data is 319 // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, 320 // so we have to assume it does not, and that may result in duplicate data being returned when listing 321 // all installed packages for example 322 self::$installedIsLocalDir = false; 312 323 } 313 324 … … 323 334 324 335 $installed = array(); 336 $copiedLocalDir = false; 325 337 326 338 if (self::$canGetVendors) { 339 $selfDir = strtr(__DIR__, '\\', '/'); 327 340 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 341 $vendorDir = strtr($vendorDir, '\\', '/'); 328 342 if (isset(self::$installedByVendor[$vendorDir])) { 329 343 $installed[] = self::$installedByVendor[$vendorDir]; … … 331 345 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 332 346 $required = require $vendorDir.'/composer/installed.php'; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 335 self::$installed = $installed[count($installed) - 1]; 347 self::$installedByVendor[$vendorDir] = $required; 348 $installed[] = $required; 349 if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { 350 self::$installed = $required; 351 self::$installedIsLocalDir = true; 336 352 } 353 } 354 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { 355 $copiedLocalDir = true; 337 356 } 338 357 } … … 351 370 } 352 371 353 if (self::$installed !== array() ) {372 if (self::$installed !== array() && !$copiedLocalDir) { 354 373 $installed[] = self::$installed; 355 374 } -
audienceplayer/trunk/vendor/composer/autoload_real.php
r3048935 r3298867 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 5cfc594734f281b302e98f3d5dfebf3e5 class ComposerAutoloaderInita6d20a7c9bc887ce3cb59346b319f6dd 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 5cfc594734f281b302e98f3d5dfebf3e', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInita6d20a7c9bc887ce3cb59346b319f6dd', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 5cfc594734f281b302e98f3d5dfebf3e', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInita6d20a7c9bc887ce3cb59346b319f6dd', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
audienceplayer/trunk/vendor/composer/autoload_static.php
r3048935 r3298867 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e7 class ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 38 38 { 39 39 return \Closure::bind(function () use ($loader) { 40 $loader->prefixLengthsPsr4 = ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e::$prefixLengthsPsr4;41 $loader->prefixDirsPsr4 = ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e::$prefixDirsPsr4;42 $loader->classMap = ComposerStaticInit 5cfc594734f281b302e98f3d5dfebf3e::$classMap;40 $loader->prefixLengthsPsr4 = ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd::$prefixLengthsPsr4; 41 $loader->prefixDirsPsr4 = ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd::$prefixDirsPsr4; 42 $loader->classMap = ComposerStaticInita6d20a7c9bc887ce3cb59346b319f6dd::$classMap; 43 43 44 44 }, null, ClassLoader::class); -
audienceplayer/trunk/vendor/composer/installed.php
r3093691 r3298867 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' 29f460d6d43eb9169464315fc26de985a96e91dd',6 'reference' => '3374afa17e8b39c6498b92b0a5aa363da5ac162b', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 23 23 'pretty_version' => 'dev-master', 24 24 'version' => 'dev-master', 25 'reference' => ' 29f460d6d43eb9169464315fc26de985a96e91dd',25 'reference' => '3374afa17e8b39c6498b92b0a5aa363da5ac162b', 26 26 'type' => 'wordpress-plugin', 27 27 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.