| @@ -131,8 +131,16 @@ | ||
| 131 | 131 | 'capabilities' => $this->gateway_contract->get_capabilities( $item, $request ), |
| 132 | 132 | 'provider_data' => $this->gateway_contract->get_provider_data( $item, $request ), |
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | + // The status the merchant configured this gateway to settle a POS sale to, | |
| 136 | + // so the app can recognise a configured outcome WooCommerce does not call | |
| 137 | + // paid (Pending payment for a "pay by invoice" flow, On hold for a bank | |
| 138 | + // transfer). Null when the merchant has not stored one: the app must not | |
| 139 | + // treat an unpaid status as settled on a guess. | |
| 140 | + $settled_status = $this->gateway_contract->get_settled_order_status( $item->id ); | |
| 141 | + $data['settled_order_status'] = '' === $settled_status ? null : $settled_status; | |
| 142 | + | |
| 135 | 143 | $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; |
| 136 | 144 | $data = $this->add_additional_fields_to_object( $data, $request ); |
| 137 | 145 | $data = $this->filter_response_by_context( $data, $context ); |
| 138 | 146 | |
| @@ -212,8 +220,14 @@ | ||
| 212 | 220 | ), |
| 213 | 221 | 'provider_data' => array( |
| 214 | 222 | 'description' => __( 'Provider-specific public metadata.', 'woocommerce-pos' ), |
| 215 | 223 | 'type' => 'object', |
| 224 | + 'context' => array( 'view' ), | |
| 225 | + 'readonly' => true, | |
| 226 | + ), | |
| 227 | + 'settled_order_status' => array( | |
| 228 | + 'description' => __( 'Order status (without the wc- prefix) the merchant configured this gateway to settle a POS sale to, or null when none is stored.', 'woocommerce-pos' ), | |
| 229 | + 'type' => array( 'string', 'null' ), | |
| 216 | 230 | 'context' => array( 'view' ), |
| 217 | 231 | 'readonly' => true, |
| 218 | 232 | ), |
| 219 | 233 | ), |