File tree Expand file tree Collapse file tree
pos_payment_method_cashdro Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from . import pos_payment_method
2- from . import pos_session
Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ def _get_payment_terminal_selection(self):
1515 )
1616 cashdro_user = fields .Char ()
1717 cashdro_password = fields .Char ()
18+ cashdro_http = fields .Boolean (
19+ string = "Use HTTP connection" ,
20+ help = "Check this to enable HTTP (not secure) connection. You should enable it"
21+ " also in Cashdro configuration interface." ,
22+ )
1823
1924 def _onchange_journal_id (self ):
2025 """Cash payment method force the `use_payment_terminal` to `False` as
@@ -33,3 +38,11 @@ def _compute_hide_use_payment_terminal(self):
3338 return super (
3439 PosPaymentMethod , self - cash_payment_types
3540 )._compute_hide_use_payment_terminal ()
41+
42+ def _load_pos_data_fields (self , config_id ):
43+ return super ()._load_pos_data_fields (config_id ) + [
44+ "cashdro_host" ,
45+ "cashdro_user" ,
46+ "cashdro_password" ,
47+ "cashdro_http" ,
48+ ]
Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -107,12 +107,15 @@ export class PaymentCashdro extends PaymentInterface {
107107 _cashdro_url ( ) {
108108 // Cashdro machines don't support safe POST calls, so we're sending
109109 // all the data quite unsafely constantly...
110- const method = this . pos . get_order ( ) . selected_paymentline . payment_method ;
110+ const method = this . pos
111+ . get_order ( )
112+ . get_selected_paymentline ( ) . payment_method_id ;
111113 const host = method && method . cashdro_host ;
112114 if ( ! host ) {
113115 return false ;
114116 }
115- let url = `${ host } /Cashdro3WS/index.php` ;
117+ const connection = method . cashdro_http ? `http://` : `https://` ;
118+ let url = `${ connection } ${ host } /Cashdro3WS/index.php` ;
116119 url += `?name=${ method . cashdro_user } ` ;
117120 url += `&password=${ method . cashdro_password } ` ;
118121 return url ;
@@ -125,7 +128,7 @@ export class PaymentCashdro extends PaymentInterface {
125128 const operationType = parameters . amount > 0 ? 4 : 3 ;
126129 parameters = { ...parameters , amount : Math . abs ( parameters . amount ) } ;
127130 let url = `${ this . _cashdro_url ( ) } &operation=startOperation&type=${ operationType } ` ;
128- url += `&posid=pos-${ this . pos . pos_session . name } ` ;
131+ url += `&posid=pos-${ this . pos . session . name } ` ;
129132 url += `&posuser=${ user } ` ;
130133 url += `¶meters=${ encodeURIComponent ( JSON . stringify ( parameters ) ) } ` ;
131134 return url ;
Original file line number Diff line number Diff line change 1010 invisible =" use_payment_terminal != 'cashdro'"
1111 required =" use_payment_terminal == 'cashdro'"
1212 />
13+ <field
14+ name =" cashdro_http"
15+ invisible =" use_payment_terminal != 'cashdro'"
16+ />
1317 <field
1418 name =" cashdro_user"
1519 invisible =" use_payment_terminal != 'cashdro'"
You can’t perform that action at this time.
0 commit comments