{"id":1665,"date":"2023-03-25T22:14:01","date_gmt":"2023-03-25T14:14:01","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1665"},"modified":"2023-04-23T21:53:49","modified_gmt":"2023-04-23T13:53:49","slug":"implementation-principles-of-zenart-class-library-payment-php","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/implementation-principles-of-zenart-class-library-payment-php\/","title":{"rendered":"ZenCart\u7c7b\u5e93payment.php\u89e3\u8bfb\u5b9e\u73b0\u539f\u7406"},"content":{"rendered":"<p>\u8def\u5f84\uff1a<code>includes\/classes\/payment.php<\/code><br \/>\npaypal\uff1a<code>includes\/modules\/payment\/paypal.php<\/code><br \/>\n\u53c2\u8003\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/blog.csdn.net\/yueyekonglong\/category_9655974.html\">https:\/\/blog.csdn.net\/yueyekonglong\/category_9655974.html<\/a><\/p>\n<h3>__construct<\/h3>\n<p><!-- more --><\/p>\n<p>Constructor\uff0c\u5373\u6784\u9020\u5668<\/p>\n<h3>\u51fd\u6570 update_status()<\/h3>\n<p>Calculate zone matches and flag settings to determine whether this module should display to customers or not.<\/p>\n<p>\u8ba1\u7b97\u533a\u57df\u5339\u914d\u5e76\u6807\u8bb0\u8bbe\u7f6e\u4ee5\u786e\u5b9a\u6b64\u6a21\u5757\u662f\u5426\u5e94\u663e\u793a\u7ed9\u5ba2\u6237<\/p>\n<h3>\u51fd\u6570 javascript_validation()<\/h3>\n<p>JS validation which does error-checking of data-entry if this module is selected for use (Number, Owner Lengths).<\/p>\n<p>JS\u9a8c\u8bc1\uff0c\u5982\u679c\u9009\u62e9\u4f7f\u7528\u6b64\u6a21\u5757\uff0c\u5219\u5c06\u5bf9\u6570\u636e\u8f93\u5165\u8fdb\u884c\u9519\u8bef\u68c0\u67e5\uff08\u6570\u5b57\uff0c\u6240\u6709\u8005\u957f\u5ea6\uff09<\/p>\n<h3>\u51fd\u6570 selection()<\/h3>\n<p>Display Credit Card Information Submission Fields on the Checkout Payment Page.<\/p>\n<p>\u5728\u7ed3\u5e10\u4ed8\u6b3e\u9875\u9762 Checkout Payment Page \u4e0a\u663e\u793a\u4fe1\u7528\u5361\u4fe1\u606f\u63d0\u4ea4\u5b57\u6bb5<\/p>\n<h3>\u51fd\u6570 pre_confirmation_check()<\/h3>\n<p>Evaluates the Credit Card Type for acceptance and the validity of the Credit Card Number &amp; Expiration Date.<\/p>\n<p>\u8bc4\u4f30\u53ef\u63a5\u53d7\u7684\u4fe1\u7528\u5361\u7c7b\u578b\uff0c\u4ee5\u53ca\u4fe1\u7528\u5361\u53f7\u548c\u6709\u6548\u671f\u7684\u6709\u6548\u6027 <\/p>\n<h3>\u51fd\u6570 confirmation()<\/h3>\n<p>Display Credit Card Information on the Checkout Confirmation Page.<\/p>\n<p>\u5728\u7ed3\u5e10\u786e\u8ba4\u9875\u9762\u4e0a\u663e\u793a\u4fe1\u7528\u5361\u4fe1\u606f<\/p>\n<p>\u6b64\u51fd\u6570\u548c\u63d0\u4ea4\u903b\u8f91\u6ca1\u6709\u5173\u7cfb<\/p>\n<h3>\u51fd\u6570 process_button()<\/h3>\n<p>Build the data and actions to process when the &quot;Submit&quot; button is pressed on the order-confirmation screen.<br \/>\nThis sends the data to the payment gateway for processing.<br \/>\n(These are hidden fields on the checkout confirmation page)<\/p>\n<p>\u5efa\u7acb\u5728\u8ba2\u5355\u786e\u8ba4\u5c4f\u5e55\u4e0a\u6309\u4e0b\u201c\u63d0\u4ea4\u201d\u6309\u94ae\u65f6\u8981\u5904\u7406\u7684\u6570\u636e\u548c\u64cd\u4f5c<br \/>\n\u8fd9\u4f1a\u5c06\u6570\u636e\u53d1\u9001\u5230\u652f\u4ed8\u7f51\u5173\u8fdb\u884c\u5904\u7406<br \/>\n\uff08\u8fd9\u4e9b\u662f\u7ed3\u5e10\u786e\u8ba4\u9875\u9762\u4e0a\u7684\u9690\u85cf\u5b57\u6bb5\uff09<\/p>\n<h3>\u51fd\u6570 before_process()<\/h3>\n<p>Store the CC info to the order and process any results that come back from the payment gateway.<\/p>\n<p>\u5c06\u6284\u9001\u4fe1\u606f\u5b58\u50a8\u5230\u8ba2\u5355\u4e2d\uff0c\u5e76\u5904\u7406\u4ece\u4ed8\u6b3e\u7f51\u5173\u8fd4\u56de\u7684\u6240\u6709\u7ed3\u679c<\/p>\n<h3>after_process()<\/h3>\n<p>Post-processing activities. Updates the order-status history data with the auth code from the transaction.<br \/>\nAdd receipt and transaction id to order-status-history (order comments)<\/p>\n<p>\u540e\u5904\u7406\u6d3b\u52a8\uff0c\u4f7f\u7528\u4ea4\u6613\u4e2d\u7684\u9a8c\u8bc1\u7801\u66f4\u65b0\u8ba2\u5355\u72b6\u6001\u5386\u53f2\u8bb0\u5f55\u6570\u636e<\/p>\n<h3>check()<\/h3>\n<p>Check to see whether module is installed.<\/p>\n<p>\u68c0\u67e5\u662f\u5426\u5b89\u88c5\u4e86\u6a21\u5757<\/p>\n<h3>install()<\/h3>\n<p>Install the payment module and its configuration settings.<\/p>\n<p>\u5b89\u88c5\u652f\u4ed8\u6a21\u5757\u53ca\u5176\u914d\u7f6e\u8bbe\u7f6e<\/p>\n<h3>remove()<\/h3>\n<p>\u5220\u9664\u6a21\u5757\u53ca\u5176\u6240\u6709\u8bbe\u7f6e<\/p>\n<h3>keys()<\/h3>\n<p>Internal list of configuration keys used for configuration of the module.<\/p>\n<p>\u7528\u4e8e\u914d\u7f6e\u6a21\u5757\u7684\u914d\u7f6e\u5bc6\u94a5\u7684\u5185\u90e8\u5217\u8868<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8def\u5f84\uff1aincludes\/classes\/payment.php paypal\uff1aincludes\/modules [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[416],"class_list":["post-1665","post","type-post","status-publish","format-standard","hentry","category-php","tag-zencart"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1665"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1665\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}