[FIX][H4547] website_sale_signifyd: make module installable

This commit is contained in:
Milan
2024-10-19 19:26:57 +02:00
parent 84c4774b35
commit dc248d1c20
4 changed files with 33 additions and 32 deletions

View File

@@ -125,6 +125,7 @@ class SaleOrder(models.Model):
'confirmationEmail': self.partner_id.email, 'confirmationEmail': self.partner_id.email,
'confirmationPhone': self.partner_id.phone, 'confirmationPhone': self.partner_id.phone,
'products': [ 'products': [
{
'itemName': line.product_id.name, 'itemName': line.product_id.name,
'itemPrice': line.price_unit, 'itemPrice': line.price_unit,
'itemQuantity': line.product_uom_qty, 'itemQuantity': line.product_uom_qty,
@@ -134,7 +135,7 @@ class SaleOrder(models.Model):
'itemId': line.product_id.id, 'itemId': line.product_id.id,
'itemUrl': line.product_id.website_url, 'itemUrl': line.product_id.website_url,
'itemWeight': line.product_id.weight, 'itemWeight': line.product_id.weight,
for line in self.order_line if line.product_id } for line in self.order_line if line.product_id
], ],
'shipments': [ 'shipments': [
{ {
@@ -146,24 +147,24 @@ class SaleOrder(models.Model):
}, },
'transactions': [ 'transactions': [
{ {
"parentTransactionId": None, 'parentTransactionId': None,
"transactionId": tx.id, 'transactionId': tx.id,
"gateway": tx.acquirer_id.name, 'gateway': tx.acquirer_id.name,
"paymentMethod": "CREDIT_CARD", 'paymentMethod': 'CREDIT_CARD',
"gatewayStatusCode": tx_status_type.get(tx.state, 'PENDING'), 'gatewayStatusCode': tx_status_type.get(tx.state, 'PENDING'),
"currency": tx.currency_id.name, 'currency': tx.currency_id.name,
"amount": tx.amount, 'amount': tx.amount,
# "avsResponseCode": "Y", # "avsResponseCode": "Y",
# "cvvResponseCode": "N", # "cvvResponseCode": "N",
"checkoutPaymentDetails": { 'checkoutPaymentDetails': {
"accountHolderName": tx.partner_id.name, 'accountHolderName': tx.partner_id.name,
"billingAddress": { 'billingAddress': {
"streetAddress": tx.partner_id.street, 'streetAddress': tx.partner_id.street,
"unit": tx.partner_id.street2, 'unit': tx.partner_id.street2,
"city": tx.partner_id.city, 'city': tx.partner_id.city,
"provinceCode": tx.partner_id.state_id.code, 'provinceCode': tx.partner_id.state_id.code,
"postalCode": tx.partner_id.zip, 'postalCode': tx.partner_id.zip,
"countryCode": tx.partner_id.country_id.code, 'countryCode': tx.partner_id.country_id.code,
} }
} }
} }

View File

@@ -8,7 +8,7 @@ class SignifydCoverage(models.Model):
name = fields.Char(required=True) name = fields.Char(required=True)
description = fields.Char() description = fields.Char()
code = fields.Char(required=True) code = fields.Char(required=True)
exclusive = fields.Boolean()) exclusive = fields.Boolean()
def _apply_exclusivity(self): def _apply_exclusivity(self):
return self.filtered('exclusive')[:1] or self return self.filtered('exclusive')[:1] or self

View File

@@ -8,7 +8,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='website_id']" position="after"> <xpath expr="//field[@name='website_id']" position="after">
<field name="signifyd_case_required"/> <field name="signifyd_case_required"/>
<field name="signifyd_coverage_type_ids"/> <field name="signifyd_coverage_ids"/>
</xpath> </xpath>
</field> </field>
</record> </record>

View File

@@ -107,7 +107,7 @@
<field name="secret_key" attrs="{'invisible': [('test_mode', '=', True)]}"/> <field name="secret_key" attrs="{'invisible': [('test_mode', '=', True)]}"/>
<field name="secret_key_test" attrs="{'invisible': [('test_mode', '!=', True)]}"/> <field name="secret_key_test" attrs="{'invisible': [('test_mode', '!=', True)]}"/>
<!-- <field name="signifyd_case_type" /> --> <!-- <field name="signifyd_case_type" /> -->
<field name="signifyd_coverage_type_ids"/> <field name="signifyd_coverage_ids"/>
<p class="text-muted"> <p class="text-muted">
Optional: Add users to be notified if a sale order is declined by Signifyd. Optional: Add users to be notified if a sale order is declined by Signifyd.
</p> </p>