支付令牌

class odoo.addons.payment.models.payment_token.PaymentToken[源代码]
_get_available_tokens(providers_ids, partner_id, is_validation=False, **kwargs)[源代码]

Return the available tokens linked to the given providers and partner.

For a module to retrieve the available tokens, it must override this method and add information in the kwargs to define the context of the request.

参数
  • providers_ids (list) – The ids of the providers available for the transaction.

  • partner_id (int) – The id of the partner.

  • is_validation (bool) – Whether the transaction is a validation operation.

  • kwargs (dict) – Locally unused keywords arguments.

返回

The available tokens.

返回类型

payment.token

_build_display_name(*args, max_length=34, should_pad=True, **kwargs)[源代码]

Build a token name of the desired maximum length with the format •••• 1234.

The payment details are padded on the left with up to four padding characters. The padding is only added if there is enough room for it. If not, it is either reduced or not added at all. If there is not enough room for the payment details either, they are trimmed from the left.

For a module to customize the display name of a token, it must override this method and return the customized display name.

Note: self.ensure_one()

参数
  • args (list) – The arguments passed by QWeb when calling this method.

  • max_length (int) – The desired maximum length of the token name. The default is 34 to fit the largest IBANs.

  • should_pad (bool) – Whether the token should be padded.

  • kwargs (dict) – Optional data used in overrides of this method.

返回

The padded token name.

返回类型

str

_get_specific_create_values(provider_code, values)[源代码]

Complete the values of the create method with provider-specific values.

For a provider to add its own create values, it must overwrite this method and return a dict of values. Provider-specific values take precedence over those of the dict of generic create values.

参数
  • provider_code (str) – The code of the provider managing the token.

  • values (dict) – The original create values.

返回

The dict of provider-specific create values.

返回类型

dict

_handle_archiving()[源代码]

Handle the archiving of tokens.

For a module to perform additional operations when a token is archived, it must override this method.

返回

None

get_linked_records_info()[源代码]

Return a list of information about records linked to the current token.

For a module to implement payments and link documents to a token, it must override this method and add information about linked document records to the returned list.

The information must be structured as a dict with the following keys:

  • description: The description of the record’s model (e.g. “Subscription”).

  • id: The id of the record.

  • name: The name of the record.

  • url: The url to access the record.

Note: self.ensure_one()

返回

The list of information about the linked document records.

返回类型

list