---
title: "OFBiz-alipay 配置文档"
author: "noodleLei"
date: "2010-10-18T11:34:12Z"
tags: ["C", "EXT", "F#", "Security", "XML"]
categories: ["编程语言"]
slug: "ofbiz-alipay"
draft: false
lastmod: "2010-10-18T11:34:12Z"
id: 787284
url: "https://noodlelei.iteye.com/blog/787284"
---

&lt;!-- \[if !mso]&gt; &lt;style&gt; v\\:* {behavior:url(#default#VML);} o\\:* {behavior:url(#default#VML);} w\\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} &lt;/style&gt; &lt;!\[endif]--&gt;&lt;!-- \[if gte mso 9]&gt;&lt;xml&gt; &lt;w:WordDocument&gt; &lt;w:View&gt;Normal&lt;/w:View&gt; &lt;w:Zoom&gt;0&lt;/w:Zoom&gt; &lt;w:PunctuationKerning/&gt; &lt;w:DrawingGridVerticalSpacing&gt;7.8 磅&lt;/w:DrawingGridVerticalSpacing&gt; &lt;w:DisplayHorizontalDrawingGridEvery&gt;0&lt;/w:DisplayHorizontalDrawingGridEvery&gt; &lt;w:DisplayVerticalDrawingGridEvery&gt;2&lt;/w:DisplayVerticalDrawingGridEvery&gt; &lt;w:ValidateAgainstSchemas/&gt; &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt; &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt; &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt; &lt;w:Compatibility&gt; &lt;w:SpaceForUL/&gt; &lt;w:BalanceSingleByteDoubleByteWidth/&gt; &lt;w:DoNotLeaveBackslashAlone/&gt; &lt;w:ULTrailSpace/&gt; &lt;w:DoNotExpandShiftReturn/&gt; &lt;w:AdjustLineHeightInTable/&gt; &lt;w:BreakWrappedTables/&gt; &lt;w:SnapToGridInCell/&gt; &lt;w:WrapTextWithPunct/&gt; &lt;w:UseAsianBreakRules/&gt; &lt;w:DontGrowAutofit/&gt; &lt;w:UseFELayout/&gt; &lt;/w:Compatibility&gt; &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt; &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;!\[endif]--&gt;&lt;!-- \[if gte mso 9]&gt;&lt;xml&gt; &lt;w:LatentStyles DefLockedState="false" LatentStyleCount="156"&gt; &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;!\[endif]--&gt; &lt;!-- /* Font Definitions \*/ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"\\@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions \*/ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} /* Page Definitions \*/ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:15.6pt;} div.Section1 {page:Section1;} --&gt; &lt;!-- \[if gte mso 10]&gt; &lt;style&gt; /* Style Definitions \*/ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} &lt;/style&gt; &lt;!\[endif]--&gt;

**OFBiz-alipay** **配置文档**

1\. 将支付宝的src 下的com 文件夹复制到本模块的src 文件夹下, 再把filters 文件夹复制到刚才的com.alipay 下.

2\. 在ecommerce 模块的controller.xml 中加入下面的代码:

&lt;request-map uri="checkExternalPayment"&gt;

        &lt;security https="true" direct-request="false"/&gt;

        &lt;event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="checkExternalPayment"/&gt;

        &lt;response name="none" type="request" value="emailorder"/&gt;

        &lt;response name="offline" type="request" value="emailorder"/&gt;

        &lt;response name="worldpay" type="request" value="callWorldPay"/&gt;

        &lt;response name="paypal" type="request" value="callPayPal"/&gt;

       

         &lt;response name="alipay" type="request" value="callAlipay"/&gt;&lt;!-- Wang Suozhu 2009-07-07 addtion --&gt;

        

        &lt;response name="billact" type="request" value="emailorder"/&gt;

        &lt;response name="cod" type="request" value="emailorder"/&gt;

        &lt;response name="error" type="view" value="checkoutreview"/&gt;

    &lt;/request-map&gt;

&lt;!-- Wang Suozhu 2009-07-07 begin --&gt;

    &lt;request-map uri="callAlipay"&gt;

         &lt;security https="true" direct-request="false"/&gt;

        &lt;event type="java" path="org.langhua.ofbiz.alipay.AlipayEvents" invoke="callAlipay"/&gt;

        &lt;response name="success" type="none"/&gt;

        &lt;response name="error" type="view" value="checkoutreview"/&gt;

    &lt;/request-map&gt;

    &lt;request-map uri="alipay\_return"&gt;

        &lt;security https="false" auth="false"/&gt;

        &lt;event type="java" path="org.langhua.ofbiz.alipay.AlipayServices" invoke="alipayReturn"/&gt;

        &lt;response name="success" type="view" value="alipay\_return"/&gt;

    &lt;/request-map&gt;

    &lt;request-map uri="alipay\_notify"&gt;

        &lt;security https="false" auth="false"/&gt;

        &lt;event type="java" path="org.langhua.ofbiz.alipay.AlipayServices" invoke="alipayNotify"/&gt;

        &lt;response name="success" type="view" value="alipay\_notify"/&gt;

    &lt;/request-map&gt;

   &lt;!-- Wang Suozhu 2009-07-07 end --&gt;

&lt;view-map name="alipay\_return" type="screen" page="component://alipay/widget/alipay/AlipayScreens.xml#alipay\_return"/&gt;

    &lt;view-map name="alipay\_notify" type="screen" page="component://alipay/widget/alipay/AlipayScreens.xml#alipay\_notify"/&gt;

 

 

3\. 在 [PaymentMethodType](http://localhost:8088/webtools/control/FindGeneric?entityName=PaymentMethodType&find=true&VIEW_SIZE=50&VIEW_INDEX=0) 实体里加入支付宝这种字符方式 (EXT\_ALIPAY)

&lt;!-- \[if gte vml 1]&gt;&lt;v:shapetype id="\_x0000\_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt; &lt;v:stroke joinstyle="miter"/&gt; &lt;v:formulas&gt; &lt;v:f eqn="if lineDrawn pixelLineWidth 0"/&gt; &lt;v:f eqn="sum @0 1 0"/&gt; &lt;v:f eqn="sum 0 0 @1"/&gt; &lt;v:f eqn="prod @2 1 2"/&gt; &lt;v:f eqn="prod @3 21600 pixelWidth"/&gt; &lt;v:f eqn="prod @3 21600 pixelHeight"/&gt; &lt;v:f eqn="sum @0 0 1"/&gt; &lt;v:f eqn="prod @6 1 2"/&gt; &lt;v:f eqn="prod @7 21600 pixelWidth"/&gt; &lt;v:f eqn="sum @8 21600 0"/&gt; &lt;v:f eqn="prod @7 21600 pixelHeight"/&gt; &lt;v:f eqn="sum @10 21600 0"/&gt; &lt;/v:formulas&gt; &lt;v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/&gt; &lt;o:lock v:ext="edit" aspectratio="t"/&gt; &lt;/v:shapetype&gt;&lt;v:shape id="\_x0000\_i1025" type="#\_x0000\_t75" style='width:414.75pt; height:59.25pt'&gt; &lt;v:imagedata src="file:///C:\\DOCUME~1\\CUITUO~1\\LOCALS~1\\Temp\\msohtml1\\06\\clip\_image001.png" o:title=""/&gt; &lt;/v:shape&gt;&lt;!\[endif]--&gt;&lt;!-- \[if !vml]--&gt;&lt;!-- \[endif]--&gt;

将支付宝这种支付方式加入产品店铺

&lt;!-- \[if gte vml 1]&gt;&lt;v:shape id="\_x0000\_i1026" type="#\_x0000\_t75" style='width:415.5pt;height:44.25pt'&gt; &lt;v:imagedata src="file:///C:\\DOCUME~1\\CUITUO~1\\LOCALS~1\\Temp\\msohtml1\\06\\clip\_image003.png" o:title=""/&gt; &lt;/v:shape&gt;&lt;!\[endif]--&gt;&lt;!-- \[if !vml]--&gt;&lt;!-- \[endif]--&gt;

&lt;!-- \[if gte vml 1]&gt;&lt;v:shape id="\_x0000\_i1027" type="#\_x0000\_t75" style='width:343.5pt;height:135.75pt'&gt; &lt;v:imagedata src="file:///C:\\DOCUME~1\\CUITUO~1\\LOCALS~1\\Temp\\msohtml1\\06\\clip\_image005.png" o:title=""/&gt; &lt;/v:shape&gt;&lt;!\[endif]--&gt;&lt;!-- \[if !vml]--&gt;&lt;!-- \[endif]--&gt;

&lt;!-- \[if gte vml 1]&gt;&lt;v:shape id="\_x0000\_i1028" type="#\_x0000\_t75" style='width:414.75pt;height:83.25pt'&gt; &lt;v:imagedata src="file:///C:\\DOCUME~1\\CUITUO~1\\LOCALS~1\\Temp\\msohtml1\\06\\clip\_image007.png" o:title=""/&gt; &lt;/v:shape&gt;&lt;!\[endif]--&gt;&lt;!-- \[if !vml]--&gt;&lt;!-- \[endif]--&gt;

4\. 在下面的付款方式页面中 (checkoutopptions.ftl) 加入支付宝的支付方式

 

&lt;!-- \[if gte vml 1]&gt;&lt;v:shape id="\_x0000\_i1029" type="#\_x0000\_t75" style='width:414.75pt;height:163.5pt'&gt; &lt;v:imagedata src="file:///C:\\DOCUME~1\\CUITUO~1\\LOCALS~1\\Temp\\msohtml1\\06\\clip\_image009.png" o:title=""/&gt; &lt;/v:shape&gt;&lt;!\[endif]--&gt;&lt;!-- \[if !vml]--&gt;&lt;!-- \[endif]--&gt;

代码如下 :

&lt;!-- Wang Suozhu 2009-07-07   begin--&gt;

                  &lt;#if productStorePaymentMethodTypeIdMap.EXT\_ALIPAY?exists&gt;

                  &lt;tr&gt;

                    &lt;td width="1%"&gt;

                      &lt;input type="radio" name="checkOutPaymentId" value="EXT\_ALIPAY" &lt;#if "EXT\_ALIPAY" == checkOutPaymentId&gt;checked="checked"&lt;/#if&gt;/&gt;

                    &lt;/td&gt;

                    &lt;td width="50%"&gt;

                      &lt;span class="tabletext"&gt; 支付宝&lt;/span&gt;

                    &lt;/td&gt;

                  &lt;/tr&gt;

                  &lt;/#if&gt;

                  &lt;!-- Wang Suozhu 2009-07-07   end--&gt;