Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos.core
Commits
21504241
Commit
21504241
authored
Dec 19, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Rework payment transaction generation
See merge request
nexedi/slapos.core!459
parents
5128c902
48b9b61f
Changes
98
Hide whitespace changes
Inline
Side-by-side
Showing
98 changed files
with
1487 additions
and
2910 deletions
+1487
-2910
master/bt5/slapos_accounting/ActionTemplateItem/portal_types/Sale%20Invoice%20Transaction/create_slapos_reversal.xml
...s/Sale%20Invoice%20Transaction/create_slapos_reversal.xml
+1
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/AccountingTransactionModule_getUnpaidInvoiceList.py
...nting/AccountingTransactionModule_getUnpaidInvoiceList.py
+3
-9
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/AccountingTransaction_getPaymentState.py
...lapos_accounting/AccountingTransaction_getPaymentState.py
+19
-11
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_cancelStartedPaymentTransactionPaid.py
...s_accounting/Alarm_cancelStartedPaymentTransactionPaid.py
+1
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Base_getReceivableAccountList.py
..._skins/slapos_accounting/Base_getReceivableAccountList.py
+6
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Base_getReceivableAccountList.xml
...skins/slapos_accounting/Base_getReceivableAccountList.xml
+9
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Entity_createPaymentTransaction.py
...kins/slapos_accounting/Entity_createPaymentTransaction.py
+79
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Entity_createPaymentTransaction.xml
...ins/slapos_accounting/Entity_createPaymentTransaction.xml
+2
-2
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Entity_getOutstandingAmountList.py
...kins/slapos_accounting/Entity_getOutstandingAmountList.py
+42
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Entity_getOutstandingAmountList.xml
...ins/slapos_accounting/Entity_getOutstandingAmountList.xml
+2
-2
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_cancelIfSaleInvoiceTransactionIsLettered.py
...ntTransaction_cancelIfSaleInvoiceTransactionIsLettered.py
+2
-25
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_cancelIfSaleInvoiceTransactionIsLettered.xml
...tTransaction_cancelIfSaleInvoiceTransactionIsLettered.xml
+1
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createReversalSaleInvoiceTransaction.py
...nvoiceTransaction_createReversalSaleInvoiceTransaction.py
+58
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createReversalSaleInvoiceTransaction.xml
...voiceTransaction_createReversalSaleInvoiceTransaction.xml
+2
-2
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createSlapOSReversalTransaction.py
...SaleInvoiceTransaction_createSlapOSReversalTransaction.py
+0
-10
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createSlapOSReversalTransaction.xml
...aleInvoiceTransaction_createSlapOSReversalTransaction.xml
+0
-62
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_getSlapOSPaymentRelated.py
...ounting/SaleInvoiceTransaction_getSlapOSPaymentRelated.py
+0
-3
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_getSlapOSPaymentRelatedValue.py
...ng/SaleInvoiceTransaction_getSlapOSPaymentRelatedValue.py
+0
-8
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_getSlapOSPaymentRelatedValue.xml
...g/SaleInvoiceTransaction_getSlapOSPaymentRelatedValue.xml
+0
-62
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isLettered.py
...ns/slapos_accounting/SaleInvoiceTransaction_isLettered.py
+18
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isLettered.xml
...s/slapos_accounting/SaleInvoiceTransaction_isLettered.xml
+9
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_redirectToManualSlapOSPayment.py
...g/SaleInvoiceTransaction_redirectToManualSlapOSPayment.py
+21
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_redirectToManualSlapOSPayment.xml
.../SaleInvoiceTransaction_redirectToManualSlapOSPayment.xml
+1
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_viewCancelPaymentAndCreateReversalTransactionDialog.xml
...n_viewCancelPaymentAndCreateReversalTransactionDialog.xml
+5
-1
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
.../portal_components/test.erp5.testSlapOSAccountingAlarm.py
+33
-13
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.xml
...portal_components/test.erp5.testSlapOSAccountingAlarm.xml
+3
-24
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
.../portal_components/test.erp5.testSlapOSAccountingSkins.py
+522
-50
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSEntityCreatePayment.py
...tal_components/test.erp5.testSlapOSEntityCreatePayment.py
+57
-63
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSEntityCreatePayment.xml
...al_components/test.erp5.testSlapOSEntityCreatePayment.xml
+5
-26
master/bt5/slapos_accounting/bt/template_test_id_list
master/bt5/slapos_accounting/bt/template_test_id_list
+2
-1
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
...omponents/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
+37
-62
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+4
-24
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.xml
...eItem/portal_components/test.erp5.SlapOSTestCaseMixin.xml
+3
-24
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_createRegularisationRequest.py
...tal_skins/slapos_crm/Alarm_createRegularisationRequest.py
+21
-2
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.py
...s/slapos_crm/Person_checkToCreateRegularisationRequest.py
+4
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_getSubscriptionRequestFirstUnpaidInvoiceList.py
...rm/Person_getSubscriptionRequestFirstUnpaidInvoiceList.py
+3
-3
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_getSubscriptionRequestFirstUnpaidInvoiceList.xml
...m/Person_getSubscriptionRequestFirstUnpaidInvoiceList.xml
+1
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIfPersonBalanceIsOk.py
...rm/RegularisationRequest_invalidateIfPersonBalanceIsOk.py
+4
-4
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+78
-31
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCodingStyle.py
...Item/portal_components/test.erp5.testSlapOSCodingStyle.py
+1
-1
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5DefaultScenario.py
...tal_components/test.erp5.testSlapOSERP5DefaultScenario.py
+24
-74
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5DefaultScenario.xml
...al_components/test.erp5.testSlapOSERP5DefaultScenario.xml
+3
-24
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_js.js
...e_module/rjs_gadget_erp5_page_slap_all_invoice_list_js.js
+1
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_js.xml
..._module/rjs_gadget_erp5_page_slap_all_invoice_list_js.xml
+1
-1
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_invoice_list_js.js
..._page_module/rjs_gadget_erp5_page_slap_invoice_list_js.js
+1
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_invoice_list_js.xml
...page_module/rjs_gadget_erp5_page_slap_invoice_list_js.xml
+2
-2
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_js.js
...gadget_erp5_page_slap_sale_invoice_transaction_view_js.js
+1
-1
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_js.xml
...adget_erp5_page_slap_sale_invoice_transaction_view_js.xml
+2
-2
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_invoice_state_js.js
...tem/web_page_module/rjs_gadget_slapos_invoice_state_js.js
+4
-5
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_invoice_state_js.xml
...em/web_page_module/rjs_gadget_slapos_invoice_state_js.xml
+1
-1
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/AccountingTransaction_getPaymentStateAsHateoas.py
...n_style/AccountingTransaction_getPaymentStateAsHateoas.py
+2
-6
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SaleInvoiceTransaction_viewAsHateoas.xml
...s_hal_json_style/SaleInvoiceTransaction_viewAsHateoas.xml
+0
-1
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SaleInvoiceTransaction_viewAsHateoas/my_payment_transaction.xml
...voiceTransaction_viewAsHateoas/my_payment_transaction.xml
+0
-124
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSInvoiceUnpaid.zpt
...portal_tests/slaposjs_zuite/testSlapOSJSInvoiceUnpaid.zpt
+6
-6
master/bt5/slapos_jio_ui_test/SkinTemplateItem/portal_skins/slapos_ui_test/ERP5Site_createSlapOSFakeInvoiceForTestUser.py
...os_ui_test/ERP5Site_createSlapOSFakeInvoiceForTestUser.py
+8
-0
master/bt5/slapos_payzen/PathTemplateItem/portal_alarms/slapos_payzen_update_confirmed_payment.xml
.../portal_alarms/slapos_payzen_update_confirmed_payment.xml
+0
-97
master/bt5/slapos_payzen/PathTemplateItem/portal_alarms/slapos_trigger_payment_transaction_order_builder.xml
...arms/slapos_trigger_payment_transaction_order_builder.xml
+0
-97
master/bt5/slapos_payzen/PathTemplateItem/portal_orders/slapos_payment_transaction_builder/category_movement_group_on_delivery.xml
...ansaction_builder/category_movement_group_on_delivery.xml
+0
-64
master/bt5/slapos_payzen/PathTemplateItem/portal_orders/slapos_payment_transaction_builder/category_movement_group_on_line.xml
...t_transaction_builder/category_movement_group_on_line.xml
+0
-57
master/bt5/slapos_payzen/PathTemplateItem/portal_orders/slapos_payment_transaction_builder/property_movement_group_on_line.xml
...t_transaction_builder/property_movement_group_on_line.xml
+0
-55
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_triggerPaymentTransactionOrderBuilder.py
...pos_payzen/Alarm_triggerPaymentTransactionOrderBuilder.py
+0
-4
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_triggerPaymentTransactionOrderBuilder.xml
...os_payzen/Alarm_triggerPaymentTransactionOrderBuilder.xml
+0
-62
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_updatePayzenConfirmedPaymentTransaction.py
...s_payzen/Alarm_updatePayzenConfirmedPaymentTransaction.py
+0
-12
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_updatePayzenConfirmedPaymentTransaction.xml
..._payzen/Alarm_updatePayzenConfirmedPaymentTransaction.xml
+0
-62
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/OrderBuilder_generateUnrelatedInvoiceList.py
...lapos_payzen/OrderBuilder_generateUnrelatedInvoiceList.py
+0
-71
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/OrderBuilder_generateUnrelatedInvoiceList.xml
...apos_payzen/OrderBuilder_generateUnrelatedInvoiceList.xml
+0
-62
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_startPayzenPayment.py
...ns/slapos_payzen/PaymentTransaction_startPayzenPayment.py
+0
-13
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.py
...Item/portal_components/test.erp5.testSlapOSPayzenAlarm.py
+21
-210
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
...tem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
+3
-24
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenEntityCreatePayment.py
...mponents/test.erp5.testSlapOSPayzenEntityCreatePayment.py
+33
-0
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenEntityCreatePayment.xml
...ponents/test.erp5.testSlapOSPayzenEntityCreatePayment.xml
+10
-25
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenSkins.py
...Item/portal_components/test.erp5.testSlapOSPayzenSkins.py
+54
-255
master/bt5/slapos_payzen/bt/template_path_list
master/bt5/slapos_payzen/bt/template_path_list
+0
-4
master/bt5/slapos_payzen/bt/template_test_id_list
master/bt5/slapos_payzen/bt/template_test_id_list
+1
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_notifyPaymentIsReady.py
...ption_request/SubscriptionRequest_notifyPaymentIsReady.py
+1
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_notifyPaymentIsReady.xml
...tion_request/SubscriptionRequest_notifyPaymentIsReady.xml
+1
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_processOrdered.py
...ubscription_request/SubscriptionRequest_processOrdered.py
+4
-6
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_testPaymentBalance.py
...ription_request/SubscriptionRequest_testPaymentBalance.py
+5
-5
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_verifyPaymentBalanceIsReady.py
...equest/SubscriptionRequest_verifyPaymentBalanceIsReady.py
+6
-8
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionCancellationScenario.py
...s/test.erp5.testSlapOSSubscriptionCancellationScenario.py
+0
-14
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionCancellationScenario.xml
.../test.erp5.testSlapOSSubscriptionCancellationScenario.xml
+3
-24
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+27
-53
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.xml
...l_components/test.erp5.testSlapOSSubscriptionScenario.xml
+3
-24
master/bt5/slapos_wechat/PathTemplateItem/portal_alarms/slapos_wechat_update_confirmed_payment.xml
.../portal_alarms/slapos_wechat_update_confirmed_payment.xml
+0
-101
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/Alarm_updateWechatConfirmedPaymentTransaction.py
...s_wechat/Alarm_updateWechatConfirmedPaymentTransaction.py
+0
-12
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/Alarm_updateWechatConfirmedPaymentTransaction.xml
..._wechat/Alarm_updateWechatConfirmedPaymentTransaction.xml
+0
-62
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/PaymentTransaction_startWechatPayment.py
...ns/slapos_wechat/PaymentTransaction_startWechatPayment.py
+0
-13
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/SaleInvoiceTransaction_createReversalWechatTransaction.py
...SaleInvoiceTransaction_createReversalWechatTransaction.py
+0
-55
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/SaleInvoiceTransaction_getWechatPaymentRelatedValue.py
...at/SaleInvoiceTransaction_getWechatPaymentRelatedValue.py
+0
-7
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/SaleInvoiceTransaction_getWechatPaymentRelatedValue.xml
...t/SaleInvoiceTransaction_getWechatPaymentRelatedValue.xml
+0
-62
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatAlarm.py
...Item/portal_components/test.erp5.testSlapOSWechatAlarm.py
+21
-210
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatAlarm.xml
...tem/portal_components/test.erp5.testSlapOSWechatAlarm.xml
+3
-24
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatBuilder.py
...em/portal_components/test.erp5.testSlapOSWechatBuilder.py
+0
-19
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatEntityCreatePayment.py
...mponents/test.erp5.testSlapOSWechatEntityCreatePayment.py
+33
-0
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatEntityCreatePayment.xml
...ponents/test.erp5.testSlapOSWechatEntityCreatePayment.xml
+106
-0
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatSkins.py
...Item/portal_components/test.erp5.testSlapOSWechatSkins.py
+36
-249
master/bt5/slapos_wechat/bt/template_path_list
master/bt5/slapos_wechat/bt/template_path_list
+0
-1
master/bt5/slapos_wechat/bt/template_test_id_list
master/bt5/slapos_wechat/bt/template_test_id_list
+1
-1
No files found.
master/bt5/slapos_accounting/ActionTemplateItem/portal_types/Sale%20Invoice%20Transaction/create_slapos_reversal.xml
View file @
21504241
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
text
</string>
</key>
<key>
<string>
text
</string>
</key>
<value>
<string>
python: object.getSimulationState() in (\'stopped\', )
</string>
</value>
<value>
<string>
python: object.getSimulationState() in (\'stopped\', )
and not object.SaleInvoiceTransaction_isLettered()
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/AccountingTransactionModule_getUnpaidInvoiceList.py
View file @
21504241
...
@@ -3,16 +3,10 @@ portal_membership=portal.portal_membership
...
@@ -3,16 +3,10 @@ portal_membership=portal.portal_membership
user
=
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
user
=
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
def
wrapWithShadow
():
def
wrapWithShadow
(
user
):
return
[
i
.
getCausalityValue
(
portal_type
=
"Sale Invoice Transaction"
)
for
i
in
context
.
getPortalObject
().
portal_catalog
(
return
user
.
Entity_getOutstandingAmountList
()
portal_type
=
"Payment Transaction"
,
simulation_state
=
"started"
,
destination_section_uid
=
user
.
getUid
(),
default_causality_portal_type
=
"Sale Invoice Transaction"
,
default_causality_simulation_state
=
(
"stopped"
,
"delivered"
),
)]
return
user
.
Person_restrictMethodAsShadowUser
(
return
user
.
Person_restrictMethodAsShadowUser
(
shadow_document
=
user
,
shadow_document
=
user
,
callable_object
=
wrapWithShadow
,
callable_object
=
wrapWithShadow
,
argument_list
=
[])
argument_list
=
[
user
])
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/AccountingTransaction_getPaymentState.py
View file @
21504241
...
@@ -42,19 +42,27 @@ else:
...
@@ -42,19 +42,27 @@ else:
elif
context
.
getTotalPrice
()
==
0
:
elif
context
.
getTotalPrice
()
==
0
:
result
=
"Free!"
result
=
"Free!"
else
:
else
:
# Check if there is an ongoing SlapOS payment
result
=
"Pay Now"
payment
=
context
.
SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
()
if
payment
is
None
:
# Search to know if there are some payment waiting for confirmation
result
=
"Unpaid"
payment
=
portal
.
portal_catalog
.
getResultValue
(
else
:
portal_type
=
"Payment Transaction"
,
simulation_state
=
"started"
,
default_causality_uid
=
context
.
getUid
(),
default_payment_mode_uid
=
[
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
()],
)
if
payment
is
not
None
:
# Check if mapping exists
# Check if mapping exists
external_payment_id
=
person
.
Person_restrictMethodAsShadowUser
(
if
person
is
not
None
:
shadow_document
=
person
,
external_payment_id
=
person
.
Person_restrictMethodAsShadowUser
(
callable_object
=
payment
.
PaymentTransaction_getExternalPaymentId
,
shadow_document
=
person
,
argument_list
=
[])[
0
]
callable_object
=
payment
.
PaymentTransaction_getExternalPaymentId
,
if
external_payment_id
is
None
:
argument_list
=
[])[
0
]
result
=
"Pay Now"
else
:
else
:
external_payment_id
=
payment
.
PaymentTransaction_getExternalPaymentId
()
if
external_payment_id
is
not
None
:
result
=
"Waiting for payment confirmation"
result
=
"Waiting for payment confirmation"
return
result
return
result
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_cancelStartedPaymentTransactionPaid.py
View file @
21504241
...
@@ -12,7 +12,7 @@ portal.portal_catalog.searchAndActivate(
...
@@ -12,7 +12,7 @@ portal.portal_catalog.searchAndActivate(
payment_mode_uid
=
[
payment_mode_uid
=
[
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
()],
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
()],
method_id
=
'PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Group
ed'
,
method_id
=
'PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Letter
ed'
,
packet_size
=
1
,
# just one to minimise errors
packet_size
=
1
,
# just one to minimise errors
activate_kw
=
{
'tag'
:
tag
},
activate_kw
=
{
'tag'
:
tag
},
**
kw
**
kw
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Base_getReceivableAccountList.py
0 → 100644
View file @
21504241
# Note: can be cached for 24h if needed: the list is not expected to change often, nor to ever reach even 10 entries.
portal
=
context
.
getPortalObject
()
return
portal
.
account_module
.
searchFolder
(
strict_account_type_uid
=
portal
.
portal_categories
.
account_type
.
asset
.
receivable
.
getUid
(),
validation_state
=
'validated'
,
)
master/bt5/slapos_
payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_startPayzenPaymen
t.xml
→
master/bt5/slapos_
accounting/SkinTemplateItem/portal_skins/slapos_accounting/Base_getReceivableAccountLis
t.xml
View file @
21504241
...
@@ -52,9 +52,17 @@
...
@@ -52,9 +52,17 @@
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
</item>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
PaymentTransaction_startPayzenPaymen
t
</string>
</value>
<value>
<string>
Base_getReceivableAccountLis
t
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Entity_createPaymentTransaction.py
0 → 100644
View file @
21504241
from
Products.ERP5Type.Message
import
translateString
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
if
not
invoice_list
:
raise
ValueError
(
'You need to provide at least one Invoice transaction'
)
# For now consider a single value is passed, in future we intend to create
# a single payment per invoice.
current_invoice
=
invoice_list
[
0
]
payment_tag
=
"sale_invoice_transaction_create_payment_%s"
%
current_invoice
.
getUid
()
if
context
.
REQUEST
.
get
(
payment_tag
,
None
)
is
not
None
:
raise
ValueError
(
'This script was already called twice on the same transaction '
)
if
current_invoice
.
SaleInvoiceTransaction_isLettered
():
raise
ValueError
(
'This invoice is already lettered'
)
context
.
serialize
()
quantity
=
0
for
movement
in
current_invoice
.
searchFolder
(
portal_type
=
'Sale Invoice Transaction Line'
,
default_source_uid
=
[
i
.
uid
for
i
in
context
.
Base_getReceivableAccountList
()]):
quantity
+=
movement
.
getQuantity
()
if
quantity
>=
0
:
raise
ValueError
(
'You cannot generate Payment Transaction for zero or negative amounts.'
)
current_payment
=
portal
.
accounting_module
.
newContent
(
portal_type
=
"Payment Transaction"
,
causality
=
current_invoice
.
getRelativeUrl
(),
source_section
=
current_invoice
.
getSourceSection
(),
destination_section
=
current_invoice
.
getDestinationSection
(),
resource
=
current_invoice
.
getResource
(),
price_currency
=
current_invoice
.
getResource
(),
specialise
=
current_invoice
.
getSpecialise
(),
payment_mode
=
current_invoice
.
getPaymentMode
(),
start_date
=
current_invoice
.
getStartDate
(),
stop_date
=
current_invoice
.
getStopDate
(),
source_payment
=
'%s/bank_account'
%
current_invoice
.
getSourceSection
(),
# the other place defnied: business process
# Workarround to not create default lines.
created_by_builder
=
1
)
current_payment
.
newContent
(
portal_type
=
"Accounting Transaction Line"
,
quantity
=-
1
*
quantity
,
source
=
'account_module/receivable'
,
destination
=
'account_module/payable'
,
start_date
=
current_invoice
.
getStartDate
(),
stop_date
=
current_invoice
.
getStopDate
())
current_payment
.
newContent
(
portal_type
=
"Accounting Transaction Line"
,
quantity
=
1
*
quantity
,
source
=
'account_module/payment_to_encash'
,
destination
=
'account_module/payment_to_encash'
,
start_date
=
current_invoice
.
getStartDate
(),
stop_date
=
current_invoice
.
getStopDate
())
comment
=
translateString
(
"Initialised by Entity_createPaymentTransaction."
)
# Reindex with a tag to ensure that there will be no generation while the object isn't
# reindexed.
payment_tag
=
"sale_invoice_transaction_create_payment_%s"
%
current_invoice
.
getUid
()
current_payment
.
activate
(
tag
=
payment_tag
).
immediateReindexObject
()
# Call script rather them call confirm(), since it would set security and fail whenever
# start is called.
current_payment
.
AccountingTransaction_setReference
()
comment
=
translateString
(
"Initialised by Entity_createPaymentTransaction."
)
current_payment
.
start
(
comment
=
comment
)
# Set a flag on the request for prevent 2 calls on the same transaction
context
.
REQUEST
.
set
(
payment_tag
,
1
)
return
current_payment
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/
SaleInvoiceTransaction_getSlapOSPaymentRelated
.xml
→
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/
Entity_createPaymentTransaction
.xml
View file @
21504241
...
@@ -50,11 +50,11 @@
...
@@ -50,11 +50,11 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
invoice_list, REQUEST=None
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
SaleInvoiceTransaction_getSlapOSPaymentRelated
</string>
</value>
<value>
<string>
Entity_createPaymentTransaction
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Entity_getOutstandingAmountList.py
0 → 100644
View file @
21504241
"""return a list of invoices with the following attributes:
- payment_request_uid: the uid of the invoice, we consider that payment request is the invoice.
- total_price: the amount left to pay for this invoice
- getTotalPrice: the original amount of this invoice.
Arguments:
- at_date (default None)
"""
portal
=
context
.
getPortalObject
()
params
=
dict
()
if
at_date
:
params
[
'at_date'
]
=
at_date
params
[
'grouping_reference'
]
=
None
object_list
=
[]
for
(
idx
,
brain
)
in
enumerate
(
portal
.
portal_simulation
.
getInventoryList
(
mirror_section_uid
=
context
.
getUid
(),
simulation_state
=
(
'stopped'
,
'delivered'
),
node_uid
=
[
x
.
uid
for
x
in
context
.
Base_getReceivableAccountList
()]
or
-
1
,
**
params
)):
# XXX rewrap inventory list brain because they don't have a valid "uid" and cannot be used
# directly in listbox. We should probably add support for this in getInventoryList instead
# of this hack
# XXX In our case, this hould be always None.
payment_request_uid
=
brain
.
payment_request_uid
if
not
payment_request_uid
:
payment_request_uid
=
brain
.
getObject
().
getExplanationUid
()
payment_request
=
portal
.
portal_catalog
.
getObject
(
uid
=
payment_request_uid
)
object_list
.
append
(
payment_request
.
asContext
(
section_uid
=
brain
.
section_uid
,
payment_request_uid
=
payment_request_uid
,
node_uid
=
brain
.
node_uid
,
node_relative_url
=
brain
.
node_relative_url
,
total_price
=
brain
.
total_price
,
uid
=
'new_%s'
%
idx
,))
return
object_list
master/bt5/slapos_
wechat/SkinTemplateItem/portal_skins/slapos_wechat/PaymentTransaction_startWechatPaymen
t.xml
→
master/bt5/slapos_
accounting/SkinTemplateItem/portal_skins/slapos_accounting/Entity_getOutstandingAmountLis
t.xml
View file @
21504241
...
@@ -50,11 +50,11 @@
...
@@ -50,11 +50,11 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
at_date=None, **kw
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
PaymentTransaction_startWechatPaymen
t
</string>
</value>
<value>
<string>
Entity_getOutstandingAmountLis
t
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Group
ed.py
→
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Letter
ed.py
View file @
21504241
...
@@ -4,35 +4,13 @@ if simulation_state != "started":
...
@@ -4,35 +4,13 @@ if simulation_state != "started":
# The payment isn't started, so ignore it
# The payment isn't started, so ignore it
return
"Not Started"
return
"Not Started"
portal
=
context
.
getPortalObject
()
paid
=
False
def
isNodeFromLineReceivable
(
line
):
node_value
=
line
.
getSourceValue
(
portal_type
=
'Account'
)
return
node_value
.
getAccountType
()
==
'asset/receivable'
invoice
=
context
.
getCausalityValue
()
invoice
=
context
.
getCausalityValue
()
if
invoice
is
None
:
if
invoice
is
None
:
# No invoice Related, so skip and ignore
# No invoice Related, so skip and ignore
return
return
line_found
=
False
letter
=
invoice
.
SaleInvoiceTransaction_isLettered
()
line_list
=
invoice
.
getMovementList
(
portal
.
getPortalAccountingMovementTypeList
())
if
letter
:
if
not
len
(
line_list
):
# Ignore since lines to group don't exist yet
return
for
line
in
line_list
:
if
isNodeFromLineReceivable
(
line
):
line_found
=
True
if
line
.
hasGroupingReference
():
paid
=
True
letter
=
line
.
getGroupingReference
()
break
if
line_found
and
paid
:
# We should ensure that the order builder won't create another document.
# We should ensure that the order builder won't create another document.
context
.
edit
(
payment_mode
=
None
)
context
.
edit
(
payment_mode
=
None
)
context
.
cancel
(
comment
=
"Payment is cancelled since the invoice is payed by other document,
\
context
.
cancel
(
comment
=
"Payment is cancelled since the invoice is payed by other document,
\
...
@@ -40,7 +18,6 @@ if line_found and paid:
...
@@ -40,7 +18,6 @@ if line_found and paid:
# Should be safe now to fix everything XXXXXXX
# Should be safe now to fix everything XXXXXXX
invoice
.
SaleInvoiceTransaction_resetPaymentMode
()
invoice
.
SaleInvoiceTransaction_resetPaymentMode
()
return
"Payment Cancelled"
return
"Payment Cancelled"
return
"Skipped"
return
"Skipped"
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Group
ed.xml
→
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Letter
ed.xml
View file @
21504241
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Group
ed
</string>
</value>
<value>
<string>
PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Letter
ed
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_
payzen/SkinTemplateItem/portal_skins/slapos_payzen/SaleInvoiceTransaction_createReversalPayzen
Transaction.py
→
master/bt5/slapos_
accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createReversalSaleInvoice
Transaction.py
View file @
21504241
""" Create a reversal transaction from current payzen transaction. """
""" Create a reversal transaction from current transaction. """
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
not
batch_mode
and
context
.
getPaymentMode
()
not
in
[
"payzen"
,
"wechat"
]:
message
=
context
.
Base_translateString
(
"The payment mode is unsupported."
)
return
context
.
Base_redirect
(
keep_items
=
{
'portal_status_message'
:
message
})
# Check that we are in state that we are waiting for user manual payment
# Check that we are in state that we are waiting for user manual payment
assert
context
.
getPortalType
()
==
'Sale Invoice Transaction'
assert
context
.
getPortalType
()
==
'Sale Invoice Transaction'
assert
context
.
getPaymentMode
()
==
'payzen'
assert
context
.
getPaymentMode
()
in
(
'payzen'
,
'wechat'
)
assert
context
.
getSimulationState
()
==
'stopped'
assert
context
.
getSimulationState
()
==
'stopped'
assert
context
.
getTotalPrice
()
!=
0
assert
context
.
getTotalPrice
()
!=
0
assert
context
.
getSpecialise
()
in
(
"sale_trade_condition_module/slapos_aggregated_trade_condition"
,
assert
context
.
getSpecialise
()
in
(
"sale_trade_condition_module/slapos_aggregated_trade_condition"
,
"sale_trade_condition_module/slapos_aggregated_subscription_trade_condition"
)
"sale_trade_condition_module/slapos_aggregated_subscription_trade_condition"
)
paid
=
True
# Dont create if the invoice is already paied
for
line
in
context
.
getMovementList
(
portal
.
getPortalAccountingMovementTypeList
()):
assert
not
context
.
SaleInvoiceTransaction_isLettered
()
node_value
=
line
.
getSourceValue
(
portal_type
=
'Account'
)
if
node_value
.
getAccountType
()
==
'asset/receivable'
:
if
not
line
.
hasGroupingReference
():
paid
=
False
break
assert
not
paid
payment
=
portal
.
portal_catalog
.
getResultValue
(
payment
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Payment Transaction"
,
portal_type
=
"Payment Transaction"
,
simulation_state
=
"started"
,
simulation_state
=
"started"
,
default_causality_uid
=
context
.
getUid
(),
default_causality_uid
=
context
.
getUid
(),
default_payment_mode_uid
=
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
default_payment_mode_uid
=
[
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
()],
)
)
assert
payment
is
not
None
if
payment
is
not
None
:
assert
payment
.
getSimulationState
()
==
'started'
payment_mode
=
payment
.
getPaymentMode
()
assert
payment
.
getPaymentMode
()
==
'payzen'
if
payment_mode
==
'payzen'
and
payment
.
PaymentTransaction_getPayzenId
()[
1
]
is
not
None
:
assert
payment
.
PaymentTransaction_getPayzenId
()[
1
]
is
None
# The payment transaction will be cancelled by a proper alarm.
raise
ValueError
(
"Payment Transaction is waiting for External Payzen confirmation!"
)
elif
payment_mode
==
'wechat'
and
payment
.
PaymentTransaction_getWechatId
()[
1
]
is
not
None
:
# The payment transaction will be cancelled by a proper alarm.
raise
ValueError
(
"Payment Transaction is waiting for External Wechat confirmation!"
)
# Should be safe now to fix everything
# Should be safe now to fix everything
context
.
SaleInvoiceTransaction_resetPaymentMode
()
context
.
SaleInvoiceTransaction_resetPaymentMode
()
payment
.
edit
(
payment_mode
=
None
)
reversal_transaction
=
context
.
Base_createCloneDocument
(
batch_mode
=
1
)
reversal_transaction
=
context
.
Base_createCloneDocument
(
batch_mode
=
1
)
payment
.
cancel
(
comment
=
"Reversal sale invoice transaction created %s"
%
reversal_transaction
.
getRelativeUrl
())
reversal_transaction
.
edit
(
reversal_transaction
.
edit
(
title
=
"Reversal Transaction for %s"
%
context
.
getTitle
(),
title
=
"Reversal Transaction for %s"
%
context
.
getTitle
(),
...
@@ -53,4 +50,9 @@ for line in reversal_transaction.getMovementList():
...
@@ -53,4 +50,9 @@ for line in reversal_transaction.getMovementList():
reversal_transaction
.
confirm
(
comment
=
"Automatic because of reversal creation"
)
reversal_transaction
.
confirm
(
comment
=
"Automatic because of reversal creation"
)
reversal_transaction
.
stop
(
comment
=
"Automatic because of reversal creation"
)
reversal_transaction
.
stop
(
comment
=
"Automatic because of reversal creation"
)
return
reversal_transaction
if
batch_mode
:
return
reversal_transaction
message
=
context
.
Base_translateString
(
"Reversal Transaction created."
)
return
reversal_transaction
.
Base_redirect
(
keep_items
=
{
'portal_status_message'
:
message
})
master/bt5/slapos_
payzen/SkinTemplateItem/portal_skins/slapos_payzen/SaleInvoiceTransaction_createReversalPayzen
Transaction.xml
→
master/bt5/slapos_
accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createReversalSaleInvoice
Transaction.xml
View file @
21504241
...
@@ -50,11 +50,11 @@
...
@@ -50,11 +50,11 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=Non
e
</string>
</value>
<value>
<string>
batch_mode=Fals
e
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
SaleInvoiceTransaction_createReversal
Payzen
Transaction
</string>
</value>
<value>
<string>
SaleInvoiceTransaction_createReversal
SaleInvoice
Transaction
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createSlapOSReversalTransaction.py
deleted
100644 → 0
View file @
5128c902
if
context
.
getPaymentMode
()
==
"payzen"
:
reversal_payment
=
context
.
SaleInvoiceTransaction_createReversalPayzenTransaction
()
elif
context
.
getPaymentMode
()
==
"wechat"
:
reversal_payment
=
context
.
SaleInvoiceTransaction_createReversalWechatTransaction
()
else
:
message
=
context
.
Base_translateString
(
"The payment mode is unsupported."
)
return
context
.
Base_redirect
(
keep_items
=
{
'portal_status_message'
:
message
})
message
=
context
.
Base_translateString
(
"Reversal Transaction created."
)
return
reversal_payment
.
Base_redirect
(
keep_items
=
{
'portal_status_message'
:
message
})
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createSlapOSReversalTransaction.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SaleInvoiceTransaction_createSlapOSReversalTransaction
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_getSlapOSPaymentRelated.py
deleted
100644 → 0
View file @
5128c902
payment_transaction
=
context
.
SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
()
if
payment_transaction
is
not
None
:
return
payment_transaction
.
getRelativeUrl
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_getSlapOSPaymentRelatedValue.py
deleted
100644 → 0
View file @
5128c902
portal
=
context
.
getPortalObject
()
return
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Payment Transaction"
,
simulation_state
=
"started"
,
default_causality_uid
=
context
.
getUid
(),
default_payment_mode_uid
=
[
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
()],
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_getSlapOSPaymentRelatedValue.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isLettered.py
0 → 100644
View file @
21504241
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
portal
=
context
.
getObject
()
line_list
=
context
.
getMovementList
(
portal_type
=
portal
.
getPortalAccountingMovementTypeList
())
if
not
len
(
line_list
):
# Ignore since lines to group don't exist yet
return
False
source_list
=
[
i
.
getRelativeUrl
()
for
i
in
context
.
Base_getReceivableAccountList
()]
for
line
in
line_list
:
if
line
.
getSource
()
in
source_list
:
if
line
.
hasGroupingReference
():
return
line
.
getGroupingReference
()
master/bt5/slapos_
wechat/SkinTemplateItem/portal_skins/slapos_wechat/SaleInvoiceTransaction_createReversalWechatTransaction
.xml
→
master/bt5/slapos_
accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isLettered
.xml
View file @
21504241
...
@@ -52,9 +52,17 @@
...
@@ -52,9 +52,17 @@
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
SaleInvoiceTransaction_
createReversalWechatTransaction
</string>
</value>
<value>
<string>
SaleInvoiceTransaction_
isLettered
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_
jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Payment
Transaction_redirectToManualSlapOSPayment.py
→
master/bt5/slapos_
accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoice
Transaction_redirectToManualSlapOSPayment.py
View file @
21504241
payment_mode
=
context
.
getPaymentMode
()
payment_mode
=
context
.
getPaymentMode
()
entity
=
context
.
getDestinationSectionValue
()
def
wrapWithShadow
(
entity
,
invoice
):
return
entity
.
Entity_createPaymentTransaction
([
invoice
])
payment
=
entity
.
Person_restrictMethodAsShadowUser
(
shadow_document
=
entity
,
callable_object
=
wrapWithShadow
,
argument_list
=
[
entity
,
context
])
if
web_site
is
None
:
web_site
=
context
.
getWebSiteValue
()
if
payment_mode
==
"wechat"
:
if
payment_mode
==
"wechat"
:
return
contex
t
.
PaymentTransaction_redirectToManualWechatPayment
(
web_site
=
web_site
)
return
paymen
t
.
PaymentTransaction_redirectToManualWechatPayment
(
web_site
=
web_site
)
elif
payment_mode
==
"payzen"
:
elif
payment_mode
==
"payzen"
:
return
contex
t
.
PaymentTransaction_redirectToManualPayzenPayment
(
web_site
=
web_site
)
return
paymen
t
.
PaymentTransaction_redirectToManualPayzenPayment
(
web_site
=
web_site
)
raise
ValueError
(
"%s isn't an acceptable payment mode"
%
payment_mode
)
raise
ValueError
(
"%s isn't an acceptable payment mode"
%
payment_mode
)
master/bt5/slapos_
jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Payment
Transaction_redirectToManualSlapOSPayment.xml
→
master/bt5/slapos_
accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoice
Transaction_redirectToManualSlapOSPayment.xml
View file @
21504241
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Payment
Transaction_redirectToManualSlapOSPayment
</string>
</value>
<value>
<string>
SaleInvoice
Transaction_redirectToManualSlapOSPayment
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_viewCancelPaymentAndCreateReversalTransactionDialog.xml
View file @
21504241
...
@@ -35,7 +35,11 @@
...
@@ -35,7 +35,11 @@
</item>
</item>
<item>
<item>
<key>
<string>
action
</string>
</key>
<key>
<string>
action
</string>
</key>
<value>
<string>
SaleInvoiceTransaction_createSlapOSReversalTransaction
</string>
</value>
<value>
<string>
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
</string>
</value>
</item>
<item>
<key>
<string>
action_title
</string>
</key>
<value>
<string></string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
View file @
21504241
# -*- coding:
utf-8 -*-
# -*- coding:utf-8 -*-
##############################################################################
##############################################################################
#
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2002-2018 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
##############################################################################
##############################################################################
...
@@ -1411,14 +1432,14 @@ class TestSlapOSCancelSaleTnvoiceTransactionPaiedPaymentListAlarm(SlapOSTestCase
...
@@ -1411,14 +1432,14 @@ class TestSlapOSCancelSaleTnvoiceTransactionPaiedPaymentListAlarm(SlapOSTestCase
self
.
tic
()
self
.
tic
()
self
.
assertNotEqual
(
self
.
assertNotEqual
(
'Not visited by PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Group
ed'
,
'Not visited by PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Letter
ed'
,
payment_transaction
.
getTitle
())
payment_transaction
.
getTitle
())
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Group
ed'
)
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Letter
ed'
)
def
test_payment_is_draft_payzen
(
self
):
def
test_payment_is_draft_payzen
(
self
):
self
.
_test_payment_is_draft
(
payment_mode
=
"payzen"
)
self
.
_test_payment_is_draft
(
payment_mode
=
"payzen"
)
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Group
ed'
)
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransactionIs
Letter
ed'
)
def
test_payment_is_draft_wechat
(
self
):
def
test_payment_is_draft_wechat
(
self
):
self
.
_test_payment_is_draft
(
payment_mode
=
"wechat"
)
self
.
_test_payment_is_draft
(
payment_mode
=
"wechat"
)
...
@@ -1440,14 +1461,14 @@ class TestSlapOSCancelSaleTnvoiceTransactionPaiedPaymentListAlarm(SlapOSTestCase
...
@@ -1440,14 +1461,14 @@ class TestSlapOSCancelSaleTnvoiceTransactionPaiedPaymentListAlarm(SlapOSTestCase
self
.
tic
()
self
.
tic
()
self
.
assertNotEqual
(
self
.
assertNotEqual
(
'Not visited by PaymentTransaction_cancelIfSaleInvoiceTransaction
IsGroup
ed'
,
'Not visited by PaymentTransaction_cancelIfSaleInvoiceTransaction
isLetter
ed'
,
payment_transaction
.
getTitle
())
payment_transaction
.
getTitle
())
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransaction
IsGroup
ed'
)
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransaction
isLetter
ed'
)
def
test_payment_is_stopped_payzen
(
self
):
def
test_payment_is_stopped_payzen
(
self
):
self
.
_test_payment_is_stopped
(
payment_mode
=
"payzen"
)
self
.
_test_payment_is_stopped
(
payment_mode
=
"payzen"
)
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransaction
IsGroup
ed'
)
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransaction
isLetter
ed'
)
def
test_payment_is_stopped_wechat
(
self
):
def
test_payment_is_stopped_wechat
(
self
):
self
.
_test_payment_is_stopped
(
payment_mode
=
"wechat"
)
self
.
_test_payment_is_stopped
(
payment_mode
=
"wechat"
)
...
@@ -1469,14 +1490,13 @@ class TestSlapOSCancelSaleTnvoiceTransactionPaiedPaymentListAlarm(SlapOSTestCase
...
@@ -1469,14 +1490,13 @@ class TestSlapOSCancelSaleTnvoiceTransactionPaiedPaymentListAlarm(SlapOSTestCase
self
.
tic
()
self
.
tic
()
self
.
assertNotEqual
(
self
.
assertNotEqual
(
'Visited by PaymentTransaction_cancelIfSaleInvoiceTransaction
IsGroup
ed'
,
'Visited by PaymentTransaction_cancelIfSaleInvoiceTransaction
isLetter
ed'
,
payment_transaction
.
getTitle
())
payment_transaction
.
getTitle
())
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransaction
IsGroup
ed'
)
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransaction
isLetter
ed'
)
def
test_payment_is_started_payzen
(
self
):
def
test_payment_is_started_payzen
(
self
):
self
.
_test_payment_is_started
(
payment_mode
=
"payzen"
)
self
.
_test_payment_is_started
(
payment_mode
=
"payzen"
)
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransaction
IsGroup
ed'
)
@
simulateByTitlewMark
(
'PaymentTransaction_cancelIfSaleInvoiceTransaction
isLetter
ed'
)
def
test_payment_is_started_wechat
(
self
):
def
test_payment_is_started_wechat
(
self
):
self
.
_test_payment_is_started
(
payment_mode
=
"wechat"
)
self
.
_test_payment_is_started
(
payment_mode
=
"wechat"
)
\ No newline at end of file
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.xml
View file @
21504241
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSAccountingAlarm
</string>
</value>
<value>
<string>
testSlapOSAccountingAlarm
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
View file @
21504241
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#
#
##############################################################################
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
,
withAbort
,
simulate
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
,
withAbort
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
from
DateTime
import
DateTime
from
DateTime
import
DateTime
...
@@ -50,6 +50,37 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
...
@@ -50,6 +50,37 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
reference
=
"TESTOSO-%s"
%
new_id
,
reference
=
"TESTOSO-%s"
%
new_id
,
)
)
def
createSaleInvoiceTransactionForReversal
(
self
,
destination_section
=
None
,
price
=
2
,
payment_mode
=
"payzen"
):
new_title
=
self
.
generateNewId
()
new_reference
=
self
.
generateNewId
()
new_source_reference
=
self
.
generateNewId
()
new_destination_reference
=
self
.
generateNewId
()
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Sale Invoice Transaction"
,
title
=
new_title
,
start_date
=
DateTime
(),
reference
=
new_reference
,
source_reference
=
new_source_reference
,
destination_reference
=
new_destination_reference
,
destination_section
=
destination_section
,
payment_mode
=
payment_mode
,
specialise
=
"sale_trade_condition_module/slapos_aggregated_trade_condition"
,
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'stopped'
)
invoice
.
newContent
(
title
=
""
,
portal_type
=
"Invoice Line"
,
quantity
=-
2
,
price
=
price
,
)
invoice
.
newContent
(
portal_type
=
"Sale Invoice Transaction Line"
,
source
=
"account_module/receivable"
,
quantity
=-
3
,
)
return
invoice
@
withAbort
@
withAbort
def
test_IT_calculateSubscriptionStartDate_REQUEST_disallowed
(
self
):
def
test_IT_calculateSubscriptionStartDate_REQUEST_disallowed
(
self
):
item
=
self
.
createInstanceTree
()
item
=
self
.
createInstanceTree
()
...
@@ -209,43 +240,37 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
...
@@ -209,43 +240,37 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self
.
portal
.
OpenSaleOrder_reindexIfIndexedBeforeLine
,
self
.
portal
.
OpenSaleOrder_reindexIfIndexedBeforeLine
,
REQUEST
=
{})
REQUEST
=
{})
def
test_SaleInvoiceTransaction_createReversalSaleInvoiceTransaction_redirect_payzen
(
self
):
sale_invoice_transaction
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
'payzen'
)
self
.
tic
()
@
simulate
(
"SaleInvoiceTransaction_createReversalPayzenTransaction"
,
redirect
=
sale_invoice_transaction
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
()
"*args, **kwargs"
,
"""context.portal_workflow.doActionFor(context, action='edit_action', comment='Visited by SaleInvoiceTransaction_createReversalPayzenTransaction')
self
.
assertTrue
(
return context.getParentValue()"""
)
redirect
.
endswith
(
def
test_SaleInvoiceTransaction_createSlapOSReversalTransaction_payzen
(
self
):
'?portal_status_message=Reversal%20Transaction%20created.'
),
sale_invoice_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Sale Invoice Transaction"
)
"%s doesn't end with expected response"
%
redirect
)
sale_invoice_transaction
.
edit
(
payment_mode
=
"payzen"
)
redirect
=
sale_invoice_transaction
.
SaleInvoiceTransaction_createSlapOSReversalTransaction
()
self
.
assertTrue
(
redirect
.
endswith
(
'accounting_module?portal_status_message=Reversal%20Transaction%20created.'
),
"%s doesn't end with sale_invoice_transaction.SaleInvoiceTransaction_createSlapOSReversalTransaction()"
%
redirect
)
self
.
assertEqual
(
'Visited by SaleInvoiceTransaction_createReversalPayzenTransaction'
,
sale_invoice_transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
"SaleInvoiceTransaction_createReversalWechatTransaction"
,
def
test_SaleInvoiceTransaction_createReversalSaleInvoiceTransaction_redirect_wechat
(
self
):
"*args, **kwargs"
,
"""context.portal_workflow.doActionFor(context, action='edit_action', comment='Visited by SaleInvoiceTransaction_createReversalWechatTransaction')
sale_invoice_transaction
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
'wechat'
)
return context.getParentValue()"""
)
self
.
tic
()
def
test_SaleInvoiceTransaction_createSlapOSReversalTransaction_wechat
(
self
):
sale_invoice_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Sale Invoice Transaction"
)
sale_invoice_transaction
.
edit
(
payment_mode
=
"wechat"
)
redirect
=
sale_invoice_transaction
.
SaleInvoiceTransaction_createSlapOSReversalTransaction
()
redirect
=
sale_invoice_transaction
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
()
self
.
assertTrue
(
redirect
.
endswith
(
'accounting_module?portal_status_message=Reversal%20Transaction%20created.'
),
self
.
assertTrue
(
"%s doesn't end with sale_invoice_transaction.SaleInvoiceTransaction_createSlapOSReversalTransaction()"
%
redirect
)
redirect
.
endswith
(
self
.
assertEqual
(
'?portal_status_message=Reversal%20Transaction%20created.'
),
'Visited by SaleInvoiceTransaction_createReversalWechatTransaction'
,
"%s doesn't end with expected response"
%
redirect
)
sale_invoice_transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_SaleInvoiceTransaction_create
SlapOSReversalTransaction
_unknown
(
self
):
def
test_SaleInvoiceTransaction_create
ReversalSaleInvoiceTransaction_redirect
_unknown
(
self
):
sale_invoice_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Sale Invoice Transaction"
)
sale_invoice_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Sale Invoice Transaction"
)
sale_invoice_transaction
.
edit
(
payment_mode
=
"unknown"
)
sale_invoice_transaction
.
edit
(
payment_mode
=
"unknown"
)
redirect
=
sale_invoice_transaction
.
SaleInvoiceTransaction_create
SlapOSReversal
Transaction
()
redirect
=
sale_invoice_transaction
.
SaleInvoiceTransaction_create
ReversalSaleInvoice
Transaction
()
self
.
assertTrue
(
redirect
.
endswith
(
'%s?portal_status_message=The%%20payment%%20mode%%20is%%20unsupported.'
%
sale_invoice_transaction
.
getRelativeUrl
()),
self
.
assertTrue
(
"%s doesn't end with %s?portal_status_message=The%%20payment%%20mode%%20is%%20unsupported."
%
(
redirect
,
sale_invoice_transaction
.
getRelativeUrl
()))
redirect
.
endswith
(
'%s?portal_status_message=The%%20payment%%20mode%%20is%%20unsupported.'
%
sale_invoice_transaction
.
getRelativeUrl
()),
"%s doesn't end with %s?portal_status_message=The%%20payment%%20mode%%20is%%20unsupported."
%
(
redirect
,
sale_invoice_transaction
.
getRelativeUrl
()))
def
test_SaleInvoiceTransaction_resetPaymentMode
(
self
):
def
test_SaleInvoiceTransaction_resetPaymentMode
(
self
):
sale_invoice_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Sale Invoice Transaction"
)
sale_invoice_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Sale Invoice Transaction"
)
...
@@ -289,19 +314,6 @@ return context.getParentValue()""")
...
@@ -289,19 +314,6 @@ return context.getParentValue()""")
def
test_AccountingTransactionModule_getUnpaidInvoiceList
(
self
):
def
test_AccountingTransactionModule_getUnpaidInvoiceList
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
person
=
self
.
makePerson
(
user
=
1
)
payment_template
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentTemplate
())
payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
for
line
in
payment
.
contentValues
():
if
line
.
getSource
()
==
"account_module/payment_to_encash"
:
line
.
setQuantity
(
-
1
)
elif
line
.
getSource
()
==
"account_module/receivable"
:
line
.
setQuantity
(
1
)
payment
.
confirm
()
payment
.
start
()
template
=
self
.
portal
.
restrictedTraverse
(
template
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate
())
self
.
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate
())
...
@@ -321,26 +333,486 @@ return context.getParentValue()""")
...
@@ -321,26 +333,486 @@ return context.getParentValue()""")
cell
.
edit
(
quantity
=
1
)
cell
.
edit
(
quantity
=
1
)
cell
.
setPrice
(
1
)
cell
.
setPrice
(
1
)
payment
.
setCausalityValue
(
current_invoice
)
payment
.
setDestinationSectionValue
(
person
)
current_invoice
.
plan
()
current_invoice
.
plan
()
current_invoice
.
confirm
()
current_invoice
.
confirm
()
current_invoice
.
startBuilding
()
current_invoice
.
startBuilding
()
current_invoice
.
reindexObject
()
current_invoice
.
reindexObject
()
current_invoice
.
stop
()
current_invoice
.
stop
()
self
.
tic
()
current_invoice
.
Delivery_manageBuildingCalculatingDelivery
()
self
.
tic
()
applied_rule
=
current_invoice
.
getCausalityRelated
(
portal_type
=
"Applied Rule"
)
for
sm
in
self
.
portal
.
portal_catalog
(
portal_type
=
'Simulation Movement'
,
simulation_state
=
[
'draft'
,
'planned'
,
None
],
left_join_list
=
[
'delivery_uid'
],
delivery_uid
=
None
,
path
=
"%%%s%%"
%
applied_rule
):
if
sm
.
getDelivery
()
is
not
None
:
continue
root_applied_rule
=
sm
.
getRootAppliedRule
()
root_applied_rule_path
=
root_applied_rule
.
getPath
()
sm
.
getCausalityValue
(
portal_type
=
'Business Link'
).
build
(
path
=
'%s/%%'
%
root_applied_rule_path
)
self
.
tic
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
unpaid_invoice_list
=
self
.
portal
.
accounting_module
.
AccountingTransactionModule_getUnpaidInvoiceList
()
self
.
assertEqual
(
self
.
assertEqual
(
self
.
portal
.
accounting_module
.
AccountingTransactionModule_getUnpaidInvoiceList
()
,
[
i
.
getRelativeUrl
()
for
i
in
unpaid_invoice_list
]
,
[
current_invoice
])
[
current_invoice
.
getRelativeUrl
()
])
self
.
login
()
self
.
login
()
payment_template
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentTemplate
())
payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
for
line
in
payment
.
contentValues
():
if
line
.
getSource
()
==
"account_module/payment_to_encash"
:
line
.
setQuantity
(
-
1
)
elif
line
.
getSource
()
==
"account_module/receivable"
:
line
.
setQuantity
(
1
)
payment
.
confirm
()
payment
.
start
()
payment
.
setCausalityValue
(
current_invoice
)
payment
.
setDestinationSectionValue
(
person
)
payment
.
stop
()
payment
.
stop
()
self
.
tic
()
self
.
tic
()
is_lettered
=
False
letter
=
None
for
line
in
current_invoice
.
contentValues
():
if
line
.
getSource
()
==
"account_module/receivable"
:
is_lettered
=
True
letter
=
line
.
getGroupingReference
()
self
.
assertTrue
(
is_lettered
)
# is it groupped?
is_lettered
=
False
for
line
in
payment
.
contentValues
():
if
line
.
getSource
()
==
"account_module/receivable"
:
is_lettered
=
True
self
.
assertEqual
(
letter
,
line
.
getGroupingReference
())
self
.
assertTrue
(
is_lettered
)
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
unpaid_invoice_list
=
self
.
portal
.
accounting_module
.
AccountingTransactionModule_getUnpaidInvoiceList
()
self
.
assertEqual
(
self
.
assertEqual
(
self
.
portal
.
accounting_module
.
AccountingTransactionModule_getUnpaidInvoiceList
(),
[
i
.
getRelativeUrl
()
for
i
in
unpaid_invoice_list
],
[])
[])
\ No newline at end of file
@
withAbort
def
test_createReversalSaleInvoiceTransaction_bad_portal_type
(
self
):
self
.
assertRaises
(
AssertionError
,
self
.
portal
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_bad_payment_mode
(
self
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
()
invoice
.
edit
(
payment_mode
=
"cash"
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_bad_state
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'delivered'
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_zero_price
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
invoice
.
manage_delObjects
(
invoice
.
contentIds
())
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wrong_trade_condition
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
invoice
.
edit
(
specialise
=
None
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_paid
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
line
=
invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)[
0
]
line
.
edit
(
grouping_reference
=
"azerty"
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_registered_payment
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Payment Transaction"
,
payment_mode
=
payment_mode
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
self
.
tic
()
payment
.
PaymentTransaction_generatePayzenId
()
self
.
assertRaises
(
ValueError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_ok
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
self
.
tic
()
reversale_invoice
=
invoice
.
\
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
(
batch_mode
=
1
)
self
.
assertEqual
(
invoice
.
getPaymentMode
(
""
),
""
)
self
.
assertEqual
(
reversale_invoice
.
getTitle
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getDescription
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getCausality
(),
invoice
.
getRelativeUrl
())
self
.
assertEqual
(
reversale_invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
invoice_line_id
=
invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)[
0
].
getId
()
transaction_line_id
=
invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)[
0
].
getId
()
self
.
assertEqual
(
invoice
[
invoice_line_id
].
getQuantity
(),
-
reversale_invoice
[
invoice_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
invoice_line_id
].
getQuantity
(),
2
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getQuantity
(),
-
reversale_invoice
[
transaction_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
transaction_line_id
].
getQuantity
(),
3
)
self
.
assertEqual
(
len
(
invoice
.
getMovementList
()),
2
)
# Both invoice should have a grouping reference
self
.
assertNotEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
""
),
""
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
"1"
),
reversale_invoice
[
transaction_line_id
].
getGroupingReference
(
"2"
))
# All references should be regenerated
self
.
assertNotEqual
(
invoice
.
getReference
(
""
),
reversale_invoice
.
getReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getSourceReference
(
""
),
reversale_invoice
.
getSourceReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getDestinationReference
(
""
),
reversale_invoice
.
getDestinationReference
(
""
))
self
.
assertTrue
(
invoice
.
SaleInvoiceTransaction_isLettered
())
self
.
assertTrue
(
reversale_invoice
.
SaleInvoiceTransaction_isLettered
())
# Another trade condition
self
.
assertEqual
(
reversale_invoice
.
getSpecialise
(),
"sale_trade_condition_module/slapos_manual_accounting_trade_condition"
)
self
.
tic
()
@
withAbort
def
test_createReversalSaleInvoiceTransaction_ok_dont_autocancel
(
self
,
payment_mode
=
'payzen'
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
payment_mode
)
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Payment Transaction"
,
payment_mode
=
payment_mode
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
self
.
tic
()
reversale_invoice
=
invoice
.
\
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
(
batch_mode
=
1
)
self
.
assertEqual
(
invoice
.
getPaymentMode
(
""
),
""
)
# Related payment is cancelled by a proper alarm.
self
.
assertEqual
(
payment
.
getSimulationState
(),
"started"
)
self
.
assertEqual
(
reversale_invoice
.
getTitle
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getDescription
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getCausality
(),
invoice
.
getRelativeUrl
())
self
.
assertEqual
(
reversale_invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
invoice_line_id
=
invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)[
0
].
getId
()
transaction_line_id
=
invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)[
0
].
getId
()
self
.
assertEqual
(
invoice
[
invoice_line_id
].
getQuantity
(),
-
reversale_invoice
[
invoice_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
invoice_line_id
].
getQuantity
(),
2
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getQuantity
(),
-
reversale_invoice
[
transaction_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
transaction_line_id
].
getQuantity
(),
3
)
self
.
assertEqual
(
len
(
invoice
.
getMovementList
()),
2
)
# Both invoice should have a grouping reference
self
.
assertNotEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
""
),
""
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
"1"
),
reversale_invoice
[
transaction_line_id
].
getGroupingReference
(
"2"
))
# All references should be regenerated
self
.
assertNotEqual
(
invoice
.
getReference
(
""
),
reversale_invoice
.
getReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getSourceReference
(
""
),
reversale_invoice
.
getSourceReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getDestinationReference
(
""
),
reversale_invoice
.
getDestinationReference
(
""
))
self
.
assertTrue
(
invoice
.
SaleInvoiceTransaction_isLettered
())
self
.
assertTrue
(
reversale_invoice
.
SaleInvoiceTransaction_isLettered
())
# Another trade condition
self
.
assertEqual
(
reversale_invoice
.
getSpecialise
(),
"sale_trade_condition_module/slapos_manual_accounting_trade_condition"
)
self
.
tic
()
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_bad_state
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_bad_state
(
payment_mode
=
'wechat'
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_zero_price
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_zero_price
(
payment_mode
=
'wechat'
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_wrong_trade_condition
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_wrong_trade_condition
(
payment_mode
=
'wechat'
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_paid
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_paid
(
payment_mode
=
'wechat'
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_registered_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransactionForReversal
(
payment_mode
=
'wechat'
)
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Payment Transaction"
,
payment_mode
=
'wechat'
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
self
.
tic
()
payment
.
PaymentTransaction_generateWechatId
()
self
.
assertRaises
(
ValueError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_ok
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_ok
(
payment_mode
=
'wechat'
)
@
withAbort
def
test_createReversalSaleInvoiceTransaction_wechat_ok_dont_autocancel
(
self
):
self
.
test_createReversalSaleInvoiceTransaction_ok_dont_autocancel
(
payment_mode
=
'wechat'
)
@
withAbort
def
test_AccountingTransaction_getPaymentState_draft_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
@
withAbort
def
test_AccountingTransaction_getPaymentState_deleted_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
delete
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
@
withAbort
def
test_AccountingTransaction_getPaymentState_cancelled_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
cancel
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
@
withAbort
def
test_AccountingTransaction_getPaymentState_planned_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
plan
()
self
.
assertEqual
(
"Ongoing"
,
invoice
.
AccountingTransaction_getPaymentState
())
@
withAbort
def
test_AccountingTransaction_getPaymentState_confirmed_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
setStartDate
(
DateTime
())
invoice
.
confirm
()
self
.
assertEqual
(
"Ongoing"
,
invoice
.
AccountingTransaction_getPaymentState
())
@
withAbort
def
test_AccountingTransaction_getPaymentState_started_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
start
()
self
.
assertEqual
(
"Ongoing"
,
invoice
.
AccountingTransaction_getPaymentState
())
@
withAbort
def
test_AccountingTransaction_getPaymentState_payzen_reversed_payment
(
self
):
invoice
=
self
.
createStoppedSaleInvoiceTransaction
()
self
.
tic
()
reversal
=
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
(
batch_mode
=
1
)
self
.
tic
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
self
.
assertEqual
(
0
,
invoice
.
getTotalPrice
()
+
reversal
.
getTotalPrice
())
@
withAbort
def
test_AccountingTransaction_getPaymentState_wechat_reversed_payment
(
self
):
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
payment_mode
=
'wechat'
)
self
.
tic
()
reversal
=
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
(
batch_mode
=
1
)
self
.
tic
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
self
.
assertEqual
(
0
,
invoice
.
getTotalPrice
()
+
reversal
.
getTotalPrice
())
def
test_AccountingTransaction_getPaymentState_payzen_free_payment
(
self
):
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
price
=
0
)
self
.
tic
()
self
.
assertEqual
(
"Free!"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_wechat_free_payment
(
self
):
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
price
=
0
,
payment_mode
=
'wechat'
)
self
.
tic
()
self
.
assertEqual
(
"Free!"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_payzen_unpaid_payment
(
self
):
invoice
=
self
.
createStoppedSaleInvoiceTransaction
()
# If payment is not indexed or not started the state should be Pay Now
self
.
assertEqual
(
"Pay Now"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_wechat_unpaid_payment
(
self
):
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
payment_mode
=
'wechat'
)
# If payment is not indexed or not started the state should be Pay Now
self
.
assertEqual
(
"Pay Now"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_payzen_paynow_payment
(
self
):
person
=
self
.
makePerson
()
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
"Pay Now"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_wechat_paynow_payment
(
self
):
person
=
self
.
makePerson
()
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
"wechat"
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
"Pay Now"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_payzen_waiting_payment
(
self
):
person
=
self
.
makePerson
()
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
())
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Payment Transaction"
,
payment_mode
=
'payzen'
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
payment
.
PaymentTransaction_generatePayzenId
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
"Waiting for payment confirmation"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_wechat_waiting_payment
(
self
):
person
=
self
.
makePerson
()
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
'wechat'
)
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Payment Transaction"
,
payment_mode
=
'wechat'
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
payment
.
PaymentTransaction_generateWechatId
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
"Waiting for payment confirmation"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_payzen_papaid_payment
(
self
):
invoice
=
self
.
createStoppedSaleInvoiceTransaction
()
self
.
tic
()
for
line
in
invoice
.
getMovementList
(
self
.
portal
.
getPortalAccountingMovementTypeList
()):
node_value
=
line
.
getSourceValue
(
portal_type
=
'Account'
)
if
node_value
.
getAccountType
()
==
'asset/receivable'
:
line
.
setGroupingReference
(
"TEST%s"
%
self
.
new_id
)
self
.
assertEqual
(
"Paid"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_wechat_paid_payment
(
self
):
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
payment_mode
=
'wechat'
)
self
.
tic
()
for
line
in
invoice
.
getMovementList
(
self
.
portal
.
getPortalAccountingMovementTypeList
()):
node_value
=
line
.
getSourceValue
(
portal_type
=
'Account'
)
if
node_value
.
getAccountType
()
==
'asset/receivable'
:
line
.
setGroupingReference
(
"TEST%s"
%
self
.
new_id
)
self
.
assertEqual
(
"Paid"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_wire_transfer_paid_payment
(
self
):
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
payment_mode
=
'wire_transfer'
)
self
.
tic
()
for
line
in
invoice
.
getMovementList
(
self
.
portal
.
getPortalAccountingMovementTypeList
()):
node_value
=
line
.
getSourceValue
(
portal_type
=
'Account'
)
if
node_value
.
getAccountType
()
==
'asset/receivable'
:
line
.
setGroupingReference
(
"TEST%s"
%
self
.
new_id
)
self
.
assertEqual
(
"Paid"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_Base_getReceivableAccountList
(
self
):
account_list
=
self
.
portal
.
Base_getReceivableAccountList
()
self
.
assertIn
(
'account_module/receivable'
,
[
i
.
getRelativeUrl
()
for
i
in
account_list
])
\ No newline at end of file
master/bt5/slapos_
payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenBuilder
.py
→
master/bt5/slapos_
accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSEntityCreatePayment
.py
View file @
21504241
# -*- coding:
utf-8 -*-
# -*- coding:utf-8 -*-
##############################################################################
##############################################################################
#
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2022 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
##############################################################################
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
class
TestSlapOS
PaymentTransactionOrderBuilder
Mixin
(
SlapOSTestCaseMixin
):
class
TestSlapOS
EntityCreatePayment
Mixin
(
SlapOSTestCaseMixin
):
def
sumReceivable
(
self
,
payment_transaction
):
def
sumReceivable
(
self
,
payment_transaction
):
quantity
=
.
0
quantity
=
.
0
...
@@ -22,7 +36,7 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
...
@@ -22,7 +36,7 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
def
assertPayment
(
self
,
payment
,
invoice
):
def
assertPayment
(
self
,
payment
,
invoice
):
self
.
assertEqual
(
self
.
sumReceivable
(
invoice
),
payment
\
self
.
assertEqual
(
self
.
sumReceivable
(
invoice
),
payment
\
.
PaymentTransaction_getTotalPayablePrice
())
.
PaymentTransaction_getTotalPayablePrice
())
self
.
assertEqual
(
'
confirm
ed'
,
payment
.
getSimulationState
())
self
.
assertEqual
(
'
start
ed'
,
payment
.
getSimulationState
())
self
.
assertSameSet
([],
payment
.
checkConsistency
())
self
.
assertSameSet
([],
payment
.
checkConsistency
())
self
.
assertSameSet
([
invoice
],
payment
.
getCausalityValueList
())
self
.
assertSameSet
([
invoice
],
payment
.
getCausalityValueList
())
self
.
assertSameSet
([],
payment
.
getCausalityRelatedValueList
(
self
.
assertSameSet
([],
payment
.
getCausalityRelatedValueList
(
...
@@ -63,19 +77,14 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
...
@@ -63,19 +77,14 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
'destination/account_module/payable'
,
'destination/account_module/payable'
,
'source/account_module/receivable'
])
'source/account_module/receivable'
])
def
emptyBuild
(
self
,
**
kw
):
def
fullBuild
(
self
,
person
,
invoice_list
):
delivery_list
=
self
.
_build
(
**
kw
)
payment
=
person
.
Entity_createPaymentTransaction
(
invoice_list
)
self
.
assert
SameSet
([],
delivery_lis
t
)
self
.
assert
NotEqual
(
None
,
paymen
t
)
return
delivery_lis
t
return
paymen
t
def
fullBuild
(
self
,
**
kw
):
def
resetPaymentTag
(
self
,
invoice
):
delivery_list
=
self
.
_build
(
**
kw
)
payment_tag
=
"sale_invoice_transaction_create_payment_%s"
%
invoice
.
getUid
()
self
.
assertNotEqual
([],
delivery_list
)
invoice
.
REQUEST
.
set
(
payment_tag
,
None
)
return
delivery_list
def
_build
(
self
,
**
kw
):
return
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
.
build
(
**
kw
)
def
_test
(
self
):
def
_test
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
person
=
self
.
portal
.
person_module
.
template_member
\
...
@@ -87,12 +96,8 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
...
@@ -87,12 +96,8 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
invoice
.
confirm
()
invoice
.
confirm
()
invoice
.
stop
()
invoice
.
stop
()
self
.
tic
()
self
.
tic
()
payment
_list
=
self
.
fullBuild
(
uid
=
invoice
.
getUid
()
)
payment
=
self
.
fullBuild
(
person
,
[
invoice
]
)
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
1
,
len
(
payment_list
))
payment
=
payment_list
[
0
].
getObject
()
self
.
assertPayment
(
payment
,
invoice
)
self
.
assertPayment
(
payment
,
invoice
)
def
_test_twice
(
self
):
def
_test_twice
(
self
):
...
@@ -105,13 +110,13 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
...
@@ -105,13 +110,13 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
invoice
.
confirm
()
invoice
.
confirm
()
invoice
.
stop
()
invoice
.
stop
()
self
.
tic
()
self
.
tic
()
payment_list
=
self
.
fullBuild
(
uid
=
invoice
.
getUid
())
payment
=
self
.
fullBuild
(
person
,
[
invoice
])
self
.
assertPayment
(
payment
,
invoice
)
self
.
tic
()
self
.
tic
()
self
.
emptyBuild
(
uid
=
invoice
.
getUid
()
)
self
.
resetPaymentTag
(
invoice
)
self
.
assertEqual
(
1
,
len
(
payment_list
))
# Create twice, generate 2 payments
payment
=
self
.
fullBuild
(
person
,
[
invoice
])
payment
=
payment_list
[
0
].
getObject
()
self
.
assertPayment
(
payment
,
invoice
)
self
.
assertPayment
(
payment
,
invoice
)
def
_test_twice_transaction
(
self
):
def
_test_twice_transaction
(
self
):
...
@@ -124,13 +129,9 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
...
@@ -124,13 +129,9 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
invoice
.
confirm
()
invoice
.
confirm
()
invoice
.
stop
()
invoice
.
stop
()
self
.
tic
()
self
.
tic
()
payment
_list
=
self
.
fullBuild
(
uid
=
invoice
.
getUid
()
)
payment
=
self
.
fullBuild
(
person
,
[
invoice
]
)
self
.
emptyBuild
(
uid
=
invoice
.
getUid
()
)
self
.
assertRaises
(
ValueError
,
person
.
Entity_createPaymentTransaction
,
[
invoice
]
)
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
1
,
len
(
payment_list
))
payment
=
payment_list
[
0
].
getObject
()
self
.
assertPayment
(
payment
,
invoice
)
self
.
assertPayment
(
payment
,
invoice
)
def
_test_twice_indexation
(
self
):
def
_test_twice_indexation
(
self
):
...
@@ -143,17 +144,18 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
...
@@ -143,17 +144,18 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
invoice
.
confirm
()
invoice
.
confirm
()
invoice
.
stop
()
invoice
.
stop
()
self
.
tic
()
self
.
tic
()
payment
_list
=
self
.
fullBuild
(
uid
=
invoice
.
getUid
()
)
payment
=
self
.
fullBuild
(
person
,
[
invoice
]
)
self
.
commit
()
self
.
commit
()
# the payment transaction is immediately indexed
# Request was over, so emulate start a new one
self
.
assertEqual
(
1
,
len
(
payment_list
))
self
.
resetPaymentTag
(
invoice
)
self
.
emptyBuild
(
uid
=
invoice
.
getUid
())
self
.
tic
()
# Should we take into account that a payment is ongoing?
payment2
=
self
.
fullBuild
(
person
,
[
invoice
])
payment
=
payment_list
[
0
].
getObject
()
self
.
tic
()
self
.
assertPayment
(
payment
,
invoice
)
self
.
assertPayment
(
payment
,
invoice
)
self
.
assertPayment
(
payment2
,
invoice
)
def
_test_cancelled_payment
(
self
):
def
_test_cancelled_payment
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
person
=
self
.
portal
.
person_module
.
template_member
\
...
@@ -165,18 +167,13 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
...
@@ -165,18 +167,13 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
invoice
.
confirm
()
invoice
.
confirm
()
invoice
.
stop
()
invoice
.
stop
()
self
.
tic
()
self
.
tic
()
payment
_list
=
self
.
fullBuild
(
uid
=
invoice
.
getUid
()
)
payment
=
self
.
fullBuild
(
person
,
[
invoice
]
)
payment
_list
[
0
]
.
cancel
()
payment
.
cancel
()
self
.
tic
()
self
.
tic
()
self
.
portal
.
REQUEST
.
set
(
"sale_invoice_transaction_order_builder_%s"
%
invoice
.
getUid
(),
Non
e
)
self
.
resetPaymentTag
(
invoic
e
)
payment
_list
=
self
.
fullBuild
(
uid
=
invoice
.
getUid
()
)
payment
=
self
.
fullBuild
(
person
,
[
invoice
]
)
self
.
tic
()
self
.
tic
()
self
.
emptyBuild
(
uid
=
invoice
.
getUid
())
self
.
assertEqual
(
1
,
len
(
payment_list
))
payment
=
payment_list
[
0
].
getObject
()
self
.
assertPayment
(
payment
,
invoice
)
self
.
assertPayment
(
payment
,
invoice
)
def
_test_two_invoices
(
self
):
def
_test_two_invoices
(
self
):
...
@@ -195,7 +192,8 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
...
@@ -195,7 +192,8 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
invoice_2
.
confirm
()
invoice_2
.
confirm
()
invoice_2
.
stop
()
invoice_2
.
stop
()
self
.
tic
()
self
.
tic
()
payment_list
=
self
.
fullBuild
(
uid
=
[
invoice_1
.
getUid
(),
invoice_2
.
getUid
()])
payment_list
=
[
self
.
fullBuild
(
person
,
[
invoice_1
]),
self
.
fullBuild
(
person
,
[
invoice_2
])]
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
2
,
len
(
payment_list
))
self
.
assertEqual
(
2
,
len
(
payment_list
))
...
@@ -236,21 +234,17 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
...
@@ -236,21 +234,17 @@ class TestSlapOSPaymentTransactionOrderBuilderMixin(SlapOSTestCaseMixin):
invoice
.
confirm
()
invoice
.
confirm
()
invoice
.
stop
()
invoice
.
stop
()
self
.
tic
()
self
.
tic
()
payment
_list
=
self
.
fullBuild
(
uid
=
[
invoice
.
getUid
()
])
payment
=
self
.
fullBuild
(
person
,
[
invoice
])
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
1
,
len
(
payment_list
))
payment
=
payment_list
[
0
].
getObject
()
self
.
assertPayment
(
payment
,
invoice
)
self
.
assertPayment
(
payment
,
invoice
)
class
TestSlapOS
PaymentTransactionOrderBuilder
(
TestSlapOSPaymentTransactionOrderBuilder
Mixin
):
class
TestSlapOS
EntityCreatePayment
(
TestSlapOSEntityCreatePayment
Mixin
):
payment_mode
=
"
payzen
"
payment_mode
=
"
wire_transfer
"
test
=
TestSlapOS
PaymentTransactionOrderBuilder
Mixin
.
_test
test
=
TestSlapOS
EntityCreatePayment
Mixin
.
_test
test_twice
=
TestSlapOS
PaymentTransactionOrderBuilder
Mixin
.
_test_twice
test_twice
=
TestSlapOS
EntityCreatePayment
Mixin
.
_test_twice
test_twice_transaction
=
TestSlapOS
PaymentTransactionOrderBuilder
Mixin
.
_test_twice_transaction
test_twice_transaction
=
TestSlapOS
EntityCreatePayment
Mixin
.
_test_twice_transaction
test_twice_indexation
=
TestSlapOS
PaymentTransactionOrderBuilder
Mixin
.
_test_twice_indexation
test_twice_indexation
=
TestSlapOS
EntityCreatePayment
Mixin
.
_test_twice_indexation
test_cancelled_payment
=
TestSlapOS
PaymentTransactionOrderBuilder
Mixin
.
_test_cancelled_payment
test_cancelled_payment
=
TestSlapOS
EntityCreatePayment
Mixin
.
_test_cancelled_payment
test_two_invoices
=
TestSlapOS
PaymentTransactionOrderBuilder
Mixin
.
_test_two_invoices
test_two_invoices
=
TestSlapOS
EntityCreatePayment
Mixin
.
_test_two_invoices
test_two_lines
=
TestSlapOS
PaymentTransactionOrderBuilder
Mixin
.
_test_two_lines
test_two_lines
=
TestSlapOS
EntityCreatePayment
Mixin
.
_test_two_lines
master/bt5/slapos_
wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatBuilder
.xml
→
master/bt5/slapos_
accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSEntityCreatePayment
.xml
View file @
21504241
...
@@ -6,15 +6,9 @@
...
@@ -6,15 +6,9 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOS
WechatBuilder
</string>
</value>
<value>
<string>
testSlapOS
EntityCreatePayment
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
...
@@ -24,7 +18,7 @@
...
@@ -24,7 +18,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOS
WechatBuilder
</string>
</value>
<value>
<string>
test.erp5.testSlapOS
EntityCreatePayment
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
portal_type
</string>
</key>
<key>
<string>
portal_type
</string>
</key>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_accounting/bt/template_test_id_list
View file @
21504241
...
@@ -6,4 +6,5 @@ test.erp5.testSlapOSContractSkins
...
@@ -6,4 +6,5 @@ test.erp5.testSlapOSContractSkins
test.erp5.testSlapOSAccountingInteractionWorkflow
test.erp5.testSlapOSAccountingInteractionWorkflow
test.erp5.testSlapOSAccountingSkins
test.erp5.testSlapOSAccountingSkins
test.erp5.testSlapOSAccountingAlarm
test.erp5.testSlapOSAccountingAlarm
test.erp5.testSlapOSContractAlarm
test.erp5.testSlapOSContractAlarm
\ No newline at end of file
test.erp5.testSlapOSEntityCreatePayment
\ No newline at end of file
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
View file @
21504241
# -*- coding:
utf-8 -*-
# -*- coding:utf-8 -*-
##############################################################################
##############################################################################
#
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
##############################################################################
##############################################################################
...
@@ -432,23 +446,6 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
...
@@ -432,23 +446,6 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
self
.
tic
()
builder
=
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
for
_
in
range
(
500
):
# build the aggregated payment
self
.
stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm
()
self
.
tic
()
# If there is something unbuild recall alarm.
if
len
(
builder
.
OrderBuilder_generateUnrelatedInvoiceList
()):
break
# start the payzen payment
self
.
stepCallSlaposPayzenUpdateConfirmedPaymentAlarm
()
self
.
tic
()
# stabilise the payment deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# trigger the CRM interaction
# trigger the CRM interaction
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
tic
()
self
.
tic
()
...
@@ -560,18 +557,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
...
@@ -560,18 +557,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
payment_list
=
invoice
.
getCausalityRelatedValueList
(
payment_list
=
invoice
.
getCausalityRelatedValueList
(
portal_type
=
'Payment Transaction'
)
portal_type
=
'Payment Transaction'
)
self
.
assertEqual
(
1
,
len
(
payment_list
))
self
.
assertEqual
(
0
,
len
(
payment_list
))
payment
=
payment_list
[
0
].
getObject
()
causality_list
=
payment
.
getCausalityValueList
()
self
.
assertSameSet
([
invoice
],
causality_list
)
self
.
assertEqual
(
'started'
,
payment
.
getSimulationState
())
self
.
assertEqual
(
'draft'
,
payment
.
getCausalityState
())
self
.
assertEqual
(
-
1
*
payment
.
PaymentTransaction_getTotalPayablePrice
(),
invoice
.
getTotalPrice
())
def
assertPersonDocumentCoverage
(
self
,
person
):
def
assertPersonDocumentCoverage
(
self
,
person
):
self
.
login
()
self
.
login
()
...
@@ -666,28 +652,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
...
@@ -666,28 +652,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
self
.
assertEqual
(
None
,
to_click_message
)
self
.
assertEqual
(
None
,
to_click_message
)
@
changeSkin
(
'RJS'
)
@
changeSkin
(
'RJS'
)
def
useWechatManually
(
self
,
web_site
,
user_id
,
is_email_expected
=
True
):
def
usePaymentManually
(
self
,
web_site
,
user_id
,
is_email_expected
=
True
,
subscription_request
=
None
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
user_id
=
user_id
)
self
.
assertNotEqual
(
person
,
None
)
self
.
assertInvoiceNotification
(
person
,
is_email_expected
)
# If you are using live test, be aware that the call of the alarm can be
# not enough for the number of objects on the site.
document_id
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Payment Transaction"
,
simulation_state
=
"started"
,
destination_section_uid
=
person
.
getUid
()
).
getId
()
web_site
.
accounting_module
[
document_id
].
\
PaymentTransaction_redirectToManualWechatPayment
()
@
changeSkin
(
'RJS'
)
def
usePayzenManually
(
self
,
web_site
,
user_id
,
is_email_expected
=
True
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
portal_type
=
"Person"
,
user_id
=
user_id
)
user_id
=
user_id
)
...
@@ -695,17 +660,27 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
...
@@ -695,17 +660,27 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
self
.
assertNotEqual
(
person
,
None
)
self
.
assertNotEqual
(
person
,
None
)
self
.
assertInvoiceNotification
(
person
,
is_email_expected
)
self
.
assertInvoiceNotification
(
person
,
is_email_expected
)
# Pay to payzen...
invoice_list
=
person
.
Entity_getOutstandingAmountList
()
# If you are using live test, be aware that the call of the alarm can be
# not enough for the number of objects on the site.
self
.
login
()
document_id
=
self
.
portal
.
portal_catalog
.
getResultValue
(
if
subscription_request
is
not
None
:
portal_type
=
"Payment Transaction"
,
expected_causality
=
subscription_request
.
getRelativeUrl
()
simulation_state
=
"started"
,
filtered_invoice_list
=
[]
destination_section_uid
=
person
.
getUid
()
for
invoice
in
invoice_list
:
).
getId
()
spl
=
invoice
.
getCausalityValue
()
if
spl
is
not
None
and
spl
.
getCausality
()
==
expected_causality
:
filtered_invoice_list
.
append
(
invoice
)
self
.
assertEqual
(
len
(
filtered_invoice_list
),
1
)
invoice_list
=
filtered_invoice_list
else
:
self
.
assertEqual
(
len
(
invoice_list
),
1
)
self
.
login
(
user_id
)
document_id
=
invoice_list
[
0
].
getId
()
web_site
.
accounting_module
[
document_id
].
\
web_site
.
accounting_module
[
document_id
].
\
PaymentTransaction_redirectToManualPayzenPayment
()
SaleInvoiceTransaction_redirectToManualSlapOSPayment
()
self
.
tic
()
def
assertSubscriptionStopped
(
self
,
person
):
def
assertSubscriptionStopped
(
self
,
person
):
self
.
login
()
self
.
login
()
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
21504241
...
@@ -567,13 +567,13 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
...
@@ -567,13 +567,13 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
reference
=
"TESTTRANS-%s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
)
)
def
createSaleInvoiceTransaction
(
self
):
def
createSaleInvoiceTransaction
(
self
,
**
kw
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
return
self
.
portal
.
accounting_module
.
newContent
(
return
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
,
portal_type
=
'Sale Invoice Transaction'
,
title
=
"Invoice %s"
%
new_id
,
title
=
"Invoice %s"
%
new_id
,
reference
=
"TESTSIT-%s"
%
new_id
,
reference
=
"TESTSIT-%s"
%
new_id
,
)
**
kw
)
def
createPayzenEvent
(
self
):
def
createPayzenEvent
(
self
):
return
self
.
portal
.
system_event_module
.
newContent
(
return
self
.
portal
.
system_event_module
.
newContent
(
...
@@ -585,16 +585,11 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
...
@@ -585,16 +585,11 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
portal_type
=
'Wechat Event'
,
portal_type
=
'Wechat Event'
,
reference
=
'PAY-%s'
%
self
.
generateNewId
())
reference
=
'PAY-%s'
%
self
.
generateNewId
())
def
createPayzenSaleInvoiceTransaction
(
self
,
destination_section
=
None
,
price
=
2
,
payment_mode
=
"payzen"
):
def
createStoppedSaleInvoiceTransaction
(
self
,
destination_section
=
None
,
price
=
2
,
payment_mode
=
"payzen"
):
new_title
=
self
.
generateNewId
()
new_reference
=
self
.
generateNewId
()
new_source_reference
=
self
.
generateNewId
()
new_source_reference
=
self
.
generateNewId
()
new_destination_reference
=
self
.
generateNewId
()
new_destination_reference
=
self
.
generateNewId
()
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
invoice
=
self
.
createSaleInvoiceTransaction
(
portal_type
=
"Sale Invoice Transaction"
,
title
=
new_title
,
start_date
=
DateTime
(),
start_date
=
DateTime
(),
reference
=
new_reference
,
source_reference
=
new_source_reference
,
source_reference
=
new_source_reference
,
destination_reference
=
new_destination_reference
,
destination_reference
=
new_destination_reference
,
destination_section
=
destination_section
,
destination_section
=
destination_section
,
...
@@ -614,23 +609,8 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
...
@@ -614,23 +609,8 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
source
=
"account_module/receivable"
,
source
=
"account_module/receivable"
,
quantity
=-
3
,
quantity
=-
3
,
)
)
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Payment Transaction"
,
payment_mode
=
payment_mode
,
causality_value
=
invoice
,
destination_section
=
destination_section
,
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
return
invoice
return
invoice
def
createWechatSaleInvoiceTransaction
(
self
,
destination_section
=
None
,
price
=
2
):
return
self
.
createPayzenSaleInvoiceTransaction
(
destination_section
=
destination_section
,
price
=
price
,
payment_mode
=
'wechat'
)
def
createRegularisationRequest
(
self
):
def
createRegularisationRequest
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
return
self
.
portal
.
regularisation_request_module
.
newContent
(
return
self
.
portal
.
regularisation_request_module
.
newContent
(
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.xml
View file @
21504241
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SlapOSTestCaseMixin
</string>
</value>
<value>
<string>
SlapOSTestCaseMixin
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Alarm_createRegularisationRequest.py
View file @
21504241
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
person_uid_list
=
[]
for
(
_
,
brain
)
in
enumerate
(
portal
.
portal_simulation
.
getInventoryList
(
simulation_state
=
(
'stopped'
,
'delivered'
),
parent_payment_mode_uid
=
[
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
()],
group_by_mirror_section
=
True
,
portal_type
=
portal
.
getPortalAccountingMovementTypeList
(),
node_uid
=
[
x
.
uid
for
x
in
context
.
Base_getReceivableAccountList
()],
grouping_reference
=
None
)):
payment_request_uid
=
brain
.
payment_request_uid
if
not
payment_request_uid
:
payment_request_uid
=
brain
.
getObject
().
getExplanationUid
()
payment_request
=
portal
.
portal_catalog
.
getObject
(
uid
=
payment_request_uid
)
section_uid
=
payment_request
.
getDestinationSectionUid
(
portal_type
=
"Person"
)
if
section_uid
is
not
None
:
person_uid_list
.
append
(
section_uid
)
portal
.
portal_catalog
.
searchAndActivate
(
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Person"
,
portal_type
=
"Person"
,
validation_state
=
"validated"
,
validation_state
=
"validated"
,
destination_section_related__portal_type
=
"Payment Transaction"
,
uid
=
person_uid_list
,
destination_section_related__simulation_state
=
"started"
,
method_id
=
'Person_checkToCreateRegularisationRequest'
,
method_id
=
'Person_checkToCreateRegularisationRequest'
,
activate_kw
=
{
'tag'
:
tag
}
activate_kw
=
{
'tag'
:
tag
}
)
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.py
View file @
21504241
...
@@ -28,12 +28,12 @@ outstanding_amount = person.Entity_statSlapOSOutstandingAmount()
...
@@ -28,12 +28,12 @@ outstanding_amount = person.Entity_statSlapOSOutstandingAmount()
# Amount to be ignored, as it comes from the first invoice generated
# Amount to be ignored, as it comes from the first invoice generated
# after the subscription. We do not take it into account as no service
# after the subscription. We do not take it into account as no service
# was provided yet.
# was provided yet.
unpaid_
payment
_amount
=
0
unpaid_
invoice
_amount
=
0
for
payment
in
person
.
Person_getSubscriptionRequestFirstUnpaidPayment
List
():
for
invoice
in
person
.
Person_getSubscriptionRequestFirstUnpaidInvoice
List
():
unpaid_
payment_amount
+=
payment
.
PaymentTransaction_getTotalPayable
Price
()
unpaid_
invoice_amount
+=
invoice
.
getTotal
Price
()
# It can't be smaller, we are considernig all open invoices are from unpaid_payment_amount
# It can't be smaller, we are considernig all open invoices are from unpaid_payment_amount
if
round
(
float
(
outstanding_amount
),
2
)
==
round
(
-
float
(
unpaid_payment
_amount
),
2
):
if
round
(
float
(
outstanding_amount
),
2
)
==
round
(
float
(
unpaid_invoice
_amount
),
2
):
return
ticket
,
None
return
ticket
,
None
if
int
(
outstanding_amount
)
>
0
:
if
int
(
outstanding_amount
)
>
0
:
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_getSubscriptionRequestFirstUnpaid
Payment
List.py
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_getSubscriptionRequestFirstUnpaid
Invoice
List.py
View file @
21504241
...
@@ -12,8 +12,8 @@ subscription_request_list = portal.portal_catalog(
...
@@ -12,8 +12,8 @@ subscription_request_list = portal.portal_catalog(
creation_date
=
Query
(
creation_date
=
addToDate
(
DateTime
(),
to_add
=
{
'day'
:
-
20
}),
range
=
"min"
))
creation_date
=
Query
(
creation_date
=
addToDate
(
DateTime
(),
to_add
=
{
'day'
:
-
20
}),
range
=
"min"
))
for
subscription_request
in
subscription_request_list
:
for
subscription_request
in
subscription_request_list
:
first_
period_payment
=
subscription_request
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
first_
invoice
=
subscription_request
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
if
first_
period_payment
is
not
None
and
first_period_payment
.
getSimulationState
()
==
"started"
:
if
first_
invoice
is
not
None
and
not
first_invoice
.
SaleInvoiceTransaction_isLettered
()
:
unpaid_list
.
append
(
first_
period_payment
)
unpaid_list
.
append
(
first_
invoice
)
return
unpaid_list
return
unpaid_list
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_getSubscriptionRequestFirstUnpaid
Payment
List.xml
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_getSubscriptionRequestFirstUnpaid
Invoice
List.xml
View file @
21504241
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_getSubscriptionRequestFirstUnpaid
Payment
List
</string>
</value>
<value>
<string>
Person_getSubscriptionRequestFirstUnpaid
Invoice
List
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_invalidateIfPersonBalanceIsOk.py
View file @
21504241
...
@@ -13,12 +13,12 @@ outstanding_amount = person.Entity_statSlapOSOutstandingAmount()
...
@@ -13,12 +13,12 @@ outstanding_amount = person.Entity_statSlapOSOutstandingAmount()
# Amount to be ignored, as it comes from the first invoice generated
# Amount to be ignored, as it comes from the first invoice generated
# after the subscription. We do not take it into account as no service
# after the subscription. We do not take it into account as no service
# was provided yet.
# was provided yet.
unpaid_
payment
_amount
=
0
unpaid_
invoice
_amount
=
0
for
payment
in
person
.
Person_getSubscriptionRequestFirstUnpaidPayment
List
():
for
invoice
in
person
.
Person_getSubscriptionRequestFirstUnpaidInvoice
List
():
unpaid_
payment_amount
+=
payment
.
PaymentTransaction_getTotalPayable
Price
()
unpaid_
invoice_amount
+=
invoice
.
getTotal
Price
()
# It can't be smaller, we are considernig all open invoices are from unpaid_payment_amount
# It can't be smaller, we are considernig all open invoices are from unpaid_payment_amount
if
round
(
float
(
outstanding_amount
),
2
)
==
round
(
-
float
(
unpaid_payment
_amount
),
2
):
if
round
(
float
(
outstanding_amount
),
2
)
==
round
(
float
(
unpaid_invoice
_amount
),
2
):
context
.
invalidate
(
comment
=
"Automatically disabled as balance is %s"
%
outstanding_amount
)
context
.
invalidate
(
comment
=
"Automatically disabled as balance is %s"
%
outstanding_amount
)
return
return
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
21504241
...
@@ -27,6 +27,52 @@ from DateTime import DateTime
...
@@ -27,6 +27,52 @@ from DateTime import DateTime
class
TestSlapOSCRMCreateRegularisationRequest
(
SlapOSTestCaseMixin
):
class
TestSlapOSCRMCreateRegularisationRequest
(
SlapOSTestCaseMixin
):
def
createFinalInvoice
(
self
,
person
):
template
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate
())
current_invoice
=
template
.
Base_createCloneDocument
(
batch_mode
=
1
)
current_invoice
.
edit
(
destination_value
=
person
,
destination_section_value
=
person
,
destination_decision_value
=
person
,
start_date
=
DateTime
(
'2019/10/20'
),
stop_date
=
DateTime
(
'2019/10/20'
),
title
=
'Fake Invoice for Demo User Functional'
,
price_currency
=
"currency_module/EUR"
,
reference
=
'1'
)
cell
=
current_invoice
[
"1"
][
"movement_0"
]
cell
.
edit
(
quantity
=
1
)
cell
.
setPrice
(
1
)
current_invoice
.
plan
()
current_invoice
.
confirm
()
current_invoice
.
startBuilding
()
current_invoice
.
reindexObject
()
current_invoice
.
stop
()
self
.
tic
()
current_invoice
.
Delivery_manageBuildingCalculatingDelivery
()
self
.
tic
()
applied_rule
=
current_invoice
.
getCausalityRelated
(
portal_type
=
"Applied Rule"
)
for
sm
in
self
.
portal
.
portal_catalog
(
portal_type
=
'Simulation Movement'
,
simulation_state
=
[
'draft'
,
'planned'
,
None
],
left_join_list
=
[
'delivery_uid'
],
delivery_uid
=
None
,
path
=
"%%%s%%"
%
applied_rule
):
if
sm
.
getDelivery
()
is
not
None
:
continue
root_applied_rule
=
sm
.
getRootAppliedRule
()
root_applied_rule_path
=
root_applied_rule
.
getPath
()
sm
.
getCausalityValue
(
portal_type
=
'Business Link'
).
build
(
path
=
'%s/%%'
%
root_applied_rule_path
)
return
current_invoice
def
test_alarm_expected_person
(
self
):
def
test_alarm_expected_person
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
person
=
self
.
portal
.
person_module
.
newContent
(
...
@@ -35,14 +81,7 @@ class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
...
@@ -35,14 +81,7 @@ class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
)
)
person
.
validate
()
person
.
validate
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
self
.
createFinalInvoice
(
person
)
portal_type
=
'Payment Transaction'
,
title
=
"Payment Transaction for TestSlapOSCRMCreateRegularisationRequest person %s"
%
new_id
,
destination_section
=
person
.
getRelativeUrl
(),
start_date
=
DateTime
()
)
payment
.
confirm
()
payment
.
start
()
self
.
tic
()
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
alarm
=
self
.
portal
.
portal_alarms
.
\
...
@@ -56,17 +95,9 @@ class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
...
@@ -56,17 +95,9 @@ class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
title
=
"Test person %s"
%
new_id
title
=
"Test person %s"
%
new_id
)
)
person
.
validate
()
person
.
validate
()
self
.
createFinalInvoice
(
person
)
person
.
invalidate
()
person
.
invalidate
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment Transaction for TestSlapOSCRMCreateRegularisationRequest person %s"
%
new_id
,
destination_section
=
person
.
getRelativeUrl
(),
start_date
=
DateTime
()
)
payment
.
confirm
()
payment
.
start
()
self
.
tic
()
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
alarm
=
self
.
portal
.
portal_alarms
.
\
slapos_crm_create_regularisation_request
slapos_crm_create_regularisation_request
...
@@ -79,23 +110,31 @@ class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
...
@@ -79,23 +110,31 @@ class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
title
=
"Test person %s"
%
new_id
title
=
"Test person %s"
%
new_id
)
)
person
.
validate
()
person
.
validate
()
current_invoice
=
self
.
createFinalInvoice
(
person
)
payment_template
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentTemplate
())
payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
for
line
in
payment
.
contentValues
():
if
line
.
getSource
()
==
"account_module/payment_to_encash"
:
line
.
setQuantity
(
-
1
)
elif
line
.
getSource
()
==
"account_module/receivable"
:
line
.
setQuantity
(
1
)
payment
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Payment Transaction for TestSlapOSCRMCreateRegularisationRequest person %s"
%
new_id
,
destination_section
=
person
.
getRelativeUrl
(),
start_date
=
DateTime
()
)
payment
.
confirm
()
payment
.
confirm
()
payment
.
start
()
payment
.
start
()
payment
.
setCausalityValue
(
current_invoice
)
payment
.
setDestinationSectionValue
(
person
)
payment
.
stop
()
payment
.
stop
()
self
.
tic
()
self
.
tic
()
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
alarm
=
self
.
portal
.
portal_alarms
.
\
slapos_crm_create_regularisation_request
slapos_crm_create_regularisation_request
self
.
_test_alarm_not_visited
(
alarm
,
person
,
"Person_checkToCreateRegularisationRequest"
)
self
.
_test_alarm_not_visited
(
alarm
,
person
,
"Person_checkToCreateRegularisationRequest"
)
def
test_alarm_payment_
confirm
ed
(
self
):
def
test_alarm_payment_
start
ed
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
portal_type
=
'Person'
,
...
@@ -103,18 +142,26 @@ class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
...
@@ -103,18 +142,26 @@ class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
)
)
person
.
validate
()
person
.
validate
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
current_invoice
=
self
.
createFinalInvoice
(
person
)
portal_type
=
'Payment Transaction'
,
payment_template
=
self
.
portal
.
restrictedTraverse
(
title
=
"Payment Transaction for TestSlapOSCRMCreateRegularisationRequest person %s"
%
new_id
,
self
.
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentTemplate
())
destination_section
=
person
.
getRelativeUrl
(),
payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
start_date
=
DateTime
()
)
for
line
in
payment
.
contentValues
():
if
line
.
getSource
()
==
"account_module/payment_to_encash"
:
line
.
setQuantity
(
-
1
)
elif
line
.
getSource
()
==
"account_module/receivable"
:
line
.
setQuantity
(
1
)
payment
.
confirm
()
payment
.
confirm
()
payment
.
start
()
payment
.
setCausalityValue
(
current_invoice
)
payment
.
setDestinationSectionValue
(
person
)
self
.
tic
()
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
alarm
=
self
.
portal
.
portal_alarms
.
\
slapos_crm_create_regularisation_request
slapos_crm_create_regularisation_request
self
.
_test_alarm
_not_visited
(
alarm
,
person
,
"Person_checkToCreateRegularisationRequest"
)
self
.
_test_alarm
(
alarm
,
person
,
"Person_checkToCreateRegularisationRequest"
)
class
TestSlapOSCrmInvalidateSuspendedRegularisationRequest
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSCrmInvalidateSuspendedRegularisationRequest
(
SlapOSTestCaseMixinWithAbort
):
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCodingStyle.py
View file @
21504241
...
@@ -149,7 +149,7 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
...
@@ -149,7 +149,7 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_crm_monitoring/Event_checkCustomerAsSourceOrDestinationConsistency'
,
'slapos_crm_monitoring/Event_checkCustomerAsSourceOrDestinationConsistency'
,
'slapos_crm_monitoring/SupportRequest_checkCausalitySourceDestinationConsistency'
,
'slapos_crm_monitoring/SupportRequest_checkCausalitySourceDestinationConsistency'
,
'slapos_crm_monitoring/SupportRequest_getLastEvent'
,
'slapos_crm_monitoring/SupportRequest_getLastEvent'
,
'slapos_crm/Person_getSubscriptionRequestFirstUnpaid
Payment
List'
,
'slapos_crm/Person_getSubscriptionRequestFirstUnpaid
Invoice
List'
,
'slapos_crm/RegularisationRequest_afterClone'
,
'slapos_crm/RegularisationRequest_afterClone'
,
'slapos_crm/RegularisationRequest_getResourceItemList'
,
'slapos_crm/RegularisationRequest_getResourceItemList'
,
'slapos_crm/RegularisationRequest_init'
,
'slapos_crm/RegularisationRequest_init'
,
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5DefaultScenario.py
View file @
21504241
# -*- coding:
utf-8 -*-
# -*- coding:utf-8 -*-
##############################################################################
##############################################################################
#
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2022 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
##############################################################################
##############################################################################
...
@@ -237,23 +251,6 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
...
@@ -237,23 +251,6 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
self
.
tic
()
builder
=
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
for
_
in
range
(
500
):
# build the aggregated payment
self
.
stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm
()
self
.
tic
()
# If there is something unbuild recall alarm.
if
len
(
builder
.
OrderBuilder_generateUnrelatedInvoiceList
()):
break
# start the payzen payment
self
.
stepCallSlaposPayzenUpdateConfirmedPaymentAlarm
()
self
.
tic
()
# stabilise the payment deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# trigger the CRM interaction
# trigger the CRM interaction
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
tic
()
self
.
tic
()
...
@@ -266,10 +263,10 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
...
@@ -266,10 +263,10 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self
.
assertPersonDocumentCoverage
(
person
)
self
.
assertPersonDocumentCoverage
(
person
)
self
.
login
(
public_person
.
getUserId
())
self
.
login
(
public_person
.
getUserId
())
self
.
usePay
zen
Manually
(
self
.
web_site
,
public_person
.
getUserId
())
self
.
usePay
ment
Manually
(
self
.
web_site
,
public_person
.
getUserId
())
self
.
login
(
friend_person
.
getUserId
())
self
.
login
(
friend_person
.
getUserId
())
self
.
usePay
zen
Manually
(
self
.
web_site
,
friend_person
.
getUserId
())
self
.
usePay
ment
Manually
(
self
.
web_site
,
friend_person
.
getUserId
())
class
TestSlapOSDefaultCRMEscalation
(
DefaultScenarioMixin
):
class
TestSlapOSDefaultCRMEscalation
(
DefaultScenarioMixin
):
...
@@ -283,6 +280,7 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
...
@@ -283,6 +280,7 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
default_source_project_uid
=
person
.
getUid
()
default_source_project_uid
=
person
.
getUid
()
)
)
self
.
assertNotEqual
(
ticket
,
None
)
event
=
self
.
portal
.
portal_catalog
.
getResultValue
(
event
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Mail Message'
,
portal_type
=
'Mail Message'
,
default_resource_uid
=
self
.
portal
.
service_module
[
service_id
].
getUid
(),
default_resource_uid
=
self
.
portal
.
service_module
[
service_id
].
getUid
(),
...
@@ -344,18 +342,7 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
...
@@ -344,18 +342,7 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
payment_list
=
invoice
.
getCausalityRelatedValueList
(
payment_list
=
invoice
.
getCausalityRelatedValueList
(
portal_type
=
'Payment Transaction'
)
portal_type
=
'Payment Transaction'
)
self
.
assertEqual
(
1
,
len
(
payment_list
))
self
.
assertEqual
(
0
,
len
(
payment_list
))
payment
=
payment_list
[
0
].
getObject
()
causality_list
=
payment
.
getCausalityValueList
()
self
.
assertSameSet
([
invoice
],
causality_list
)
self
.
assertEqual
(
'cancelled'
,
payment
.
getSimulationState
())
self
.
assertEqual
(
'draft'
,
payment
.
getCausalityState
())
self
.
assertEqual
(
-
1
*
payment
.
PaymentTransaction_getTotalPayablePrice
(),
invoice
.
getTotalPrice
())
# Check reverse invoice
# Check reverse invoice
reverse_invoice_list
=
invoice
.
getCausalityRelatedValueList
(
reverse_invoice_list
=
invoice
.
getCausalityRelatedValueList
(
...
@@ -468,23 +455,6 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
...
@@ -468,23 +455,6 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
self
.
tic
()
builder
=
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
for
_
in
range
(
500
):
# build the aggregated payment
self
.
stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm
()
self
.
tic
()
# If there is something unbuild recall alarm.
if
len
(
builder
.
OrderBuilder_generateUnrelatedInvoiceList
()):
break
# start the payzen payment
self
.
stepCallSlaposPayzenUpdateConfirmedPaymentAlarm
()
self
.
tic
()
# stabilise the payment deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# create the regularisation request
# create the regularisation request
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
tic
()
self
.
tic
()
...
@@ -525,13 +495,10 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
...
@@ -525,13 +495,10 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
# Manually cancel the users invoice
# Manually cancel the users invoice
payment
=
self
.
portal
.
portal_catalog
.
getResultValue
(
invoice_list
=
person
.
Entity_getOutstandingAmountList
()
portal_type
=
"Payment Transaction"
,
self
.
assertEqual
(
len
(
invoice_list
),
1
)
destination_section_uid
=
person
.
getUid
(),
sale_transaction_invoice
=
invoice_list
[
0
].
getObject
()
simulation_state
=
"started"
)
sale_transaction_invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
(
batch_mode
=
1
)
invoice
=
payment
.
getCausalityValue
(
portal_type
=
"Sale Invoice Transaction"
)
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
()
self
.
tic
()
self
.
tic
()
...
@@ -602,22 +569,5 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
...
@@ -602,22 +569,5 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
self
.
tic
()
builder
=
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
for
_
in
range
(
500
):
# build the aggregated payment
self
.
stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm
()
self
.
tic
()
# If there is something unbuild recall alarm.
if
len
(
builder
.
OrderBuilder_generateUnrelatedInvoiceList
()):
break
# start the payzen payment
self
.
stepCallSlaposPayzenUpdateConfirmedPaymentAlarm
()
self
.
tic
()
# stabilise the payment deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# check final document state
# check final document state
self
.
assertPersonDocumentCoverage
(
person
)
self
.
assertPersonDocumentCoverage
(
person
)
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5DefaultScenario.xml
View file @
21504241
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSERP5DefaultScenario
</string>
</value>
<value>
<string>
testSlapOSERP5DefaultScenario
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_js.js
View file @
21504241
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
}
}
if
(
1
||
(
result
.
data
.
rows
[
i
].
hasOwnProperty
(
"
id
"
)))
{
if
(
1
||
(
result
.
data
.
rows
[
i
].
hasOwnProperty
(
"
id
"
)))
{
value
=
result
.
data
.
rows
[
i
].
value
.
AccountingTransaction_getPaymentStateAsHateoas
;
value
=
result
.
data
.
rows
[
i
].
value
.
AccountingTransaction_getPaymentStateAsHateoas
;
value
.
jio_key
=
result
.
data
.
rows
[
i
].
id
;
result
.
data
.
rows
[
i
].
value
.
AccountingTransaction_getPaymentStateAsHateoas
=
{
result
.
data
.
rows
[
i
].
value
.
AccountingTransaction_getPaymentStateAsHateoas
=
{
field_gadget_param
:
{
field_gadget_param
:
{
css_class
:
""
,
css_class
:
""
,
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_js.xml
View file @
21504241
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
16
67590788.38
</float>
<float>
16
71074456.17
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_invoice_list_js.js
View file @
21504241
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
}
}
if
(
1
||
(
result
.
data
.
rows
[
i
].
hasOwnProperty
(
"
id
"
)))
{
if
(
1
||
(
result
.
data
.
rows
[
i
].
hasOwnProperty
(
"
id
"
)))
{
value
=
result
.
data
.
rows
[
i
].
value
.
AccountingTransaction_getPaymentStateAsHateoas
;
value
=
result
.
data
.
rows
[
i
].
value
.
AccountingTransaction_getPaymentStateAsHateoas
;
value
.
jio_key
=
result
.
data
.
rows
[
i
].
id
;
result
.
data
.
rows
[
i
].
value
.
AccountingTransaction_getPaymentStateAsHateoas
=
{
result
.
data
.
rows
[
i
].
value
.
AccountingTransaction_getPaymentStateAsHateoas
=
{
field_gadget_param
:
{
field_gadget_param
:
{
css_class
:
""
,
css_class
:
""
,
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_invoice_list_js.xml
View file @
21504241
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1004.
6631.33059.11776
</string>
</value>
<value>
<string>
1004.
12379.1853.8140
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
16
67930581.61
</float>
<float>
16
71070228.44
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_js.js
View file @
21504241
...
@@ -160,7 +160,7 @@
...
@@ -160,7 +160,7 @@
"
title
"
:
result
[
1
][
5
],
"
title
"
:
result
[
1
][
5
],
"
default
"
:
{
"
default
"
:
{
state
:
gadget
.
state
.
doc
.
payment_state
,
state
:
gadget
.
state
.
doc
.
payment_state
,
payment_transaction
:
gadget
.
state
.
doc
.
payment_transaction
jio_key
:
gadget
.
state
.
jio_key
},
},
"
css_class
"
:
""
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
required
"
:
1
,
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_js.xml
View file @
21504241
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
999.2068.62564.17
</string>
</value>
<value>
<string>
1004.12196.28653.10734
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
16
67919626.06
</float>
<float>
16
71070129.29
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_invoice_state_js.js
View file @
21504241
...
@@ -14,16 +14,15 @@
...
@@ -14,16 +14,15 @@
link
;
link
;
return
gadget
.
getTranslationDict
([
'
Pay Now
'
])
return
gadget
.
getTranslationDict
([
'
Pay Now
'
])
.
push
(
function
(
translation_dict
)
{
.
push
(
function
(
translation_dict
)
{
if
((
gadget
.
state
.
payment_transaction
!==
null
)
&&
if
(
gadget
.
state
.
payment_state
===
'
Pay Now
'
)
{
(
gadget
.
state
.
payment_transaction
!==
undefined
))
{
link
=
domsugar
(
"
li
"
,
{},
link
=
domsugar
(
"
li
"
,
{},
[
[
domsugar
(
"
a
"
,
{
domsugar
(
"
a
"
,
{
class
:
"
ui-btn ui-first-child ui-btn-icon-center
"
,
class
:
"
ui-btn ui-first-child ui-btn-icon-center
"
,
text
:
translation_dict
[
"
Pay Now
"
],
text
:
translation_dict
[
"
Pay Now
"
],
href
:
gadget
.
state
.
hateoas_url
+
href
:
gadget
.
state
.
hateoas_url
+
gadget
.
state
.
payment_transaction
+
gadget
.
state
.
jio_key
+
"
/
Payment
Transaction_redirectToManualSlapOSPayment
"
"
/
SaleInvoice
Transaction_redirectToManualSlapOSPayment
"
})
})
]);
]);
}
else
{
}
else
{
...
@@ -41,7 +40,7 @@
...
@@ -41,7 +40,7 @@
return
gadget
.
getSetting
(
"
hateoas_url
"
)
return
gadget
.
getSetting
(
"
hateoas_url
"
)
.
push
(
function
(
hateoas_url
)
{
.
push
(
function
(
hateoas_url
)
{
return
gadget
.
changeState
({
return
gadget
.
changeState
({
payment_transaction
:
options
.
value
.
payment_transaction
,
jio_key
:
options
.
value
.
jio_key
,
payment_state
:
options
.
value
.
state
,
payment_state
:
options
.
value
.
state
,
hateoas_url
:
hateoas_url
hateoas_url
:
hateoas_url
});
});
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_invoice_state_js.xml
View file @
21504241
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
16
67929052.34
</float>
<float>
16
71070046.11
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/AccountingTransaction_getPaymentStateAsHateoas.py
View file @
21504241
state
=
context
.
AccountingTransaction_getPaymentState
()
state
=
context
.
AccountingTransaction_getPaymentState
()
payment_transaction
=
None
payment_mode
=
None
payment_mode
=
None
if
state
==
"Pay Now"
:
if
state
==
"Pay Now"
:
payment_transaction_value
=
context
.
SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
()
payment_mode
=
context
.
getPaymentMode
()
# ???
payment_transaction
=
payment_transaction_value
.
getRelativeUrl
()
payment_mode
=
payment_transaction_value
.
getPaymentMode
()
return
{
"state"
:
context
.
Base_translateString
(
state
),
return
{
"state"
:
context
.
Base_translateString
(
state
),
"payment_mode"
:
payment_mode
,
"payment_mode"
:
payment_mode
}
"payment_transaction"
:
payment_transaction
}
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SaleInvoiceTransaction_viewAsHateoas.xml
View file @
21504241
...
@@ -100,7 +100,6 @@
...
@@ -100,7 +100,6 @@
<string>
my_resource_title
</string>
<string>
my_resource_title
</string>
<string>
my_payment_transaction_external_id
</string>
<string>
my_payment_transaction_external_id
</string>
<string>
my_payment_state
</string>
<string>
my_payment_state
</string>
<string>
my_payment_transaction
</string>
</list>
</list>
</value>
</value>
</item>
</item>
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SaleInvoiceTransaction_viewAsHateoas/my_payment_transaction.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
default
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_payment_transaction
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_string_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Payment Transaction
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: context.SaleInvoiceTransaction_getSlapOSPaymentRelated()
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSInvoiceUnpaid.zpt
View file @
21504241
...
@@ -76,12 +76,12 @@
...
@@ -76,12 +76,12 @@
</tr>
</tr>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
waitForElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
Payment
Transaction_redirectToManualSlapOSPayment')]
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
SaleInvoice
Transaction_redirectToManualSlapOSPayment')]
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
assertElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
Payment
Transaction_redirectToManualSlapOSPayment')]
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
SaleInvoice
Transaction_redirectToManualSlapOSPayment')]
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
...
@@ -165,12 +165,12 @@
...
@@ -165,12 +165,12 @@
</tr>
</tr>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
waitForElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
Payment
Transaction_redirectToManualSlapOSPayment')]
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
SaleInvoice
Transaction_redirectToManualSlapOSPayment')]
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
assertElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
Payment
Transaction_redirectToManualSlapOSPayment')]
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
SaleInvoice
Transaction_redirectToManualSlapOSPayment')]
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
...
@@ -284,12 +284,12 @@
...
@@ -284,12 +284,12 @@
</tr>
</tr>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
waitForElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
Payment
Transaction_redirectToManualSlapOSPayment')]
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
SaleInvoice
Transaction_redirectToManualSlapOSPayment')]
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
assertElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
Payment
Transaction_redirectToManualSlapOSPayment')]
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_slapos_invoice_state.html')]//a[contains(@href, '
SaleInvoice
Transaction_redirectToManualSlapOSPayment')]
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
...
...
master/bt5/slapos_jio_ui_test/SkinTemplateItem/portal_skins/slapos_ui_test/ERP5Site_createSlapOSFakeInvoiceForTestUser.py
View file @
21504241
...
@@ -74,5 +74,13 @@ if not unpaid:
...
@@ -74,5 +74,13 @@ if not unpaid:
"SimulationMovement_buildSlapOS"
,
"SimulationMovement_buildSlapOS"
,
"SaleInvoiceTransaction_forceBuildSlapOSAccountingLineList"
)
"SaleInvoiceTransaction_forceBuildSlapOSAccountingLineList"
)
).
SaleInvoiceTransaction_setFakeGroupingReference
()
).
SaleInvoiceTransaction_setFakeGroupingReference
()
payment
.
activate
(
after_method_id
=
(
"immediateReindexObject"
,
"_updateSimulation"
,
"Delivery_manageBuildingCalculatingDelivery"
,
"SimulationMovement_buildSlapOS"
,
"SaleInvoiceTransaction_forceBuildSlapOSAccountingLineList"
)
).
SaleInvoiceTransaction_setFakeGroupingReference
()
return
'Done.'
return
'Done.'
master/bt5/slapos_payzen/PathTemplateItem/portal_alarms/slapos_payzen_update_confirmed_payment.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Alarm"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_updatePayzenConfirmedPaymentTransaction
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_payzen_update_confirmed_payment
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<value>
<int>
5
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_month_day
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_start_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1288051200.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
periodicity_week
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
</item>
<item>
<key>
<string>
sense_method_id
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Handles confirmed Payment Transactions with PayZen interface
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/PathTemplateItem/portal_alarms/slapos_trigger_payment_transaction_order_builder.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Alarm"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_triggerPaymentTransactionOrderBuilder
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_trigger_payment_transaction_order_builder
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_month_day
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_start_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
548812800.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
periodicity_week
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
</item>
<item>
<key>
<string>
sense_method_id
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Trigger Payment Transaction Order Builder
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/PathTemplateItem/portal_orders/slapos_payment_transaction_builder/category_movement_group_on_delivery.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Category Movement Group"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
collect_order_group/delivery
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
category_movement_group_on_delivery
</string>
</value>
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Category Movement Group
</string>
</value>
</item>
<item>
<key>
<string>
tested_property
</string>
</key>
<value>
<tuple>
<string>
causality
</string>
<string>
destination_payment
</string>
<string>
destination_section
</string>
<string>
price_currency
</string>
<string>
resource
</string>
<string>
source_payment
</string>
<string>
source_section
</string>
<string>
specialise
</string>
<string>
payment_mode
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
update_always
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/PathTemplateItem/portal_orders/slapos_payment_transaction_builder/category_movement_group_on_line.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Category Movement Group"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
collect_order_group/line
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
category_movement_group_on_line
</string>
</value>
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Category Movement Group
</string>
</value>
</item>
<item>
<key>
<string>
tested_property
</string>
</key>
<value>
<tuple>
<string>
destination
</string>
<string>
source
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
update_always
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/PathTemplateItem/portal_orders/slapos_payment_transaction_builder/property_movement_group_on_line.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Property Movement Group"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
collect_order_group/line
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
property_movement_group_on_line
</string>
</value>
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Property Movement Group
</string>
</value>
</item>
<item>
<key>
<string>
tested_property
</string>
</key>
<value>
<tuple>
<string>
start_date
</string>
<string>
stop_date
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
property_movement_group_on_line
</string>
</value>
</item>
<item>
<key>
<string>
update_always
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_triggerPaymentTransactionOrderBuilder.py
deleted
100644 → 0
View file @
5128c902
context
.
getPortalObject
().
portal_orders
.
slapos_payment_transaction_builder
.
build
(
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_triggerPaymentTransactionOrderBuilder.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_triggerPaymentTransactionOrderBuilder
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_updatePayzenConfirmedPaymentTransaction.py
deleted
100644 → 0
View file @
5128c902
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Payment Transaction"
,
simulation_state
=
[
"confirmed"
],
causality_state
=
[
"draft"
],
payment_mode_uid
=
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
method_id
=
'PaymentTransaction_startPayzenPayment'
,
packet_size
=
1
,
# just one to minimise errors
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_updatePayzenConfirmedPaymentTransaction.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_updatePayzenConfirmedPaymentTransaction
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/OrderBuilder_generateUnrelatedInvoiceList.py
deleted
100644 → 0
View file @
5128c902
portal
=
context
.
getPortalObject
()
newTempSimulationMovement
=
portal
.
portal_trash
.
newContent
select_dict
=
{
'causality_payment_transaction_related_uid'
:
None
,
'causality_subscription_request_related_uid'
:
None
,
}
select_kw
=
kwargs
.
copy
()
select_kw
.
pop
(
'portal_type'
,
None
)
select_kw
.
pop
(
'delivery_relative_url_list'
,
None
)
select_kw
.
update
(
portal_type
=
'Sale Invoice Transaction'
,
simulation_state
=
'stopped'
,
default_payment_mode_uid
=
(
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
()),
limit
=
10
,
# do only some in one shot
select_dict
=
select_dict
,
left_join_list
=
select_dict
.
keys
(),
causality_payment_transaction_related_uid
=
None
,
causality_subscription_request_related_uid
=
None
)
default_source_uid
=
portal
.
restrictedTraverse
(
'account_module/receivable'
).
getUid
()
movement_list
=
[]
_id
=
1
for
invoice
in
portal
.
portal_catalog
(
**
select_kw
):
invoice
.
getObject
().
serialize
()
# in order to avoid selection on concurrent transactions
payment_tag
=
"sale_invoice_transaction_order_builder_%s"
%
invoice
.
getObject
().
getUid
()
if
context
.
REQUEST
.
get
(
payment_tag
,
None
)
is
not
None
or
\
context
.
portal_activities
.
countMessageWithTag
(
payment_tag
)
>
0
:
# Invoice was selected before the payment be indexed or it was already created on this transaction
# so skip the invoice for now.
continue
quantity
=
0.
for
movement
in
invoice
.
searchFolder
(
portal_type
=
'Sale Invoice Transaction Line'
,
default_source_uid
=
default_source_uid
):
quantity
+=
movement
.
getQuantity
()
temp_movement_kw
=
dict
(
portal_type
=
"Simulation Movement"
,
causality
=
invoice
.
getRelativeUrl
(),
source_section
=
invoice
.
getSourceSection
(),
destination_section
=
invoice
.
getDestinationSection
(),
resource
=
invoice
.
getResource
(),
price_currency
=
invoice
.
getResource
(),
start_date
=
invoice
.
getStartDate
(),
stop_date
=
invoice
.
getStopDate
(),
specialise
=
invoice
.
getSpecialise
(),
payment_mode
=
invoice
.
getPaymentMode
(),
source_payment
=
'%s/bank_account'
%
invoice
.
getSourceSection
(),
# the other place defnied: business process
)
temp_movement_rec
=
newTempSimulationMovement
(
temp_object
=
True
,
id
=
str
(
_id
),
quantity
=-
1
*
quantity
,
source
=
'account_module/receivable'
,
destination
=
'account_module/payable'
,
**
temp_movement_kw
)
_id
+=
1
temp_movement_bank
=
newTempSimulationMovement
(
temp_object
=
True
,
id
=
str
(
_id
),
quantity
=
1
*
quantity
,
source
=
'account_module/payment_to_encash'
,
destination
=
'account_module/payment_to_encash'
,
**
temp_movement_kw
)
_id
+=
1
movement_list
.
extend
([
temp_movement_rec
,
temp_movement_bank
])
return
movement_list
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/OrderBuilder_generateUnrelatedInvoiceList.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kwargs
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderBuilder_generateUnrelatedInvoiceList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_startPayzenPayment.py
deleted
100644 → 0
View file @
5128c902
from
DateTime
import
DateTime
state
=
context
.
getSimulationState
()
transaction_amount
=
int
(
round
((
context
.
PaymentTransaction_getTotalPayablePrice
()
*
-
100
),
2
))
if
(
state
!=
'confirmed'
)
or
(
context
.
getPaymentMode
()
!=
'payzen'
)
or
(
transaction_amount
==
0
):
if
(
transaction_amount
==
0
):
invoice
=
context
.
getCausalityValue
(
portal_types
=
"Sale Invoice Transaction"
)
if
invoice
is
not
None
and
round
(
invoice
.
getTotalPrice
(),
2
)
==
0
:
context
.
edit
(
payment_mode
=
"wire_transfer"
)
return
else
:
# Request manual payment
context
.
start
(
comment
=
'Requested manual payment'
)
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.py
View file @
21504241
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2022 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
TestSlapOSPayzenUpdateConfirmedPayment
(
SlapOSTestCaseMixinWithAbort
):
def
_simulatePaymentTransaction_startPayzenPayment
(
self
):
script_name
=
'PaymentTransaction_startPayzenPayment'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by PaymentTransaction_startPayzenPayment') """
)
self
.
commit
()
def
_dropPaymentTransaction_startPayzenPayment
(
self
):
script_name
=
'PaymentTransaction_startPayzenPayment'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
commit
()
def
test_alarm_confirmed_draft_payzen
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
tic
()
self
.
_simulatePaymentTransaction_startPayzenPayment
()
try
:
self
.
portal
.
portal_alarms
.
slapos_payzen_update_confirmed_payment
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropPaymentTransaction_startPayzenPayment
()
self
.
tic
()
self
.
assertEqual
(
'Visited by PaymentTransaction_startPayzenPayment'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_confirmed
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
self
.
tic
()
self
.
_simulatePaymentTransaction_startPayzenPayment
()
try
:
self
.
portal
.
portal_alarms
.
slapos_payzen_update_confirmed_payment
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropPaymentTransaction_startPayzenPayment
()
self
.
tic
()
self
.
assertNotEqual
(
'Visited by PaymentTransaction_startPayzenPayment'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_draft
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'solved'
)
self
.
tic
()
self
.
_simulatePaymentTransaction_startPayzenPayment
()
try
:
self
.
portal
.
portal_alarms
.
slapos_payzen_update_confirmed_payment
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropPaymentTransaction_startPayzenPayment
()
self
.
tic
()
self
.
assertNotEqual
(
'Visited by PaymentTransaction_startPayzenPayment'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_payzen
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
tic
()
self
.
_simulatePaymentTransaction_startPayzenPayment
()
try
:
self
.
portal
.
portal_alarms
.
slapos_payzen_update_confirmed_payment
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropPaymentTransaction_startPayzenPayment
()
self
.
tic
()
self
.
assertNotEqual
(
'Visited by PaymentTransaction_startPayzenPayment'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_simulatePaymentTransaction_getTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""return 1"""
)
self
.
commit
()
def
_simulatePaymentTransaction_getZeroTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""return 0"""
)
self
.
commit
()
def
_dropPaymentTransaction_getTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
commit
()
def
test_not_confirmed_payment
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
simulation_state
=
transaction
.
getSimulationState
()
modification_date
=
transaction
.
getModificationDate
()
self
.
_simulatePaymentTransaction_getTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startPayzenPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEqual
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEqual
(
transaction
.
getModificationDate
(),
modification_date
)
def
test_not_payzen_payment
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
simulation_state
=
transaction
.
getSimulationState
()
modification_date
=
transaction
.
getModificationDate
()
self
.
_simulatePaymentTransaction_getTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startPayzenPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEqual
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEqual
(
transaction
.
getModificationDate
(),
modification_date
)
def
test_zero_amount_payment
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
simulation_state
=
transaction
.
getSimulationState
()
modification_date
=
transaction
.
getModificationDate
()
self
.
_simulatePaymentTransaction_getZeroTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startPayzenPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEqual
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEqual
(
transaction
.
getModificationDate
(),
modification_date
)
def
test_expected_payment
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"payzen"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
_simulatePaymentTransaction_getTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startPayzenPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEqual
(
transaction
.
getSimulationState
(),
'started'
)
class
TestSlapOSPayzenUpdateStartedPayment
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSPayzenUpdateStartedPayment
(
SlapOSTestCaseMixinWithAbort
):
def
test_not_started_payment
(
self
):
def
test_not_started_payment
(
self
):
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
View file @
21504241
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPayzenAlarm
</string>
</value>
<value>
<string>
testSlapOSPayzenAlarm
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenEntityCreatePayment.py
0 → 100644
View file @
21504241
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2022 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
erp5.component.test.testSlapOSEntityCreatePayment
import
TestSlapOSEntityCreatePaymentMixin
class
TestSlapOSEntityCreatePayment
(
TestSlapOSEntityCreatePaymentMixin
):
payment_mode
=
"payzen"
test
=
TestSlapOSEntityCreatePaymentMixin
.
_test
test_twice
=
TestSlapOSEntityCreatePaymentMixin
.
_test_twice
test_twice_transaction
=
TestSlapOSEntityCreatePaymentMixin
.
_test_twice_transaction
test_twice_indexation
=
TestSlapOSEntityCreatePaymentMixin
.
_test_twice_indexation
test_cancelled_payment
=
TestSlapOSEntityCreatePaymentMixin
.
_test_cancelled_payment
test_two_invoices
=
TestSlapOSEntityCreatePaymentMixin
.
_test_two_invoices
test_two_lines
=
TestSlapOSEntityCreatePaymentMixin
.
_test_two_lines
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzen
Builder
.xml
→
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzen
EntityCreatePayment
.xml
View file @
21504241
...
@@ -7,14 +7,14 @@
...
@@ -7,14 +7,14 @@
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<value>
<string>
testSlapOSPayzenEntityCreatePayment
</string>
</value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
testSlapOSPayzenBuilder
</string>
</value>
<value>
<none/>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSPayzen
Builder
</string>
</value>
<value>
<string>
test.erp5.testSlapOSPayzen
EntityCreatePayment
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
portal_type
</string>
</key>
<key>
<string>
portal_type
</string>
</key>
...
@@ -55,28 +55,13 @@
...
@@ -55,28 +55,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +74,7 @@
...
@@ -89,7 +74,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +83,7 @@
...
@@ -98,7 +83,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenSkins.py
View file @
21504241
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2022 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
DateTime
import
DateTime
from
DateTime
import
DateTime
...
@@ -25,14 +45,6 @@ class TestSlapOSCurrency_getIntegrationMapping(SlapOSTestCaseMixinWithAbort):
...
@@ -25,14 +45,6 @@ class TestSlapOSCurrency_getIntegrationMapping(SlapOSTestCaseMixinWithAbort):
class
TestSlapOSAccountingTransaction_updateStartDate
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSAccountingTransaction_updateStartDate
(
SlapOSTestCaseMixinWithAbort
):
def
createPaymentTransaction
(
self
):
new_id
=
self
.
generateNewId
()
return
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
)
def
test_date_changed
(
self
):
def
test_date_changed
(
self
):
date
=
DateTime
(
"2001/01/01"
)
date
=
DateTime
(
"2001/01/01"
)
payment_transaction
=
self
.
createPaymentTransaction
()
payment_transaction
=
self
.
createPaymentTransaction
()
...
@@ -657,85 +669,6 @@ class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(SlapOSTestCaseMixinWithAb
...
@@ -657,85 +669,6 @@ class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(SlapOSTestCaseMixinWithAb
result
=
self
.
portal
.
Base_getPayzenServiceRelativeUrl
()
result
=
self
.
portal
.
Base_getPayzenServiceRelativeUrl
()
self
.
assertEqual
(
result
,
'portal_secure_payments/slapos_payzen_test'
)
self
.
assertEqual
(
result
,
'portal_secure_payments/slapos_payzen_test'
)
class
TestSlapOSPayzenAccountingTransaction_getPaymentState
(
SlapOSTestCaseMixinWithAbort
):
def
test_AccountingTransaction_getPaymentState_draft_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_deleted_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
delete
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_cancelled_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
cancel
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_planned_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
plan
()
self
.
assertEqual
(
"Ongoing"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_confirmed_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
setStartDate
(
DateTime
())
invoice
.
confirm
()
self
.
assertEqual
(
"Ongoing"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_started_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
start
()
self
.
assertEqual
(
"Ongoing"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_reversed_payment
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
self
.
tic
()
reversal
=
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
()
self
.
tic
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
self
.
assertEqual
(
0
,
invoice
.
getTotalPrice
()
+
reversal
.
getTotalPrice
())
def
test_AccountingTransaction_getPaymentState_free_payment
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
(
price
=
0
)
self
.
tic
()
self
.
assertEqual
(
"Free!"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_unpaid_payment
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
# If payment is not indexed or not started the state should be unpaid
self
.
assertEqual
(
"Unpaid"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_paynow_payment
(
self
):
person
=
self
.
makePerson
()
invoice
=
self
.
createPayzenSaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
"Pay Now"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_waiting_payment
(
self
):
person
=
self
.
makePerson
()
invoice
=
self
.
createPayzenSaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
()
payment
.
PaymentTransaction_generatePayzenId
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
"Waiting for payment confirmation"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_paid_payment
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
self
.
tic
()
for
line
in
invoice
.
getMovementList
(
self
.
portal
.
getPortalAccountingMovementTypeList
()):
node_value
=
line
.
getSourceValue
(
portal_type
=
'Account'
)
if
node_value
.
getAccountType
()
==
'asset/receivable'
:
line
.
setGroupingReference
(
"TEST%s"
%
self
.
new_id
)
self
.
assertEqual
(
"Paid"
,
invoice
.
AccountingTransaction_getPaymentState
())
class
TestSlapOSPayzenPaymentTransaction_redirectToManualPayzenPayment
(
class
TestSlapOSPayzenPaymentTransaction_redirectToManualPayzenPayment
(
SlapOSTestCaseMixinWithAbort
):
SlapOSTestCaseMixinWithAbort
):
...
@@ -780,11 +713,19 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -780,11 +713,19 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
def
test_PaymentTransaction_redirectToManualPayzenPayment_redirect
(
self
):
def
test_PaymentTransaction_redirectToManualPayzenPayment_redirect
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
invoice
=
self
.
create
Payzen
SaleInvoiceTransaction
(
invoice
=
self
.
create
Stopped
SaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
())
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
payment
.
setResourceValue
(
self
.
portal
.
currency_module
.
EUR
)
portal_type
=
"Payment Transaction"
,
payment_mode
=
'payzen'
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
resource_value
=
self
.
portal
.
currency_module
.
EUR
,
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
self
.
tic
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
self
.
_simulatePaymentTransaction_getVADSUrlDict
()
self
.
_simulatePaymentTransaction_getVADSUrlDict
()
...
@@ -810,15 +751,32 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -810,15 +751,32 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
"%s/return"
%
(
payment_transaction_url
)]:
"%s/return"
%
(
payment_transaction_url
)]:
self
.
assertTrue
(
item
in
text_content
,
self
.
assertTrue
(
item
in
text_content
,
"%s not in %s"
%
(
item
,
text_content
))
"%s not in %s"
%
(
item
,
text_content
))
self
.
tic
()
system_event_list
=
payment
.
getDestinationRelatedValueList
(
portal_type
=
"Payzen Event"
)
self
.
assertEqual
(
len
(
system_event_list
),
1
)
self
.
assertEqual
(
system_event_list
[
0
].
getDestinationSection
(),
invoice
.
getDestinationSection
())
self
.
assertEqual
(
len
(
system_event_list
[
0
].
contentValues
(
portal_type
=
"Payzen Event Message"
)),
1
)
def
test_PaymentTransaction_redirectToManualPayzenPayment_already_registered
(
self
):
def
test_PaymentTransaction_redirectToManualPayzenPayment_already_registered
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
invoice
=
self
.
create
Payzen
SaleInvoiceTransaction
(
invoice
=
self
.
create
Stopped
SaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
())
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
payment
.
setResourceValue
(
self
.
portal
.
currency_module
.
EUR
)
portal_type
=
"Payment Transaction"
,
payment_mode
=
'payzen'
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
resource_value
=
self
.
portal
.
currency_module
.
EUR
,
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
payment
.
PaymentTransaction_generatePayzenId
()
payment
.
PaymentTransaction_generatePayzenId
()
self
.
tic
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
...
@@ -831,164 +789,5 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -831,164 +789,5 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self
.
assertEqual
(
"%s/already_registered"
%
payment
.
getRelativeUrl
(),
self
.
assertEqual
(
"%s/already_registered"
%
payment
.
getRelativeUrl
(),
redirect
)
redirect
)
class
TestSlapOSPayzenSaleInvoiceTransaction_getSlapOSPaymentRelatedValue
(
system_event_list
=
payment
.
getDestinationRelatedValueList
(
portal_type
=
"Payzen Event"
)
SlapOSTestCaseMixinWithAbort
):
self
.
assertEqual
(
len
(
system_event_list
),
0
)
\ No newline at end of file
def
test_SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
()
self
.
assertNotEqual
(
None
,
payment
)
self
.
assertEqual
(
payment
.
getSimulationState
(),
"started"
)
self
.
assertEqual
(
payment
.
getCausalityValue
(),
invoice
)
self
.
assertEqual
(
payment
.
getPaymentModeUid
(),
self
.
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
())
payment
.
setStartDate
(
DateTime
())
payment
.
stop
()
payment
.
immediateReindexObject
()
payment
=
invoice
.
SaleInvoiceTransaction_getSlapOSPaymentRelatedValue
()
self
.
assertEqual
(
None
,
payment
)
class
TestSlapOSPayzenSaleInvoiceTransaction_createReversalPayzenTransaction
(
SlapOSTestCaseMixinWithAbort
):
def
test_createReversalPayzenTransaction_REQUEST_disallowed
(
self
):
self
.
assertRaises
(
Unauthorized
,
self
.
portal
.
SaleInvoiceTransaction_createReversalPayzenTransaction
,
REQUEST
=
{})
def
test_createReversalPayzenTransaction_bad_portal_type
(
self
):
self
.
assertRaises
(
AssertionError
,
self
.
portal
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_bad_payment_mode
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
invoice
.
edit
(
payment_mode
=
"cash"
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_bad_state
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'delivered'
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_zero_price
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
invoice
.
manage_delObjects
(
invoice
.
contentIds
())
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_wrong_trade_condition
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
invoice
.
edit
(
specialise
=
None
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_paid
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
line
=
invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)[
0
]
line
.
edit
(
grouping_reference
=
"azerty"
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_no_payment
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
# Do not reindex payment. portal_catalog will not find it.
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_no_payzen_payment
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
getCausalityRelatedValue
()
payment
.
edit
(
payment_mode
=
"cash"
)
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_no_payment_state
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
getCausalityRelatedValue
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'cancelled'
)
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_registered_payment
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
getCausalityRelatedValue
()
payment
.
PaymentTransaction_generatePayzenId
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalPayzenTransaction
)
def
test_createReversalPayzenTransaction_ok
(
self
):
invoice
=
self
.
createPayzenSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
getCausalityRelatedValue
()
reversale_invoice
=
invoice
.
\
SaleInvoiceTransaction_createReversalPayzenTransaction
()
self
.
assertEqual
(
invoice
.
getPaymentMode
(
""
),
""
)
self
.
assertEqual
(
payment
.
getPaymentMode
(
""
),
""
)
self
.
assertEqual
(
payment
.
getSimulationState
(),
"cancelled"
)
self
.
assertEqual
(
reversale_invoice
.
getTitle
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getDescription
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getCausality
(),
invoice
.
getRelativeUrl
())
self
.
assertEqual
(
reversale_invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
invoice_line_id
=
invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)[
0
].
getId
()
transaction_line_id
=
invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)[
0
].
getId
()
self
.
assertEqual
(
invoice
[
invoice_line_id
].
getQuantity
(),
-
reversale_invoice
[
invoice_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
invoice_line_id
].
getQuantity
(),
2
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getQuantity
(),
-
reversale_invoice
[
transaction_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
transaction_line_id
].
getQuantity
(),
3
)
self
.
assertEqual
(
len
(
invoice
.
getMovementList
()),
2
)
# Both invoice should have a grouping reference
self
.
assertNotEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
""
),
""
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
"1"
),
reversale_invoice
[
transaction_line_id
].
getGroupingReference
(
"2"
))
# All references should be regenerated
self
.
assertNotEqual
(
invoice
.
getReference
(
""
),
reversale_invoice
.
getReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getSourceReference
(
""
),
reversale_invoice
.
getSourceReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getDestinationReference
(
""
),
reversale_invoice
.
getDestinationReference
(
""
))
# Another trade condition
self
.
assertEqual
(
reversale_invoice
.
getSpecialise
(),
"sale_trade_condition_module/slapos_manual_accounting_trade_condition"
)
self
.
tic
()
master/bt5/slapos_payzen/bt/template_path_list
View file @
21504241
accounting_module/template_sale_invoice_transaction
accounting_module/template_sale_invoice_transaction
accounting_module/template_sale_invoice_transaction/**
accounting_module/template_sale_invoice_transaction/**
portal_alarms/slapos_payzen_update_confirmed_payment
portal_alarms/slapos_payzen_update_started_payment
portal_alarms/slapos_payzen_update_started_payment
portal_alarms/slapos_trigger_payment_transaction_order_builder
portal_integrations/slapos_payzen_test_integration
portal_integrations/slapos_payzen_test_integration
portal_integrations/slapos_payzen_test_integration/Causality
portal_integrations/slapos_payzen_test_integration/Causality
portal_integrations/slapos_payzen_test_integration/Resource
portal_integrations/slapos_payzen_test_integration/Resource
portal_integrations/slapos_payzen_test_integration/Resource/**
portal_integrations/slapos_payzen_test_integration/Resource/**
portal_integrations/slapos_payzen_test_integration/SourceProject
portal_integrations/slapos_payzen_test_integration/SourceProject
portal_orders/slapos_payment_transaction_builder
portal_orders/slapos_payment_transaction_builder/**
portal_secure_payments/slapos_payzen_test
portal_secure_payments/slapos_payzen_test
portal_secure_payments/slapos_payzen_test/**
portal_secure_payments/slapos_payzen_test/**
sale_trade_condition_module/payzen_sale_trade_condition
sale_trade_condition_module/payzen_sale_trade_condition
...
...
master/bt5/slapos_payzen/bt/template_test_id_list
View file @
21504241
test.erp5.testSlapOSPayzen
Builder
test.erp5.testSlapOSPayzen
EntityCreatePayment
test.erp5.testSlapOSPayzenSkins
test.erp5.testSlapOSPayzenSkins
test.erp5.testSlapOSPayzenAlarm
test.erp5.testSlapOSPayzenAlarm
test.erp5.testSlapOSPayzenWorkflow
test.erp5.testSlapOSPayzenWorkflow
\ No newline at end of file
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_notifyPaymentIsReady.py
View file @
21504241
...
@@ -25,7 +25,7 @@ notification_mapping_dict = {
...
@@ -25,7 +25,7 @@ notification_mapping_dict = {
'name'
:
recipient
.
getTitle
(),
'name'
:
recipient
.
getTitle
(),
'subscription_title'
:
context
.
getTitle
(),
'subscription_title'
:
context
.
getTitle
(),
# Possible more actions goes here
# Possible more actions goes here
'payment_relative_relative_url'
:
payment
.
getRelativeUrl
()}
'payment_relative_relative_url'
:
invoice
.
getRelativeUrl
()}
# Preserve HTML else convert to text
# Preserve HTML else convert to text
if
notification_message
.
getContentType
()
==
"text/html"
:
if
notification_message
.
getContentType
()
==
"text/html"
:
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_notifyPaymentIsReady.xml
View file @
21504241
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
payment
</string>
</value>
<value>
<string>
invoice
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_processOrdered.py
View file @
21504241
...
@@ -32,19 +32,17 @@ if instance_tree is not None:
...
@@ -32,19 +32,17 @@ if instance_tree is not None:
context
.
start
(
comment
=
comment
)
context
.
start
(
comment
=
comment
)
context
.
stop
(
comment
=
comment
)
context
.
stop
(
comment
=
comment
)
first_period_payment
=
context
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
invoice
=
context
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
if
not
first_period_payment
:
if
not
invoice
:
#
Payment isn't available for the user
#
Invoice isn't available for the user to Pay
return
"Skipped (Payment isn't ready)"
return
"Skipped (Payment isn't ready)"
if
not
context
.
SubscriptionRequest_verifyInstanceIsAllocated
():
if
not
context
.
SubscriptionRequest_verifyInstanceIsAllocated
():
# Only continue if instance is ready
# Only continue if instance is ready
return
"Skipped (Instance isn't ready)"
return
"Skipped (Instance isn't ready)"
invoice
=
first_period_payment
.
getCausalityValue
()
# Link to be sent is the invoice one
# Link to be sent is the invoice one
if
context
.
SubscriptionRequest_notifyPaymentIsReady
(
payment
=
invoice
):
if
context
.
SubscriptionRequest_notifyPaymentIsReady
(
invoice
):
context
.
confirm
(
comment
=
"Payment is ready for the user"
)
context
.
confirm
(
comment
=
"Payment is ready for the user"
)
return
"Payment is ready for the user"
return
"Payment is ready for the user"
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_testPaymentBalance.py
View file @
21504241
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
payment
=
context
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
invoice
=
context
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
if
payment
is
not
None
:
if
invoice
is
not
None
:
if
payment
.
getSimulationState
()
in
[
'stopped'
,
'delivered'
]
:
if
invoice
.
SaleInvoiceTransaction_isLettered
()
:
#
Payment Transaction
is payed
#
Invoice
is payed
return
True
return
True
person
=
context
.
getDestinationSectionValue
()
person
=
context
.
getDestinationSectionValue
()
...
@@ -18,5 +18,5 @@ if payment is not None:
...
@@ -18,5 +18,5 @@ if payment is not None:
not
(
person
.
Entity_statSlapOSOutstandingAmount
()
>
0
)):
not
(
person
.
Entity_statSlapOSOutstandingAmount
()
>
0
)):
return
True
return
True
#
Payment Transaction
isn't payed
#
Invoice
isn't payed
return
False
return
False
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_verifyPaymentBalanceIsReady.py
View file @
21504241
...
@@ -25,12 +25,10 @@ for packing_list in portal.portal_catalog(
...
@@ -25,12 +25,10 @@ for packing_list in portal.portal_catalog(
):
):
for
invoice
in
packing_list
.
getCausalityRelatedValueList
(
for
invoice
in
packing_list
.
getCausalityRelatedValueList
(
portal_type
=
"Sale Invoice Transaction"
):
portal_type
=
"Sale Invoice Transaction"
):
for
payment
in
invoice
.
getCausalityRelatedValueList
(
portal_type
=
[
"Payment Transaction"
,
"Sale Invoice Transaction"
]):
# XXX How to check if the invoice is ready to be payed
if
payment
.
getSimulationState
()
in
[
"stopped"
,
"delivered"
,
"started"
]:
if
invoice
.
getSimulationState
()
in
[
'stopped'
,
'delivered'
]
and
\
# Invoice is already paied so we just move foward
not
invoice
.
checkConsistency
():
if
not
payment
.
checkConsistency
():
return
invoice
return
payment
# Payment isn't ready
# Invoice inst ready to be payed
return
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionCancellationScenario.py
View file @
21504241
...
@@ -170,20 +170,6 @@ class TestSlapOSSubscriptionCancellationScenario(TestSlapOSSubscriptionScenarioM
...
@@ -170,20 +170,6 @@ class TestSlapOSSubscriptionCancellationScenario(TestSlapOSSubscriptionScenarioM
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getCausalityState
(),
"solved"
)
self
.
assertEqual
(
invoice
.
getCausalityState
(),
"solved"
)
builder
=
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
for
_
in
range
(
500
):
# build the aggregated payment
self
.
stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm
()
self
.
tic
()
# If there is something unbuild recall alarm, this is mostly for
# live tests with date on the development sites.
if
not
len
(
builder
.
OrderBuilder_generateUnrelatedInvoiceList
()):
break
# start the payzen payment
self
.
stepCallSlaposPayzenUpdateConfirmedPaymentAlarm
()
self
.
tic
()
self
.
invokeBasicSimulationAlarmList
()
self
.
invokeBasicSimulationAlarmList
()
# Call alarm to check payment and invoice and move foward to planned.
# Call alarm to check payment and invoice and move foward to planned.
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionCancellationScenario.xml
View file @
21504241
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSSubscriptionCancellationScenario
</string>
</value>
<value>
<string>
testSlapOSSubscriptionCancellationScenario
</string>
</value>
...
@@ -61,28 +55,13 @@
...
@@ -61,28 +55,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -95,7 +74,7 @@
...
@@ -95,7 +74,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -104,7 +83,7 @@
...
@@ -104,7 +83,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
21504241
...
@@ -338,9 +338,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -338,9 +338,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
notification_message
=
"subscription_request-payment-is-ready"
):
notification_message
=
"subscription_request-payment-is-ready"
):
self
.
checkSubscriptionRequest
(
subscription_request
,
email
,
self
.
checkSubscriptionRequest
(
subscription_request
,
email
,
subscription_condition
)
subscription_condition
)
payment
=
subscription_request
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
invoice
=
subscription_request
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
self
.
assertNotEqual
(
payment
,
None
)
self
.
assertNotEqual
(
invoice
,
None
)
self
.
assertEqual
(
payment
.
getSimulationState
(),
'start
ed'
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
'stopp
ed'
)
# Assert instance is allocated and without error
# Assert instance is allocated and without error
self
.
assertEqual
(
True
,
self
.
assertEqual
(
True
,
...
@@ -375,17 +375,13 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -375,17 +375,13 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
person
=
subscription_request
.
getDestinationSectionValue
()
person
=
subscription_request
.
getDestinationSectionValue
()
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
payment
=
self
.
portal
.
portal_catalog
.
getResultValue
(
invoice_list
=
person
.
Entity_getOutstandingAmountList
()
portal_type
=
"Payment Transaction"
,
self
.
assertEqual
(
len
(
invoice_list
),
1
)
simulation_state
=
"started"
)
sale_transaction_invoice
=
invoice_list
[
0
].
getObject
()
sale_transaction_invoice
=
payment
.
getCausalityValue
(
portal_type
=
"Sale Invoice Transaction"
)
self
.
logout
()
self
.
logout
()
self
.
login
()
self
.
login
()
sale_transaction_invoice
.
SaleInvoiceTransaction_createReversal
PayzenTransaction
(
)
sale_transaction_invoice
.
SaleInvoiceTransaction_createReversal
SaleInvoiceTransaction
(
batch_mode
=
1
)
def
checkSubscriptionRequestPayment
(
self
,
subscription_request
,
authAmount
):
def
checkSubscriptionRequestPayment
(
self
,
subscription_request
,
authAmount
):
...
@@ -447,8 +443,11 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -447,8 +443,11 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
quantity
=
subscription_request
.
getQuantity
()
quantity
=
subscription_request
.
getQuantity
()
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
self
.
usePayzenManually
(
self
.
web_site
,
person
.
getUserId
(),
is_email_expected
=
False
)
self
.
usePaymentManually
(
self
.
web_site
,
person
.
getUserId
(),
is_email_expected
=
False
,
subscription_request
=
subscription_request
)
self
.
logout
()
self
.
logout
()
self
.
login
()
self
.
login
()
...
@@ -485,7 +484,10 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -485,7 +484,10 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
quantity
=
subscription_request
.
getQuantity
()
quantity
=
subscription_request
.
getQuantity
()
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
self
.
usePayzenManually
(
self
.
web_site
,
person
.
getUserId
())
self
.
usePaymentManually
(
self
.
web_site
,
person
.
getUserId
(),
subscription_request
=
subscription_request
)
self
.
logout
()
self
.
logout
()
self
.
login
()
self
.
login
()
...
@@ -524,7 +526,11 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -524,7 +526,11 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self
.
portal
.
portal_secure_payments
.
slapos_wechat_test
.
setWechatMode
(
"UNITTEST"
)
self
.
portal
.
portal_secure_payments
.
slapos_wechat_test
.
setWechatMode
(
"UNITTEST"
)
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
self
.
useWechatManually
(
self
.
web_site
,
person
.
getUserId
(),
is_email_expected
=
False
)
self
.
usePaymentManually
(
self
.
web_site
,
person
.
getUserId
(),
is_email_expected
=
False
,
subscription_request
=
subscription_request
)
self
.
logout
()
self
.
logout
()
self
.
login
()
self
.
login
()
...
@@ -556,7 +562,10 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -556,7 +562,10 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self
.
portal
.
portal_secure_payments
.
slapos_wechat_test
.
setWechatMode
(
"UNITTEST"
)
self
.
portal
.
portal_secure_payments
.
slapos_wechat_test
.
setWechatMode
(
"UNITTEST"
)
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
self
.
useWechatManually
(
self
.
web_site
,
person
.
getUserId
())
self
.
usePaymentManually
(
self
.
web_site
,
person
.
getUserId
(),
subscription_request
=
subscription_request
)
self
.
logout
()
self
.
logout
()
self
.
login
()
self
.
login
()
...
@@ -882,23 +891,6 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -882,23 +891,6 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
self
.
tic
()
builder
=
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
for
_
in
range
(
500
):
# build the aggregated payment
self
.
stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm
()
self
.
tic
()
# If there is something unbuild recall alarm.
if
not
len
(
builder
.
OrderBuilder_generateUnrelatedInvoiceList
()):
break
# start the payzen payment
self
.
stepCallSlaposPayzenUpdateConfirmedPaymentAlarm
()
self
.
tic
()
# stabilise the payment deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# trigger the CRM interaction
# trigger the CRM interaction
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
tic
()
self
.
tic
()
...
@@ -989,9 +981,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -989,9 +981,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
"TestSubscriptionSkins Notification Message %s %s"
%
(
"TestSubscriptionSkins Notification Message %s %s"
%
(
subscription_request
.
getLanguage
(),
notification_message
),
subscription_request
.
getLanguage
(),
notification_message
),
mail_message
.
getTitle
())
mail_message
.
getTitle
())
payment
=
subscription_request
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
invoice
=
subscription_request
.
SubscriptionRequest_verifyPaymentBalanceIsReady
()
self
.
assertEqual
(
payment
.
getSimulationState
(),
'started'
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
'stopped'
)
invoice
=
payment
.
getCausalityValue
()
self
.
assertTrue
(
invoice
.
getRelativeUrl
()
in
\
self
.
assertTrue
(
invoice
.
getRelativeUrl
()
in
\
mail_message
.
getTextContent
())
mail_message
.
getTextContent
())
self
.
assertTrue
(
subscription_request
.
getDestinationSectionTitle
()
in
\
self
.
assertTrue
(
subscription_request
.
getDestinationSectionTitle
()
in
\
...
@@ -1407,23 +1398,6 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -1407,23 +1398,6 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
self
.
tic
()
builder
=
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
for
_
in
range
(
500
):
# build the aggregated payment
self
.
stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm
()
self
.
tic
()
# If there is something unbuild recall alarm.
if
not
len
(
builder
.
OrderBuilder_generateUnrelatedInvoiceList
()):
break
# start the payzen payment
self
.
stepCallSlaposPayzenUpdateConfirmedPaymentAlarm
()
self
.
tic
()
# stabilise the payment deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# trigger the CRM interaction
# trigger the CRM interaction
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
tic
()
self
.
tic
()
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.xml
View file @
21504241
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSSubscriptionScenario
</string>
</value>
<value>
<string>
testSlapOSSubscriptionScenario
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_wechat/PathTemplateItem/portal_alarms/slapos_wechat_update_confirmed_payment.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Alarm"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_updateWechatConfirmedPaymentTransaction
</string>
</value>
</item>
<item>
<key>
<string>
automatic_solve
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_wechat_update_confirmed_payment
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<value>
<int>
5
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_month_day
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_start_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1288051200.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
periodicity_week
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
</item>
<item>
<key>
<string>
sense_method_id
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Handles confirmed Payment Transactions with Wechat interface
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/Alarm_updateWechatConfirmedPaymentTransaction.py
deleted
100644 → 0
View file @
5128c902
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Payment Transaction"
,
simulation_state
=
[
"confirmed"
],
causality_state
=
[
"draft"
],
payment_mode_uid
=
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
(),
method_id
=
'PaymentTransaction_startWechatPayment'
,
packet_size
=
1
,
# just one to minimise errors
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/Alarm_updateWechatConfirmedPaymentTransaction.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_updateWechatConfirmedPaymentTransaction
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/PaymentTransaction_startWechatPayment.py
deleted
100644 → 0
View file @
5128c902
from
DateTime
import
DateTime
state
=
context
.
getSimulationState
()
transaction_amount
=
int
(
round
((
context
.
PaymentTransaction_getTotalPayablePrice
()
*
-
100
),
2
))
if
(
state
!=
'confirmed'
)
or
(
context
.
getPaymentMode
()
!=
'wechat'
)
or
(
transaction_amount
==
0
):
if
(
transaction_amount
==
0
):
invoice
=
context
.
getCausalityValue
(
portal_types
=
"Sale Invoice Transaction"
)
if
invoice
is
not
None
and
round
(
invoice
.
getTotalPrice
(),
2
)
==
0
:
context
.
edit
(
payment_mode
=
"wire_transfer"
)
return
else
:
# Request manual payment
context
.
start
(
comment
=
'Requested manual payment'
)
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/SaleInvoiceTransaction_createReversalWechatTransaction.py
deleted
100644 → 0
View file @
5128c902
""" Create a reversal transaction from current wechat transaction. """
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
# Check that we are in state that we are waiting for user manual payment
assert
context
.
getPortalType
()
==
'Sale Invoice Transaction'
assert
context
.
getPaymentMode
()
==
'wechat'
assert
context
.
getSimulationState
()
==
'stopped'
assert
context
.
getTotalPrice
()
!=
0
assert
context
.
getSpecialise
()
==
"sale_trade_condition_module/slapos_aggregated_trade_condition"
paid
=
True
for
line
in
context
.
getMovementList
(
portal
.
getPortalAccountingMovementTypeList
()):
node_value
=
line
.
getSourceValue
(
portal_type
=
'Account'
)
if
node_value
.
getAccountType
()
==
'asset/receivable'
:
if
not
line
.
hasGroupingReference
():
paid
=
False
break
assert
not
paid
payment
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Payment Transaction"
,
simulation_state
=
"started"
,
default_causality_uid
=
context
.
getUid
(),
default_payment_mode_uid
=
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
(),
)
assert
payment
is
not
None
assert
payment
.
getSimulationState
()
==
'started'
assert
payment
.
getPaymentMode
()
==
'wechat'
assert
payment
.
PaymentTransaction_getWechatId
()[
1
]
is
None
# Should be safe now to fix everything
context
.
SaleInvoiceTransaction_resetPaymentMode
()
payment
.
edit
(
payment_mode
=
None
)
reversal_transaction
=
context
.
Base_createCloneDocument
(
batch_mode
=
1
)
payment
.
cancel
(
comment
=
"Reversal sale invoice transaction created %s"
%
reversal_transaction
.
getRelativeUrl
())
reversal_transaction
.
edit
(
title
=
"Reversal Transaction for %s"
%
context
.
getTitle
(),
causality_value
=
context
,
description
=
"Reversal Transaction for %s"
%
context
.
getTitle
(),
specialise_value
=
portal
.
sale_trade_condition_module
.
slapos_manual_accounting_trade_condition
,
)
for
line
in
reversal_transaction
.
getMovementList
():
line
.
edit
(
quantity
=
(
-
line
.
getQuantity
()))
reversal_transaction
.
confirm
(
comment
=
"Automatic because of reversal creation"
)
reversal_transaction
.
stop
(
comment
=
"Automatic because of reversal creation"
)
return
reversal_transaction
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/SaleInvoiceTransaction_getWechatPaymentRelatedValue.py
deleted
100644 → 0
View file @
5128c902
portal
=
context
.
getPortalObject
()
return
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Payment Transaction"
,
simulation_state
=
"started"
,
default_causality_uid
=
context
.
getUid
(),
default_payment_mode_uid
=
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
(),
)
master/bt5/slapos_wechat/SkinTemplateItem/portal_skins/slapos_wechat/SaleInvoiceTransaction_getWechatPaymentRelatedValue.xml
deleted
100644 → 0
View file @
5128c902
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SaleInvoiceTransaction_getWechatPaymentRelatedValue
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatAlarm.py
View file @
21504241
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2022 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
TestSlapOSWechatUpdateConfirmedPayment
(
SlapOSTestCaseMixinWithAbort
):
def
_simulatePaymentTransaction_startWechatPayment
(
self
):
script_name
=
'PaymentTransaction_startWechatPayment'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by PaymentTransaction_startWechatPayment') """
)
self
.
commit
()
def
_dropPaymentTransaction_startWechatPayment
(
self
):
script_name
=
'PaymentTransaction_startWechatPayment'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
commit
()
def
test_alarm_confirmed_draft_wechat
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"wechat"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
tic
()
self
.
_simulatePaymentTransaction_startWechatPayment
()
try
:
self
.
portal
.
portal_alarms
.
slapos_wechat_update_confirmed_payment
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropPaymentTransaction_startWechatPayment
()
self
.
tic
()
self
.
assertEqual
(
'Visited by PaymentTransaction_startWechatPayment'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_confirmed
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"wechat"
,
)
self
.
tic
()
self
.
_simulatePaymentTransaction_startWechatPayment
()
try
:
self
.
portal
.
portal_alarms
.
slapos_wechat_update_confirmed_payment
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropPaymentTransaction_startWechatPayment
()
self
.
tic
()
self
.
assertNotEqual
(
'Visited by PaymentTransaction_startWechatPayment'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_draft
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"wechat"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'solved'
)
self
.
tic
()
self
.
_simulatePaymentTransaction_startWechatPayment
()
try
:
self
.
portal
.
portal_alarms
.
slapos_wechat_update_confirmed_payment
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropPaymentTransaction_startWechatPayment
()
self
.
tic
()
self
.
assertNotEqual
(
'Visited by PaymentTransaction_startWechatPayment'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_wechat
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
tic
()
self
.
_simulatePaymentTransaction_startWechatPayment
()
try
:
self
.
portal
.
portal_alarms
.
slapos_wechat_update_confirmed_payment
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropPaymentTransaction_startWechatPayment
()
self
.
tic
()
self
.
assertNotEqual
(
'Visited by PaymentTransaction_startWechatPayment'
,
transaction
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_simulatePaymentTransaction_getTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""return 1"""
)
self
.
commit
()
def
_simulatePaymentTransaction_getZeroTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""return 0"""
)
self
.
commit
()
def
_dropPaymentTransaction_getTotalPayablePrice
(
self
):
script_name
=
'PaymentTransaction_getTotalPayablePrice'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
commit
()
def
test_not_confirmed_payment
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"wechat"
,
)
simulation_state
=
transaction
.
getSimulationState
()
modification_date
=
transaction
.
getModificationDate
()
self
.
_simulatePaymentTransaction_getTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startWechatPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEqual
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEqual
(
transaction
.
getModificationDate
(),
modification_date
)
def
test_not_wechat_payment
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
simulation_state
=
transaction
.
getSimulationState
()
modification_date
=
transaction
.
getModificationDate
()
self
.
_simulatePaymentTransaction_getTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startWechatPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEqual
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEqual
(
transaction
.
getModificationDate
(),
modification_date
)
def
test_zero_amount_payment
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"wechat"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
simulation_state
=
transaction
.
getSimulationState
()
modification_date
=
transaction
.
getModificationDate
()
self
.
_simulatePaymentTransaction_getZeroTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startWechatPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEqual
(
transaction
.
getSimulationState
(),
simulation_state
)
self
.
assertEqual
(
transaction
.
getModificationDate
(),
modification_date
)
def
test_expected_payment
(
self
):
new_id
=
self
.
generateNewId
()
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Payment Transaction'
,
title
=
"Transaction %s"
%
new_id
,
reference
=
"TESTTRANS-%s"
%
new_id
,
payment_mode
=
"wechat"
,
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
transaction
,
'confirmed'
)
self
.
_simulatePaymentTransaction_getTotalPayablePrice
()
try
:
transaction
.
PaymentTransaction_startWechatPayment
()
finally
:
self
.
_dropPaymentTransaction_getTotalPayablePrice
()
self
.
assertEqual
(
transaction
.
getSimulationState
(),
'started'
)
class
TestSlapOSWechatUpdateStartedPayment
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSWechatUpdateStartedPayment
(
SlapOSTestCaseMixinWithAbort
):
def
test_not_started_payment
(
self
):
def
test_not_started_payment
(
self
):
...
...
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatAlarm.xml
View file @
21504241
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSWechatAlarm
</string>
</value>
<value>
<string>
testSlapOSWechatAlarm
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatBuilder.py
deleted
100644 → 0
View file @
5128c902
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
##############################################################################
from
erp5.component.test.testSlapOSPayzenBuilder
import
TestSlapOSPaymentTransactionOrderBuilderMixin
class
TestSlapOSWechatPaymentTransactionOrderBuilder
(
TestSlapOSPaymentTransactionOrderBuilderMixin
):
payment_mode
=
"wechat"
test
=
TestSlapOSPaymentTransactionOrderBuilderMixin
.
_test
test_twice
=
TestSlapOSPaymentTransactionOrderBuilderMixin
.
_test_twice
test_twice_transaction
=
TestSlapOSPaymentTransactionOrderBuilderMixin
.
_test_twice_transaction
test_twice_indexation
=
TestSlapOSPaymentTransactionOrderBuilderMixin
.
_test_twice_indexation
test_cancelled_payment
=
TestSlapOSPaymentTransactionOrderBuilderMixin
.
_test_cancelled_payment
test_two_invoices
=
TestSlapOSPaymentTransactionOrderBuilderMixin
.
_test_two_invoices
test_two_lines
=
TestSlapOSPaymentTransactionOrderBuilderMixin
.
_test_two_lines
\ No newline at end of file
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatEntityCreatePayment.py
0 → 100644
View file @
21504241
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2022 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
erp5.component.test.testSlapOSEntityCreatePayment
import
TestSlapOSEntityCreatePaymentMixin
class
TestSlapOSWechatEntityCreatePayment
(
TestSlapOSEntityCreatePaymentMixin
):
payment_mode
=
"wechat"
test
=
TestSlapOSEntityCreatePaymentMixin
.
_test
test_twice
=
TestSlapOSEntityCreatePaymentMixin
.
_test_twice
test_twice_transaction
=
TestSlapOSEntityCreatePaymentMixin
.
_test_twice_transaction
test_twice_indexation
=
TestSlapOSEntityCreatePaymentMixin
.
_test_twice_indexation
test_cancelled_payment
=
TestSlapOSEntityCreatePaymentMixin
.
_test_cancelled_payment
test_two_invoices
=
TestSlapOSEntityCreatePaymentMixin
.
_test_two_invoices
test_two_lines
=
TestSlapOSEntityCreatePaymentMixin
.
_test_two_lines
master/bt5/slapos_
payzen/PathTemplateItem/portal_orders/slapos_payment_transaction_builder
.xml
→
master/bt5/slapos_
wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatEntityCreatePayment
.xml
View file @
21504241
...
@@ -2,120 +2,105 @@
...
@@ -2,120 +2,105 @@
<ZopeData>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<pickle>
<global
name=
"
Order Builder
"
module=
"erp5.portal_type"
/>
<global
name=
"
Test Component
"
module=
"erp5.portal_type"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
_count
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<value>
<string>
testSlapOSWechatEntityCreatePayment
</string>
</value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<key>
<string>
description
</string>
</key>
<value>
<value>
<
persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent
>
<
none/
>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_tree
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<value>
<string>
test.erp5.testSlapOSWechatEntityCreatePayment
</string>
</value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
categories
</string>
</key>
<key>
<string>
portal_type
</string>
</key>
<value>
<value>
<string>
Test Component
</string>
</value>
<tuple>
<string>
destination/organisation_module/slapos
</string>
<string>
destination_section/organisation_module/slapos
</string>
</tuple>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
sid
</string>
</key>
<value>
<value>
<none/>
<none/>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
delivery_after_generation_script_id
</string>
</key>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<string>
PaymentTransaction_postOrderBuild
</string>
</value>
</item>
<item>
<key>
<string>
delivery_cell_portal_type
</string>
</key>
<value>
<string>
Delivery Cell
</string>
</value>
</item>
<item>
<key>
<string>
delivery_cell_separate_order
</string>
</key>
<value>
<value>
<tuple/>
<tuple/>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
delivery_line_portal_type
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<string>
Accounting Transaction Line
</string>
</value>
</item>
<item>
<key>
<string>
delivery_module
</string>
</key>
<value>
<string>
accounting_module
</string>
</value>
</item>
<item>
<key>
<string>
delivery_portal_type
</string>
</key>
<value>
<string>
Payment Transaction
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<value>
<
non
e/>
<
tupl
e/>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
version
</string>
</key>
<value>
<string>
slapos_payment_transaction_builder
</string>
</value>
<value>
<string>
erp5
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
language
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<
none/
>
<
persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent
>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Order Builder
</string>
</value>
</item>
<item>
<key>
<string>
simulation_select_method_id
</string>
</key>
<value>
<string>
OrderBuilder_generateUnrelatedInvoiceList
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Payment Builder
</string>
</value>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<none/>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"
OOBTree"
module=
"BTrees.OOBTree
"
/>
<global
name=
"
WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow
"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<none/>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</pickle>
</record>
</record>
</ZopeData>
</ZopeData>
master/bt5/slapos_wechat/TestTemplateItem/portal_components/test.erp5.testSlapOSWechatSkins.py
View file @
21504241
...
@@ -534,85 +534,6 @@ class TestSlapOSWechatBase_getWechatServiceRelativeUrl(SlapOSTestCaseMixinWithAb
...
@@ -534,85 +534,6 @@ class TestSlapOSWechatBase_getWechatServiceRelativeUrl(SlapOSTestCaseMixinWithAb
result
=
self
.
portal
.
Base_getWechatServiceRelativeUrl
()
result
=
self
.
portal
.
Base_getWechatServiceRelativeUrl
()
self
.
assertEqual
(
result
,
'portal_secure_payments/slapos_wechat_test'
)
self
.
assertEqual
(
result
,
'portal_secure_payments/slapos_wechat_test'
)
class
TestSlapOSWechatAccountingTransaction_getPaymentState
(
SlapOSTestCaseMixinWithAbort
):
def
test_AccountingTransaction_getPaymentState_draft_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_deleted_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
delete
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_cancelled_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
cancel
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_planned_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
plan
()
self
.
assertEqual
(
"Ongoing"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_confirmed_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
setStartDate
(
DateTime
())
invoice
.
confirm
()
self
.
assertEqual
(
"Ongoing"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_started_payment
(
self
):
invoice
=
self
.
createSaleInvoiceTransaction
()
invoice
.
start
()
self
.
assertEqual
(
"Ongoing"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_reversed_payment
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
self
.
tic
()
reversal
=
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
()
self
.
tic
()
self
.
assertEqual
(
"Cancelled"
,
invoice
.
AccountingTransaction_getPaymentState
())
self
.
assertEqual
(
0
,
invoice
.
getTotalPrice
()
+
reversal
.
getTotalPrice
())
def
test_AccountingTransaction_getPaymentState_free_payment
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
(
price
=
0
)
self
.
tic
()
self
.
assertEqual
(
"Free!"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_unpaid_payment
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
# If payment is not indexed or not started the state should be unpaid
self
.
assertEqual
(
"Unpaid"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_paynow_payment
(
self
):
person
=
self
.
makePerson
()
invoice
=
self
.
createWechatSaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
"Pay Now"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_waiting_payment
(
self
):
person
=
self
.
makePerson
()
invoice
=
self
.
createWechatSaleInvoiceTransaction
(
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getWechatPaymentRelatedValue
()
payment
.
PaymentTransaction_generateWechatId
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
"Waiting for payment confirmation"
,
invoice
.
AccountingTransaction_getPaymentState
())
def
test_AccountingTransaction_getPaymentState_paid_payment
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
self
.
tic
()
for
line
in
invoice
.
getMovementList
(
self
.
portal
.
getPortalAccountingMovementTypeList
()):
node_value
=
line
.
getSourceValue
(
portal_type
=
'Account'
)
if
node_value
.
getAccountType
()
==
'asset/receivable'
:
line
.
setGroupingReference
(
"TEST%s"
%
self
.
new_id
)
self
.
assertEqual
(
"Paid"
,
invoice
.
AccountingTransaction_getPaymentState
())
class
TestSlapOSWechatPaymentTransaction_redirectToManualWechatPayment
(
class
TestSlapOSWechatPaymentTransaction_redirectToManualWechatPayment
(
SlapOSTestCaseMixinWithAbort
):
SlapOSTestCaseMixinWithAbort
):
...
@@ -657,11 +578,19 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -657,11 +578,19 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
def
test_PaymentTransaction_redirectToManualWechatPayment_redirect
(
self
):
def
test_PaymentTransaction_redirectToManualWechatPayment_redirect
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
invoice
=
self
.
createWechatSaleInvoiceTransaction
(
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
payment_mode
=
"wechat"
,
destination_section
=
person
.
getRelativeUrl
())
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getWechatPaymentRelatedValue
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
payment
.
setResourceValue
(
self
.
portal
.
currency_module
.
EUR
)
portal_type
=
"Payment Transaction"
,
payment_mode
=
'wechat'
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
resource_value
=
self
.
portal
.
currency_module
.
CNY
,
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
payment_transaction_id
=
payment
.
getId
()
payment_transaction_id
=
payment
.
getId
()
self
.
tic
()
self
.
tic
()
...
@@ -693,11 +622,19 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -693,11 +622,19 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
def
test_PaymentTransaction_redirectToManualWechatPayment_redirect_with_website
(
self
):
def
test_PaymentTransaction_redirectToManualWechatPayment_redirect_with_website
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
invoice
=
self
.
createWechatSaleInvoiceTransaction
(
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
payment_mode
=
"wechat"
,
destination_section
=
person
.
getRelativeUrl
())
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getWechatPaymentRelatedValue
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
payment
.
setResourceValue
(
self
.
portal
.
currency_module
.
EUR
)
portal_type
=
"Payment Transaction"
,
payment_mode
=
'wechat'
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
resource_value
=
self
.
portal
.
currency_module
.
CNY
,
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
payment_transaction_id
=
payment
.
getId
()
payment_transaction_id
=
payment
.
getId
()
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
)
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
)
...
@@ -725,11 +662,20 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -725,11 +662,20 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
def
test_PaymentTransaction_redirectToManualWechatPayment_already_registered
(
self
):
def
test_PaymentTransaction_redirectToManualWechatPayment_already_registered
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
invoice
=
self
.
createWechatSaleInvoiceTransaction
(
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
payment_mode
=
"wechat"
,
destination_section
=
person
.
getRelativeUrl
())
destination_section
=
person
.
getRelativeUrl
())
self
.
tic
()
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getWechatPaymentRelatedValue
()
payment
=
self
.
portal
.
accounting_module
.
newContent
(
payment
.
setResourceValue
(
self
.
portal
.
currency_module
.
EUR
)
portal_type
=
"Payment Transaction"
,
payment_mode
=
'wechat'
,
causality_value
=
invoice
,
destination_section
=
invoice
.
getDestinationSection
(),
resource_value
=
self
.
portal
.
currency_module
.
CNY
,
created_by_builder
=
1
# to prevent init script to create lines
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
payment
.
PaymentTransaction_generateWechatId
()
payment
.
PaymentTransaction_generateWechatId
()
self
.
tic
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
...
@@ -742,164 +688,5 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -742,164 +688,5 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self
.
assertEqual
(
"%s/already_registered"
%
payment
.
getRelativeUrl
(),
self
.
assertEqual
(
"%s/already_registered"
%
payment
.
getRelativeUrl
(),
redirect
)
redirect
)
class
TestSlapOSWechatSaleInvoiceTransaction_getWechatPaymentRelatedValue
(
system_event_list
=
payment
.
getDestinationRelatedValueList
(
portal_type
=
"Payzen Event"
)
SlapOSTestCaseMixinWithAbort
):
self
.
assertEqual
(
len
(
system_event_list
),
0
)
\ No newline at end of file
def
test_SaleInvoiceTransaction_getWechatPaymentRelatedValue
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
SaleInvoiceTransaction_getWechatPaymentRelatedValue
()
self
.
assertNotEqual
(
None
,
payment
)
self
.
assertEqual
(
payment
.
getSimulationState
(),
"started"
)
self
.
assertEqual
(
payment
.
getCausalityValue
(),
invoice
)
self
.
assertEqual
(
payment
.
getPaymentModeUid
(),
self
.
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
())
payment
.
setStartDate
(
DateTime
())
payment
.
stop
()
payment
.
immediateReindexObject
()
payment
=
invoice
.
SaleInvoiceTransaction_getWechatPaymentRelatedValue
()
self
.
assertEqual
(
None
,
payment
)
class
TestSlapOSWechatSaleInvoiceTransaction_createReversalWechatTransaction
(
SlapOSTestCaseMixinWithAbort
):
def
test_createReversalWechatTransaction_REQUEST_disallowed
(
self
):
self
.
assertRaises
(
Unauthorized
,
self
.
portal
.
SaleInvoiceTransaction_createReversalWechatTransaction
,
REQUEST
=
{})
def
test_createReversalWechatTransaction_bad_portal_type
(
self
):
self
.
assertRaises
(
AssertionError
,
self
.
portal
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_bad_payment_mode
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
invoice
.
edit
(
payment_mode
=
"cash"
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_bad_state
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice
,
'delivered'
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_zero_price
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
invoice
.
manage_delObjects
(
invoice
.
contentIds
())
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_wrong_trade_condition
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
invoice
.
edit
(
specialise
=
None
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_paid
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
line
=
invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)[
0
]
line
.
edit
(
grouping_reference
=
"azerty"
)
self
.
tic
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_no_payment
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
# Do not reindex payment. portal_catalog will not find it.
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_no_wechat_payment
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
getCausalityRelatedValue
()
payment
.
edit
(
payment_mode
=
"cash"
)
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_no_payment_state
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
getCausalityRelatedValue
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'cancelled'
)
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_registered_payment
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
getCausalityRelatedValue
()
payment
.
PaymentTransaction_generateWechatId
()
self
.
assertRaises
(
AssertionError
,
invoice
.
SaleInvoiceTransaction_createReversalWechatTransaction
)
def
test_createReversalWechatTransaction_ok
(
self
):
invoice
=
self
.
createWechatSaleInvoiceTransaction
()
self
.
tic
()
payment
=
invoice
.
getCausalityRelatedValue
()
reversale_invoice
=
invoice
.
\
SaleInvoiceTransaction_createReversalWechatTransaction
()
self
.
assertEqual
(
invoice
.
getPaymentMode
(
""
),
""
)
self
.
assertEqual
(
payment
.
getPaymentMode
(
""
),
""
)
self
.
assertEqual
(
payment
.
getSimulationState
(),
"cancelled"
)
self
.
assertEqual
(
reversale_invoice
.
getTitle
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getDescription
(),
"Reversal Transaction for %s"
%
invoice
.
getTitle
())
self
.
assertEqual
(
reversale_invoice
.
getCausality
(),
invoice
.
getRelativeUrl
())
self
.
assertEqual
(
reversale_invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
invoice_line_id
=
invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)[
0
].
getId
()
transaction_line_id
=
invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)[
0
].
getId
()
self
.
assertEqual
(
invoice
[
invoice_line_id
].
getQuantity
(),
-
reversale_invoice
[
invoice_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
invoice_line_id
].
getQuantity
(),
2
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getQuantity
(),
-
reversale_invoice
[
transaction_line_id
].
getQuantity
())
self
.
assertEqual
(
reversale_invoice
[
transaction_line_id
].
getQuantity
(),
3
)
self
.
assertEqual
(
len
(
invoice
.
getMovementList
()),
2
)
# Both invoice should have a grouping reference
self
.
assertNotEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
""
),
""
)
self
.
assertEqual
(
invoice
[
transaction_line_id
].
getGroupingReference
(
"1"
),
reversale_invoice
[
transaction_line_id
].
getGroupingReference
(
"2"
))
# All references should be regenerated
self
.
assertNotEqual
(
invoice
.
getReference
(
""
),
reversale_invoice
.
getReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getSourceReference
(
""
),
reversale_invoice
.
getSourceReference
(
""
))
self
.
assertNotEqual
(
invoice
.
getDestinationReference
(
""
),
reversale_invoice
.
getDestinationReference
(
""
))
# Another trade condition
self
.
assertEqual
(
reversale_invoice
.
getSpecialise
(),
"sale_trade_condition_module/slapos_manual_accounting_trade_condition"
)
self
.
tic
()
master/bt5/slapos_wechat/bt/template_path_list
View file @
21504241
image_module/wechat**
image_module/wechat**
portal_alarms/slapos_wechat_update_confirmed_payment
portal_alarms/slapos_wechat_update_started_payment
portal_alarms/slapos_wechat_update_started_payment
portal_integrations/slapos_wechat_test_integration
portal_integrations/slapos_wechat_test_integration
portal_integrations/slapos_wechat_test_integration/Causality
portal_integrations/slapos_wechat_test_integration/Causality
...
...
master/bt5/slapos_wechat/bt/template_test_id_list
View file @
21504241
test.erp5.testSlapOSWechatSkins
test.erp5.testSlapOSWechatSkins
test.erp5.testSlapOSWechatWorkflow
test.erp5.testSlapOSWechatWorkflow
test.erp5.testSlapOSWechatAlarm
test.erp5.testSlapOSWechatAlarm
test.erp5.testSlapOSWechatBuilder
test.erp5.testSlapOSWechatEntityCreatePayment
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment