用angular-fullstack生成器实现Braintree-Angular支付网关

时间:2018-07-28 23:11:35

标签: angularjs mean-stack braintree braintree-sandbox

我尝试了很多次,以至于我在使用braintree-angular和braintree-web并使用angularjs fullstack的时候变得秃顶,但是当我在chekout页面中时,我遇到了令牌错误,并且没有付款选项没有显示...

product-checkout.html // ngcart可以正常工作

<div class="container">
    <div class="row">
        <h1>Cart</h1>
        <ngcart-cart template-url="components/ngcart/cart.html"></ngcart-cart>
    </div>
    <div class="row">enter code here
        <h1>Choose a payment method</h1>
        <p class="help-block">{{ errors }}</p>
        <br>
        <div class="col-md-6">
            <form>
                <braintree-dropin options="paymentOptions">Loading...</braintree-dropin>

                    <input type="submit" value="Purchase" />
            </form>
        </div>
    </div>
    </div>

(我认为Braintree-dropin不再起作用,因为它已弃用)

我每次在结帐页面上收到的错误

angular.js:14961 TypeError: $braintree.getClientToken(...).success is not a
function
    at Object.$braintree.setupDropin (braintree-factory.js:28)
    at controller (braintree-angular.js:24)
    at Object.invoke (angular.js:5117)
    at $controllerInit (angular.js:11139)
    at nodeLinkFn (angular.js:10002)
    at compositeLinkFn (angular.js:9311)
    at nodeLinkFn (angular.js:10065)
    at compositeLinkFn (angular.js:9311)
    at compositeLinkFn (angular.js:9314)
    at compositeLinkFn (angular.js:9314)
    at compositeLinkFn (angular.js:9314)
    at nodeLinkFn (angular.js:10065)
    at compositeLinkFn (angular.js:9311)
    at publicLinkFn (angular.js:9176)
    at Object.<anonymous> (angular-ui-router.js:4138)
    at angular.js:1393
    at invokeLinkFn (angular.js:10682)
    at nodeLinkFn (angular.js:10071)
    at compositeLinkFn (angular.js:9311)
    at publicLinkFn (angular.js:9176)
    at lazyCompilation (angular.js:9567)
    at updateView (angular-ui-router.js:4056)
    at angular-ui-router.js:4005
    at Scope.$broadcast (angular.js:19123)
    at angular-ui-router.js:3369
    at processQueue (angular.js:17330)
    at angular.js:17378
    at Scope.$digest (angular.js:18515)
    at Scope.$apply (angular.js:18903)
    at angular.js:20829
    at completeOutstandingRequest (angular.js:6439)
    at angular.js:6718 "<div ui-view="" class="ng-scope">"
(anonymous) @ angular.js:14961
**api/braintree/client_token:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)**
angular.js:14961 Possibly unhandled rejection: {"data":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>**TypeError: _braintree2.default.findById is not a function<br> &nbsp; &nbsp;at show (D:/Projects/meanstore/server/api/braintree/braintree.controller.js:70:20)**<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\layer.js:95:5)<br> &nbsp; &nbsp;at next (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\route.js:137:13)<br> &nbsp; &nbsp;at Route.dispatch (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\route.js:112:3)<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\layer.js:95:5)<br> &nbsp; &nbsp;at D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:281:22<br> &nbsp; &nbsp;at param (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:354:14)<br> &nbsp; &nbsp;at param (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:365:14)<br> &nbsp; &nbsp;at Function.process_params (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:410:3)<br> &nbsp; &nbsp;at next (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:275:10)<br> &nbsp; &nbsp;at Function.handle (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:174:3)<br> &nbsp; &nbsp;at router (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:47:12)<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\layer.js:95:5)<br> &nbsp; &nbsp;at trim_prefix (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:317:13)<br> &nbsp; &nbsp;at D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:284:7<br> &nbsp; &nbsp;at Function.process_params (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:335:12)<br> &nbsp; &nbsp;at next (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:275:10)<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\layer.js:91:12)<br> &nbsp; &nbsp;at trim_prefix (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:317:13)<br> &nbsp; &nbsp;at D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:284:7<br> &nbsp; &nbsp;at Function.process_params (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:335:12)<br> &nbsp; &nbsp;at next (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:275:10)</pre>\n</body>\n</html>\n","status":500,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"/api/braintree/client_token",
"headers":{"Accept":"application/json, text/plain, */*","X-XSRF-TOKEN":"t2sFfL5kWBa2Jo4GXP9OqmR2Ox9WJVtbxIH2w="}},"statusText":"Internal Server Error","xhrStatus":"complete"}

后来我从Braintree-Angular存储库中发现它不再维护了...所以请有人建议我可以使用另一种方法,因为我浪费了太多时间。

0 个答案:

没有答案