Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam AD0-E722 topic 1 question 26 discussion

Actual exam question from Adobe's AD0-E722
Question #: 26
Topic #: 1
[All AD0-E722 Questions]

While reviewing a newly developed pull request that refactors multiple custom payment methods, the Architect notices multiple classes that depend on \Magento\Framework\Encryption\EncryptorInterface to decrypt credentials for sensitive data. The code that is commonly repeated is as follows:

In each module, the user_secret config is declared as follows:

The Architect needs to recommend an optimal solution to avoid redundant dependency and duplicate code among the methods.
Which solution should the Architect recommend?

  • A. Create a common config service class Vendor\Payment\Gateway\Config\Config under Vendor_Payment and use it as a parent class for all of the Vendor\PaymentModule\Gateway\Config\Config classes and remove $scopeConfig and $encryptor dependencies
  • B. Replace all Vendor\PaymentModule\Gateway\Config\Config classes with virtualType of Magento\Payment\Gateway\Config\Config and set <user_secret backend_model=“Magento\Config\Model\Config\Backend\Encrypted” /> under config.xml
  • C. Add a plugin after the getValue method of $scopeConfig, remove the $encryptor from dependency and use it in the plugin to decrypt the value if the config name is ‘user_secret’
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
raideer
1 month, 3 weeks ago
Selected Answer: B
Adding a plugin to ScopeConfig would not be a good practice as it's called in almost every single module which would potentially impact performance and cause bugs. Answer B is correct. You can add backend_model=“Magento\Config\Model\Config\Backend\Encrypted” to fields in config.xml to automatically decrypt them. Using a payment config virtual type is also a common practice (see Braintree module)
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
ex Want to SAVE BIG on Certification Exam Prep?
close
ex Unlock All Exams with ExamTopics Pro 75% Off
  • arrow Choose From 1000+ Exams
  • arrow Access to 10 Exams per Month
  • arrow PDF Format Available
  • arrow Inline Discussions
  • arrow No Captcha/Robot Checks
Limited Time Offer
Ends in