0

I am trying to create a component that can add payments to an existing order.(the payment is received offline). However, when I try to add an amount I receive the alert that the field is not writable ("The selected data property doesn't support writing"). Does anyone know how this may be accomplished using Rules?

This is my attempt so far:

{ "rules_set_order_id_as_paid" : {
"LABEL" : "Set order id as paid",
"PLUGIN" : "action set",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "orderid" : { "label" : "orderid", "type" : "list\u003Cinteger\u003E" } },
"ACTION SET" : [
  { "LOOP" : {
      "USING" : { "list" : [ "orderid" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "entity_fetch" : {
            "USING" : { "type" : "commerce_order", "id" : [ "list-item" ] },
            "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
          }
        },
        { "drupal_message" : { "message" : "[entity-fetched:order-number]" } },
        { "entity_create" : {
            "USING" : {
              "type" : "commerce_payment_transaction",
              "param_user" : [ "entity-fetched:owner" ],
              "param_order" : [ "entity-fetched" ],
              "param_payment_method" : "faktura"
            },
            "PROVIDE" : { "entity_created" : { "entity_payment_created" : "Created payment entity" } }
          }
        },
        { "data_set" : { "data" : [ "entity-payment-created:created" ], "value" : 1575626400 } },
        { "data_set" : {
            "data" : [ "entity-payment-created:payment-method" ],
            "value" : "faktura"
          }
        },
        { "data_set" : { "data" : [ "entity-fetched:status" ], "value" : "completed" } },
        { "data_set" : {
            "data" : [ "entity-payment-created:payment-method" ],
            "value" : "commerce_payment_example"
          }
        }
      ]
    }
  }
]

} }

0

I ended up doing some sql statements that seem to have done the trick. One challenge was raising the event Paid in full via sql, which I ended up doing via executing a component manually. Not the most elegant solution but it did get the job done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.