Installing paypal_integration have issue

I try to install the paypal_integration app, but it show error.

bench --site site1.local install-app paypal_integration
Installing paypal_integration…
Updating paypal_integration : [========================================]
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 163, in install_app
_install_app(app, verbose=context.verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 126, in install_app
add_to_installed_apps(name)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 145, in add_to_installed_apps
post_install(rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 191, in post_install
init_singles()
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 212, in init_singles
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 231, in save
self.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 211, in insert
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 613, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 557, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 712, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 695, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 551, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/paypal_integration/doctype/paypal_settings/paypal_settings.py”, line 13, in on_update
create_gateway_account()
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/after_install.py”, line 26, in create_gateway_account
if not bank.name:
AttributeError: ‘NoneType’ object has no attribute ‘name’

You might have to update your erpnext app first

Thanks for your help.
the problem is fixed.

the install problem is fixed.
but it have problem in setting step.

Please type some additional information that could help us reproduce this issue:

App Versions
{
“erpnext”: “6.20.0”,
“frappe”: “6.21.0”,
“paypal_integration”: “0.0.1”
}
Route
Form/PayPal Settings/PayPal Settings

Error Report
Traceback (innermost last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 18, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 255, in save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 613, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 557, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 712, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 695, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 551, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/paypal_integration/doctype/paypal_settings/paypal_settings.py”, line 13, in on_update
create_gateway_account()
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/after_install.py”, line 26, in create_gateway_account
if not bank.name:
AttributeError: ‘NoneType’ object has no attribute ‘name’

Traceback (innermost last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 69, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 20, in handle
execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 37, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 801, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 18, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 255, in save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 613, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 557, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 712, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 695, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 551, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/paypal_integration/doctype/paypal_settings/paypal_settings.py”, line 13, in on_update
create_gateway_account()
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/after_install.py”, line 26, in create_gateway_account
if not bank.name:
AttributeError: ‘NoneType’ object has no attribute ‘name’

Request Data
{
“type”: “POST”,
“args”: {
“doc”: “{“paypal_sandbox”:1,“name”:“PayPal Settings",“idx”:0,“owner”:"info@demosx.com”,“docstatus”:0,“doctype”:“PayPal Settings”,”__last_sync_on":“2016-02-06T10:05:57.870Z”,“signature”:“AFcWxV21C7fd0v3bYYYRCpSSRl31AxQ6mUoqKjIeyr5GGeoEq-UZUE9E”,"__unsaved":1,“api_password”:"*****",“api_username”:“info-facilitator_api1.demosx.com”}",
“action”: “Save”,
“cmd”: “frappe.desk.form.save.savedocs”
},
“btn”: {},
“freeze”: true,
“freeze_message”: “Saving”,
“url”: “/”
}

Response JSON
{
“_server_messages”: “[“Did not save”]”
}

Pushed a fix

It have new error now.

Installing paypal_integration…
Updating paypal_integration : [========================================]
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 163, in install_app
_install_app(app, verbose=context.verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 126, in install_app
add_to_installed_apps(name)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 145, in add_to_installed_apps
post_install(rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 191, in post_install
init_singles()
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 212, in init_singles
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 231, in save
self.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 211, in insert
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 613, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 557, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 712, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 695, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 551, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/paypal_integration/doctype/paypal_settings/paypal_settings.py”, line 13, in on_update
create_gateway_account()
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/after_install.py”, line 41, in create_gateway_account
"payment_account": bank_account.name,
AttributeError: ‘unicode’ object has no attribute 'name’

Fixed :smile:

Still have problem.
But i manually added the table line, then the install problem is fixed.

then, it have new problem,when making the payment.
when erpnext’s default Currency is set to CNY, and i set Currency for paypay account is USD.

the website show need to pay 39.68USD, but paypal sandbox show it received $ 249.98.

Traceback (innermost last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 72, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 50, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 20, in handle
execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 37, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 801, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/express_checkout.py”, line 116, in confirm_payment
trigger_ref_doc(paypal_express_payment, “set_as_paid”)
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/express_checkout.py”, line 171, in trigger_ref_doc
ref_doc.run_method(method)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 557, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 712, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 695, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 551, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/payment_request/payment_request.py”, line 78, in set_as_paid
jv = self.create_journal_entry()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/payment_request/payment_request.py”, line 105, in create_journal_entry
jv.insert(ignore_permissions=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 193, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 595, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 557, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 712, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 695, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 551, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py”, line 31, in validate
self.validate_total_debit_and_credit()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py”, line 267, in validate_total_debit_and_credit
.format(self.difference))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 265, in throw
msgprint(msg, raise_exception=exc)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 258, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 243, in _raise_exception
raise raise_exception, encode(msg)
ValidationError: Total Debit must be equal to Total Credit. The difference is 1324.89

Another bug,
I change erpnext’s default Currency is set to USD, then the payment is success.
But when it retern from paypal’s website to erpnext,it have issue:

Traceback (innermost last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 72, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 50, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 20, in handle
execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 37, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 801, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/express_checkout.py”, line 116, in confirm_payment
trigger_ref_doc(paypal_express_payment, “set_as_paid”)
File “/home/frappe/frappe-bench/apps/paypal_integration/paypal_integration/express_checkout.py”, line 177, in trigger_ref_doc
success_url = shopping_cart_settings.payment_success_url
AttributeError: ‘ShoppingCartSettings’ object has no attribute 'payment_success_url’

@iHello Thanks for testing!

CC @saurabh6790

@iHello

Thanks for reporting. We will fix this and update you soon.