config.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * This file is part of the Klarna KP module
  3. *
  4. * (c) Klarna Bank AB (publ)
  5. *
  6. * For the full copyright and license information, please view the NOTICE
  7. * and LICENSE files that were distributed with this source code.
  8. */
  9. define(
  10. [
  11. 'ko'
  12. ],
  13. function (ko) {
  14. 'use strict';
  15. var client_token = window.checkoutConfig.payment.klarna_kp.client_token,
  16. message = window.checkoutConfig.payment.klarna_kp.message,
  17. authorization_token = ko.observable(window.checkoutConfig.payment.klarna_kp.authorization_token),
  18. debug = window.checkoutConfig.payment.klarna_kp.debug,
  19. enabled = window.checkoutConfig.payment.klarna_kp.enabled,
  20. success = window.checkoutConfig.payment.klarna_kp.success,
  21. hasErrors = ko.observable(false),
  22. available_methods = window.checkoutConfig.payment.klarna_kp.available_methods;
  23. return {
  24. hasErrors: hasErrors,
  25. debug: debug,
  26. enabled: enabled,
  27. client_token: client_token,
  28. message: message,
  29. success: success,
  30. authorization_token: authorization_token,
  31. available_methods: available_methods,
  32. getTitle: function (code) {
  33. if (window.checkoutConfig.payment.klarna_kp[code]) {
  34. return window.checkoutConfig.payment.klarna_kp[code].title;
  35. }
  36. return 'Klarna Payments';
  37. },
  38. getLogo: function (code) {
  39. if (window.checkoutConfig.payment.klarna_kp[code]) {
  40. return window.checkoutConfig.payment.klarna_kp[code].logo;
  41. }
  42. return '';
  43. }
  44. };
  45. }
  46. );